From dbc9bdfe02ae2847c99a794b7a3ca47c0501bd4b Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Tue, 7 Nov 2017 15:30:13 +0300 Subject: [PATCH] Implement set_ideal_processor_core (linux) --- Utilities/Thread.cpp | 5 +++++ rpcs3/Emu/RSX/RSXThread.cpp | 1 + 2 files changed, 6 insertions(+) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 6fca5cc54c..ac77041b50 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1916,6 +1916,11 @@ void thread_ctrl::set_ideal_processor_core(int core) #ifdef _WIN32 HANDLE _this_thread = GetCurrentThread(); SetThreadIdealProcessor(_this_thread, core); +#else + cpu_set_t cs; + CPU_ZERO(&cs); + CPU_SET(core, &cs); + pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cs); #endif } diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 7e9f88ff18..952acf1894 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -394,6 +394,7 @@ namespace rsx // Raise priority above other threads thread_ctrl::set_native_priority(1); + thread_ctrl::set_ideal_processor_core(0); // Round to nearest to deal with forward/reverse scaling fesetround(FE_TONEAREST);