diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/param_package.cpp | 6 | ||||
| -rw-r--r-- | src/core/cpu_manager.cpp | 3 | ||||
| -rw-r--r-- | src/core/cpu_manager.h | 5 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_process.cpp | 15 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_scheduler.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_thread.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 12 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.h | 13 | ||||
| -rw-r--r-- | src/yuzu/bootmanager.cpp | 3 | ||||
| -rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 8 |
12 files changed, 55 insertions, 19 deletions
diff --git a/src/common/param_package.cpp b/src/common/param_package.cpp index bbf20f5eb..462502e34 100644 --- a/src/common/param_package.cpp +++ b/src/common/param_package.cpp | |||
| @@ -76,7 +76,7 @@ std::string ParamPackage::Serialize() const { | |||
| 76 | std::string ParamPackage::Get(const std::string& key, const std::string& default_value) const { | 76 | std::string ParamPackage::Get(const std::string& key, const std::string& default_value) const { |
| 77 | auto pair = data.find(key); | 77 | auto pair = data.find(key); |
| 78 | if (pair == data.end()) { | 78 | if (pair == data.end()) { |
| 79 | LOG_DEBUG(Common, "key '{}' not found", key); | 79 | LOG_TRACE(Common, "key '{}' not found", key); |
| 80 | return default_value; | 80 | return default_value; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| @@ -86,7 +86,7 @@ std::string ParamPackage::Get(const std::string& key, const std::string& default | |||
| 86 | int ParamPackage::Get(const std::string& key, int default_value) const { | 86 | int ParamPackage::Get(const std::string& key, int default_value) const { |
| 87 | auto pair = data.find(key); | 87 | auto pair = data.find(key); |
| 88 | if (pair == data.end()) { | 88 | if (pair == data.end()) { |
| 89 | LOG_DEBUG(Common, "key '{}' not found", key); | 89 | LOG_TRACE(Common, "key '{}' not found", key); |
| 90 | return default_value; | 90 | return default_value; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| @@ -101,7 +101,7 @@ int ParamPackage::Get(const std::string& key, int default_value) const { | |||
| 101 | float ParamPackage::Get(const std::string& key, float default_value) const { | 101 | float ParamPackage::Get(const std::string& key, float default_value) const { |
| 102 | auto pair = data.find(key); | 102 | auto pair = data.find(key); |
| 103 | if (pair == data.end()) { | 103 | if (pair == data.end()) { |
| 104 | LOG_DEBUG(Common, "key {} not found", key); | 104 | LOG_TRACE(Common, "key {} not found", key); |
| 105 | return default_value; | 105 | return default_value; |
| 106 | } | 106 | } |
| 107 | 107 | ||
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index 1c07dc90e..d69b2602a 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp | |||
| @@ -26,6 +26,7 @@ void CpuManager::ThreadStart(std::stop_token stop_token, CpuManager& cpu_manager | |||
| 26 | 26 | ||
| 27 | void CpuManager::Initialize() { | 27 | void CpuManager::Initialize() { |
| 28 | num_cores = is_multicore ? Core::Hardware::NUM_CPU_CORES : 1; | 28 | num_cores = is_multicore ? Core::Hardware::NUM_CPU_CORES : 1; |
| 29 | gpu_barrier = std::make_unique<Common::Barrier>(num_cores + 1); | ||
| 29 | 30 | ||
| 30 | for (std::size_t core = 0; core < num_cores; core++) { | 31 | for (std::size_t core = 0; core < num_cores; core++) { |
| 31 | core_data[core].host_thread = std::jthread(ThreadStart, std::ref(*this), core); | 32 | core_data[core].host_thread = std::jthread(ThreadStart, std::ref(*this), core); |
| @@ -230,6 +231,8 @@ void CpuManager::RunThread(std::size_t core) { | |||
| 230 | }); | 231 | }); |
| 231 | 232 | ||
| 232 | // Running | 233 | // Running |
| 234 | gpu_barrier->Sync(); | ||
| 235 | |||
| 233 | if (!is_async_gpu && !is_multicore) { | 236 | if (!is_async_gpu && !is_multicore) { |
| 234 | system.GPU().ObtainContext(); | 237 | system.GPU().ObtainContext(); |
| 235 | } | 238 | } |
diff --git a/src/core/cpu_manager.h b/src/core/cpu_manager.h index 681bdaf19..f0751fc58 100644 --- a/src/core/cpu_manager.h +++ b/src/core/cpu_manager.h | |||
| @@ -43,6 +43,10 @@ public: | |||
| 43 | is_async_gpu = is_async; | 43 | is_async_gpu = is_async; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | void OnGpuReady() { | ||
| 47 | gpu_barrier->Sync(); | ||
| 48 | } | ||
| 49 | |||
| 46 | void Initialize(); | 50 | void Initialize(); |
| 47 | void Shutdown(); | 51 | void Shutdown(); |
| 48 | 52 | ||
| @@ -81,6 +85,7 @@ private: | |||
| 81 | std::jthread host_thread; | 85 | std::jthread host_thread; |
| 82 | }; | 86 | }; |
| 83 | 87 | ||
| 88 | std::unique_ptr<Common::Barrier> gpu_barrier{}; | ||
| 84 | std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{}; | 89 | std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{}; |
| 85 | 90 | ||
| 86 | bool is_async_gpu{}; | 91 | bool is_async_gpu{}; |
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index 6a73f6783..cb84c20e3 100644 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp | |||
| @@ -57,18 +57,13 @@ void SetupMainThread(Core::System& system, KProcess& owner_process, u32 priority | |||
| 57 | thread->GetContext64().cpu_registers[0] = 0; | 57 | thread->GetContext64().cpu_registers[0] = 0; |
| 58 | thread->GetContext32().cpu_registers[1] = thread_handle; | 58 | thread->GetContext32().cpu_registers[1] = thread_handle; |
| 59 | thread->GetContext64().cpu_registers[1] = thread_handle; | 59 | thread->GetContext64().cpu_registers[1] = thread_handle; |
| 60 | thread->DisableDispatch(); | ||
| 61 | 60 | ||
| 62 | auto& kernel = system.Kernel(); | 61 | if (system.DebuggerEnabled()) { |
| 63 | // Threads by default are dormant, wake up the main thread so it runs when the scheduler fires | 62 | thread->RequestSuspend(SuspendType::Debug); |
| 64 | { | ||
| 65 | KScopedSchedulerLock lock{kernel}; | ||
| 66 | thread->SetState(ThreadState::Runnable); | ||
| 67 | |||
| 68 | if (system.DebuggerEnabled()) { | ||
| 69 | thread->RequestSuspend(SuspendType::Debug); | ||
| 70 | } | ||
| 71 | } | 63 | } |
| 64 | |||
| 65 | // Run our thread. | ||
| 66 | void(thread->Run()); | ||
| 72 | } | 67 | } |
| 73 | } // Anonymous namespace | 68 | } // Anonymous namespace |
| 74 | 69 | ||
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp index edd0e4eae..fb3b84f3d 100644 --- a/src/core/hle/kernel/k_scheduler.cpp +++ b/src/core/hle/kernel/k_scheduler.cpp | |||
| @@ -830,6 +830,7 @@ void KScheduler::Initialize() { | |||
| 830 | idle_thread = KThread::Create(system.Kernel()); | 830 | idle_thread = KThread::Create(system.Kernel()); |
| 831 | ASSERT(KThread::InitializeIdleThread(system, idle_thread, core_id).IsSuccess()); | 831 | ASSERT(KThread::InitializeIdleThread(system, idle_thread, core_id).IsSuccess()); |
| 832 | idle_thread->SetName(fmt::format("IdleThread:{}", core_id)); | 832 | idle_thread->SetName(fmt::format("IdleThread:{}", core_id)); |
| 833 | idle_thread->EnableDispatch(); | ||
| 833 | } | 834 | } |
| 834 | 835 | ||
| 835 | KScopedSchedulerLock::KScopedSchedulerLock(KernelCore& kernel) | 836 | KScopedSchedulerLock::KScopedSchedulerLock(KernelCore& kernel) |
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp index 8d48a7901..268789150 100644 --- a/src/core/hle/kernel/k_thread.cpp +++ b/src/core/hle/kernel/k_thread.cpp | |||
| @@ -225,7 +225,7 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s | |||
| 225 | // Setup the stack parameters. | 225 | // Setup the stack parameters. |
| 226 | StackParameters& sp = GetStackParameters(); | 226 | StackParameters& sp = GetStackParameters(); |
| 227 | sp.cur_thread = this; | 227 | sp.cur_thread = this; |
| 228 | sp.disable_count = 0; | 228 | sp.disable_count = 1; |
| 229 | SetInExceptionHandler(); | 229 | SetInExceptionHandler(); |
| 230 | 230 | ||
| 231 | // Set thread ID. | 231 | // Set thread ID. |
| @@ -1014,8 +1014,6 @@ ResultCode KThread::Run() { | |||
| 1014 | // Set our state and finish. | 1014 | // Set our state and finish. |
| 1015 | SetState(ThreadState::Runnable); | 1015 | SetState(ThreadState::Runnable); |
| 1016 | 1016 | ||
| 1017 | DisableDispatch(); | ||
| 1018 | |||
| 1019 | return ResultSuccess; | 1017 | return ResultSuccess; |
| 1020 | } | 1018 | } |
| 1021 | } | 1019 | } |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 73593c7a0..66c8f4455 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -254,7 +254,6 @@ struct KernelCore::Impl { | |||
| 254 | core_id) | 254 | core_id) |
| 255 | .IsSuccess()); | 255 | .IsSuccess()); |
| 256 | shutdown_threads[core_id]->SetName(fmt::format("SuspendThread:{}", core_id)); | 256 | shutdown_threads[core_id]->SetName(fmt::format("SuspendThread:{}", core_id)); |
| 257 | shutdown_threads[core_id]->DisableDispatch(); | ||
| 258 | } | 257 | } |
| 259 | } | 258 | } |
| 260 | 259 | ||
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 47db0bacf..2ff6d5fa6 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -1726,11 +1726,12 @@ static ResultCode UnmapProcessCodeMemory(Core::System& system, Handle process_ha | |||
| 1726 | /// Exits the current process | 1726 | /// Exits the current process |
| 1727 | static void ExitProcess(Core::System& system) { | 1727 | static void ExitProcess(Core::System& system) { |
| 1728 | auto* current_process = system.Kernel().CurrentProcess(); | 1728 | auto* current_process = system.Kernel().CurrentProcess(); |
| 1729 | UNIMPLEMENTED(); | ||
| 1730 | 1729 | ||
| 1731 | LOG_INFO(Kernel_SVC, "Process {} exiting", current_process->GetProcessID()); | 1730 | LOG_INFO(Kernel_SVC, "Process {} exiting", current_process->GetProcessID()); |
| 1732 | ASSERT_MSG(current_process->GetStatus() == ProcessStatus::Running, | 1731 | ASSERT_MSG(current_process->GetStatus() == ProcessStatus::Running, |
| 1733 | "Process has already exited"); | 1732 | "Process has already exited"); |
| 1733 | |||
| 1734 | system.Exit(); | ||
| 1734 | } | 1735 | } |
| 1735 | 1736 | ||
| 1736 | static void ExitProcess32(Core::System& system) { | 1737 | static void ExitProcess32(Core::System& system) { |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 4657bdabc..c4a93e524 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -686,7 +686,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, | |||
| 686 | {66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"}, | 686 | {66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"}, |
| 687 | {67, nullptr, "CancelCpuBoostMode"}, | 687 | {67, nullptr, "CancelCpuBoostMode"}, |
| 688 | {68, nullptr, "GetBuiltInDisplayType"}, | 688 | {68, nullptr, "GetBuiltInDisplayType"}, |
| 689 | {80, nullptr, "PerformSystemButtonPressingIfInFocus"}, | 689 | {80, &ICommonStateGetter::PerformSystemButtonPressingIfInFocus, "PerformSystemButtonPressingIfInFocus"}, |
| 690 | {90, nullptr, "SetPerformanceConfigurationChangedNotification"}, | 690 | {90, nullptr, "SetPerformanceConfigurationChangedNotification"}, |
| 691 | {91, nullptr, "GetCurrentPerformanceConfiguration"}, | 691 | {91, nullptr, "GetCurrentPerformanceConfiguration"}, |
| 692 | {100, nullptr, "SetHandlingHomeButtonShortPressedEnabled"}, | 692 | {100, nullptr, "SetHandlingHomeButtonShortPressedEnabled"}, |
| @@ -826,6 +826,16 @@ void ICommonStateGetter::SetCpuBoostMode(Kernel::HLERequestContext& ctx) { | |||
| 826 | apm_sys->SetCpuBoostMode(ctx); | 826 | apm_sys->SetCpuBoostMode(ctx); |
| 827 | } | 827 | } |
| 828 | 828 | ||
| 829 | void ICommonStateGetter::PerformSystemButtonPressingIfInFocus(Kernel::HLERequestContext& ctx) { | ||
| 830 | IPC::RequestParser rp{ctx}; | ||
| 831 | const auto system_button{rp.PopEnum<SystemButtonType>()}; | ||
| 832 | |||
| 833 | LOG_WARNING(Service_AM, "(STUBBED) called, system_button={}", system_button); | ||
| 834 | |||
| 835 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 836 | rb.Push(ResultSuccess); | ||
| 837 | } | ||
| 838 | |||
| 829 | void ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled( | 839 | void ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled( |
| 830 | Kernel::HLERequestContext& ctx) { | 840 | Kernel::HLERequestContext& ctx) { |
| 831 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 841 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 06f13aa09..988ead215 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -220,6 +220,18 @@ private: | |||
| 220 | Docked = 1, | 220 | Docked = 1, |
| 221 | }; | 221 | }; |
| 222 | 222 | ||
| 223 | // This is nn::am::service::SystemButtonType | ||
| 224 | enum class SystemButtonType { | ||
| 225 | None, | ||
| 226 | HomeButtonShortPressing, | ||
| 227 | HomeButtonLongPressing, | ||
| 228 | PowerButtonShortPressing, | ||
| 229 | PowerButtonLongPressing, | ||
| 230 | ShutdownSystem, | ||
| 231 | CaptureButtonShortPressing, | ||
| 232 | CaptureButtonLongPressing, | ||
| 233 | }; | ||
| 234 | |||
| 223 | void GetEventHandle(Kernel::HLERequestContext& ctx); | 235 | void GetEventHandle(Kernel::HLERequestContext& ctx); |
| 224 | void ReceiveMessage(Kernel::HLERequestContext& ctx); | 236 | void ReceiveMessage(Kernel::HLERequestContext& ctx); |
| 225 | void GetCurrentFocusState(Kernel::HLERequestContext& ctx); | 237 | void GetCurrentFocusState(Kernel::HLERequestContext& ctx); |
| @@ -234,6 +246,7 @@ private: | |||
| 234 | void EndVrModeEx(Kernel::HLERequestContext& ctx); | 246 | void EndVrModeEx(Kernel::HLERequestContext& ctx); |
| 235 | void GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx); | 247 | void GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx); |
| 236 | void SetCpuBoostMode(Kernel::HLERequestContext& ctx); | 248 | void SetCpuBoostMode(Kernel::HLERequestContext& ctx); |
| 249 | void PerformSystemButtonPressingIfInFocus(Kernel::HLERequestContext& ctx); | ||
| 237 | void SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(Kernel::HLERequestContext& ctx); | 250 | void SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(Kernel::HLERequestContext& ctx); |
| 238 | 251 | ||
| 239 | std::shared_ptr<AppletMessageQueue> msg_queue; | 252 | std::shared_ptr<AppletMessageQueue> msg_queue; |
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index cbe4e2daa..01acda22b 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include "common/scm_rev.h" | 29 | #include "common/scm_rev.h" |
| 30 | #include "common/settings.h" | 30 | #include "common/settings.h" |
| 31 | #include "core/core.h" | 31 | #include "core/core.h" |
| 32 | #include "core/cpu_manager.h" | ||
| 32 | #include "core/frontend/framebuffer_layout.h" | 33 | #include "core/frontend/framebuffer_layout.h" |
| 33 | #include "input_common/drivers/keyboard.h" | 34 | #include "input_common/drivers/keyboard.h" |
| 34 | #include "input_common/drivers/mouse.h" | 35 | #include "input_common/drivers/mouse.h" |
| @@ -73,6 +74,8 @@ void EmuThread::run() { | |||
| 73 | 74 | ||
| 74 | gpu.ReleaseContext(); | 75 | gpu.ReleaseContext(); |
| 75 | 76 | ||
| 77 | system.GetCpuManager().OnGpuReady(); | ||
| 78 | |||
| 76 | // Holds whether the cpu was running during the last iteration, | 79 | // Holds whether the cpu was running during the last iteration, |
| 77 | // so that the DebugModeLeft signal can be emitted before the | 80 | // so that the DebugModeLeft signal can be emitted before the |
| 78 | // next execution step | 81 | // next execution step |
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 0dce5e274..cb301e78b 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include "common/string_util.h" | 21 | #include "common/string_util.h" |
| 22 | #include "common/telemetry.h" | 22 | #include "common/telemetry.h" |
| 23 | #include "core/core.h" | 23 | #include "core/core.h" |
| 24 | #include "core/cpu_manager.h" | ||
| 24 | #include "core/crypto/key_manager.h" | 25 | #include "core/crypto/key_manager.h" |
| 25 | #include "core/file_sys/registered_cache.h" | 26 | #include "core/file_sys/registered_cache.h" |
| 26 | #include "core/file_sys/vfs_real.h" | 27 | #include "core/file_sys/vfs_real.h" |
| @@ -138,6 +139,12 @@ int main(int argc, char** argv) { | |||
| 138 | 139 | ||
| 139 | Config config{config_path}; | 140 | Config config{config_path}; |
| 140 | 141 | ||
| 142 | // apply the log_filter setting | ||
| 143 | // the logger was initialized before and doesn't pick up the filter on its own | ||
| 144 | Common::Log::Filter filter; | ||
| 145 | filter.ParseFilterString(Settings::values.log_filter.GetValue()); | ||
| 146 | Common::Log::SetGlobalFilter(filter); | ||
| 147 | |||
| 141 | if (!program_args.empty()) { | 148 | if (!program_args.empty()) { |
| 142 | Settings::values.program_args = program_args; | 149 | Settings::values.program_args = program_args; |
| 143 | } | 150 | } |
| @@ -210,6 +217,7 @@ int main(int argc, char** argv) { | |||
| 210 | 217 | ||
| 211 | // Core is loaded, start the GPU (makes the GPU contexts current to this thread) | 218 | // Core is loaded, start the GPU (makes the GPU contexts current to this thread) |
| 212 | system.GPU().Start(); | 219 | system.GPU().Start(); |
| 220 | system.GetCpuManager().OnGpuReady(); | ||
| 213 | 221 | ||
| 214 | if (Settings::values.use_disk_shader_cache.GetValue()) { | 222 | if (Settings::values.use_disk_shader_cache.GetValue()) { |
| 215 | system.Renderer().ReadRasterizer()->LoadDiskResources( | 223 | system.Renderer().ReadRasterizer()->LoadDiskResources( |