diff options
| author | 2021-08-14 02:14:19 -0700 | |
|---|---|---|
| committer | 2021-12-06 16:39:17 -0800 | |
| commit | 3dc803a430107fb22ffc91608c613e09ec5c8b51 (patch) | |
| tree | f8d5a747cf9d89befd89beec16bdc116d2725fe8 /src | |
| parent | core: hle: kernel: k_thread: Mark KScopedDisableDispatch as nodiscard. (diff) | |
| download | yuzu-3dc803a430107fb22ffc91608c613e09ec5c8b51.tar.gz yuzu-3dc803a430107fb22ffc91608c613e09ec5c8b51.tar.xz yuzu-3dc803a430107fb22ffc91608c613e09ec5c8b51.zip | |
core: hle: kernel: Disable dispatch count tracking on single core.
- This would have limited value, and would be a mess to handle properly.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/cpu_manager.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_thread.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_thread.h | 11 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index d9bd5b665..cbcc54891 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp | |||
| @@ -32,7 +32,7 @@ void CpuManager::Initialize() { | |||
| 32 | 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); |
| 33 | } | 33 | } |
| 34 | } else { | 34 | } else { |
| 35 | core_data[0].host_thread = std::jthread(ThreadStart, std::ref(*this), -1); | 35 | core_data[0].host_thread = std::jthread(ThreadStart, std::ref(*this), 0); |
| 36 | } | 36 | } |
| 37 | } | 37 | } |
| 38 | 38 | ||
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp index de94c737d..41bf9a6bb 100644 --- a/src/core/hle/kernel/k_thread.cpp +++ b/src/core/hle/kernel/k_thread.cpp | |||
| @@ -13,6 +13,9 @@ | |||
| 13 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 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" | ||
| 17 | #include "common/settings.h" | ||
| 18 | #include "common/thread_queue_list.h" | ||
| 16 | #include "core/core.h" | 19 | #include "core/core.h" |
| 17 | #include "core/cpu_manager.h" | 20 | #include "core/cpu_manager.h" |
| 18 | #include "core/hardware_properties.h" | 21 | #include "core/hardware_properties.h" |
| @@ -211,9 +214,10 @@ ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uint | |||
| 211 | // Initialize the thread. | 214 | // Initialize the thread. |
| 212 | R_TRY(thread->Initialize(func, arg, user_stack_top, prio, core, owner, type)); | 215 | R_TRY(thread->Initialize(func, arg, user_stack_top, prio, core, owner, type)); |
| 213 | 216 | ||
| 214 | // Initialize host context. | 217 | // Initialize emulation parameters. |
| 215 | thread->host_context = | 218 | thread->host_context = |
| 216 | std::make_shared<Common::Fiber>(std::move(init_func), init_func_parameter); | 219 | std::make_shared<Common::Fiber>(std::move(init_func), init_func_parameter); |
| 220 | thread->is_single_core = !Settings::values.use_multi_core.GetValue(); | ||
| 217 | 221 | ||
| 218 | return ResultSuccess; | 222 | return ResultSuccess; |
| 219 | } | 223 | } |
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; |