diff options
| author | 2021-08-14 02:14:19 -0700 | |
|---|---|---|
| committer | 2021-08-14 02:14:19 -0700 | |
| commit | aef0ca6f0d422623f46f47c15e9a4c9b5fd04dd0 (patch) | |
| tree | f82819f5b1470345ea3aab20ba18eba67afe63e5 | |
| parent | core: hle: kernel: k_thread: Mark KScopedDisableDispatch as nodiscard. (diff) | |
| download | yuzu-aef0ca6f0d422623f46f47c15e9a4c9b5fd04dd0.tar.gz yuzu-aef0ca6f0d422623f46f47c15e9a4c9b5fd04dd0.tar.xz yuzu-aef0ca6f0d422623f46f47c15e9a4c9b5fd04dd0.zip | |
core: hle: kernel: Disable dispatch count tracking on single core.
- This would have limited value, and would be a mess to handle properly.
| -rw-r--r-- | src/core/cpu_manager.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_thread.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_thread.h | 11 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index 35c1a6cbd..de2e5563e 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp | |||
| @@ -33,7 +33,7 @@ void CpuManager::Initialize() { | |||
| 33 | core_data[core].host_thread = std::jthread(ThreadStart, std::ref(*this), core); | 33 | core_data[core].host_thread = std::jthread(ThreadStart, std::ref(*this), core); |
| 34 | } | 34 | } |
| 35 | } else { | 35 | } else { |
| 36 | core_data[0].host_thread = std::jthread(ThreadStart, std::ref(*this), -1); | 36 | core_data[0].host_thread = std::jthread(ThreadStart, std::ref(*this), 0); |
| 37 | } | 37 | } |
| 38 | } | 38 | } |
| 39 | 39 | ||
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp index 89653e0cb..0f6808ade 100644 --- a/src/core/hle/kernel/k_thread.cpp +++ b/src/core/hle/kernel/k_thread.cpp | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include "common/fiber.h" | 14 | #include "common/fiber.h" |
| 15 | #include "common/logging/log.h" | 15 | #include "common/logging/log.h" |
| 16 | #include "common/scope_exit.h" | 16 | #include "common/scope_exit.h" |
| 17 | #include "common/settings.h" | ||
| 17 | #include "common/thread_queue_list.h" | 18 | #include "common/thread_queue_list.h" |
| 18 | #include "core/core.h" | 19 | #include "core/core.h" |
| 19 | #include "core/cpu_manager.h" | 20 | #include "core/cpu_manager.h" |
| @@ -215,9 +216,10 @@ ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uint | |||
| 215 | // Initialize the thread. | 216 | // Initialize the thread. |
| 216 | R_TRY(thread->Initialize(func, arg, user_stack_top, prio, core, owner, type)); | 217 | R_TRY(thread->Initialize(func, arg, user_stack_top, prio, core, owner, type)); |
| 217 | 218 | ||
| 218 | // Initialize host context. | 219 | // Initialize emulation parameters. |
| 219 | thread->host_context = | 220 | thread->host_context = |
| 220 | std::make_shared<Common::Fiber>(std::move(init_func), init_func_parameter); | 221 | std::make_shared<Common::Fiber>(std::move(init_func), init_func_parameter); |
| 222 | thread->is_single_core = !Settings::values.use_multi_core.GetValue(); | ||
| 221 | 223 | ||
| 222 | return ResultSuccess; | 224 | return ResultSuccess; |
| 223 | } | 225 | } |
diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index 8bbf66c52..e4c4c877d 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h | |||
| @@ -454,8 +454,12 @@ public: | |||
| 454 | return GetActiveCore() == 3; | 454 | return GetActiveCore() == 3; |
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | [[nodiscard]] bool IsDispatchTrackingDisabled() const { | ||
| 458 | return is_single_core || IsKernelThread(); | ||
| 459 | } | ||
| 460 | |||
| 457 | [[nodiscard]] s32 GetDisableDispatchCount() const { | 461 | [[nodiscard]] s32 GetDisableDispatchCount() const { |
| 458 | if (IsKernelThread()) { | 462 | if (IsDispatchTrackingDisabled()) { |
| 459 | // TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch. | 463 | // TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch. |
| 460 | return 1; | 464 | return 1; |
| 461 | } | 465 | } |
| @@ -464,7 +468,7 @@ public: | |||
| 464 | } | 468 | } |
| 465 | 469 | ||
| 466 | void DisableDispatch() { | 470 | void DisableDispatch() { |
| 467 | if (IsKernelThread()) { | 471 | if (IsDispatchTrackingDisabled()) { |
| 468 | // TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch. | 472 | // TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch. |
| 469 | return; | 473 | return; |
| 470 | } | 474 | } |
| @@ -474,7 +478,7 @@ public: | |||
| 474 | } | 478 | } |
| 475 | 479 | ||
| 476 | void EnableDispatch() { | 480 | void EnableDispatch() { |
| 477 | if (IsKernelThread()) { | 481 | if (IsDispatchTrackingDisabled()) { |
| 478 | // TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch. | 482 | // TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch. |
| 479 | return; | 483 | return; |
| 480 | } | 484 | } |
| @@ -727,6 +731,7 @@ private: | |||
| 727 | 731 | ||
| 728 | // For emulation | 732 | // For emulation |
| 729 | std::shared_ptr<Common::Fiber> host_context{}; | 733 | std::shared_ptr<Common::Fiber> host_context{}; |
| 734 | bool is_single_core{}; | ||
| 730 | 735 | ||
| 731 | // For debugging | 736 | // For debugging |
| 732 | std::vector<KSynchronizationObject*> wait_objects_for_debugging; | 737 | std::vector<KSynchronizationObject*> wait_objects_for_debugging; |