diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 1fe24516b6..fabfc5839d 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -1161,7 +1161,9 @@ extern void ppu_initialize(const ppu_module& info) static semaphore<> jmutex; // Initialize semaphore with the max number of threads - semaphore jcores(std::thread::hardware_concurrency()); + u32 max_threads = static_cast(g_cfg.core.llvm_threads); + s32 thread_count = max_threads > 0 ? std::min(max_threads, std::thread::hardware_concurrency()) : std::thread::hardware_concurrency(); + semaphore jcores(thread_count); if (!jcores.get()) { diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index 3044d98e61..f4dfeafba8 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -285,6 +285,7 @@ struct cfg_root : cfg::node cfg::_bool ppu_debug{this, "PPU Debug"}; cfg::_bool llvm_logs{this, "Save LLVM logs"}; cfg::string llvm_cpu{this, "Use LLVM CPU"}; + cfg::_int<0, INT32_MAX> llvm_threads{this, "Max LLVM Compile Threads", 0}; #ifdef _WIN32 cfg::_bool thread_scheduler_enabled{ this, "Enable thread scheduler", true }; diff --git a/rpcs3/Json/tooltips.json b/rpcs3/Json/tooltips.json index cca09a5f36..700c3bfb7c 100644 --- a/rpcs3/Json/tooltips.json +++ b/rpcs3/Json/tooltips.json @@ -64,6 +64,7 @@ "gs_resizeOnBoot": "Automatically resizes the game window on boot.\nThis does not change the internal game resolution.", "showTrophyPopups": "Show trophy popups when a trophy is unlocked.", "gs_disableMouse": "Disables the activation of fullscreen mode per doubleclick while the game screen is active.\nCheck this if you want to play with mouse and keyboard (for example with UCR).", + "maxLLVMThreads": "Limits the maximum number of threads used for PPU Module compilation.\nLower this in order to increase performance of other open applications.\nThe default uses all available threads.", "useNativeInterface": "Enables use of native HUD within the game window that can interacts with the game controllers.\nWhen disabled, regular Qt dialogs are used instead.\nNot all languages are currently supported (English only)" } }, diff --git a/rpcs3/rpcs3qt/emu_settings.cpp b/rpcs3/rpcs3qt/emu_settings.cpp index be59923fa6..1d5aa3bba7 100644 --- a/rpcs3/rpcs3qt/emu_settings.cpp +++ b/rpcs3/rpcs3qt/emu_settings.cpp @@ -222,13 +222,15 @@ void emu_settings::SaveSettings() m_config.write(out.c_str(), out.size()); } -void emu_settings::EnhanceComboBox(QComboBox* combobox, SettingsType type, bool is_ranged) +void emu_settings::EnhanceComboBox(QComboBox* combobox, SettingsType type, bool is_ranged, bool use_max, int max) { if (is_ranged) { QStringList range = GetSettingOptions(type); - for (int i = range.first().toInt(); i <= range.last().toInt(); i++) + int max_item = use_max ? max : range.last().toInt(); + + for (int i = range.first().toInt(); i <= max_item; i++) { combobox->addItem(QString::number(i), QVariant(QString::number(i))); } diff --git a/rpcs3/rpcs3qt/emu_settings.h b/rpcs3/rpcs3qt/emu_settings.h index 696dda4857..dad3ec4492 100644 --- a/rpcs3/rpcs3qt/emu_settings.h +++ b/rpcs3/rpcs3qt/emu_settings.h @@ -36,6 +36,7 @@ public: PreferredSPUThreads, PPUDebug, SPUDebug, + MaxLLVMThreads, // Graphics Renderer, @@ -143,7 +144,7 @@ public: ~emu_settings(); /** Connects a combo box with the target settings type*/ - void EnhanceComboBox(QComboBox* combobox, SettingsType type, bool is_ranged = false); + void EnhanceComboBox(QComboBox* combobox, SettingsType type, bool is_ranged = false, bool use_max = false, int max = 0); /** Connects a check box with the target settings type*/ void EnhanceCheckBox(QCheckBox* checkbox, SettingsType type); @@ -193,6 +194,7 @@ private: { PreferredSPUThreads, { "Core", "Preferred SPU Threads"}}, { PPUDebug, { "Core", "PPU Debug"}}, { SPUDebug, { "Core", "SPU Debug"}}, + { MaxLLVMThreads, { "Core", "Max LLVM Compile Threads"}}, // Graphics Tab { Renderer, { "Video", "Renderer"}}, diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index 5ad5b7c072..62d40baee1 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -22,6 +22,7 @@ #include "Crypto/unself.h" #include +#include inline std::string sstr(const QString& _in) { return _in.toStdString(); } inline std::string sstr(const QVariant& _in) { return sstr(_in.toString()); } @@ -692,6 +693,10 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: // Comboboxes + xemu_settings->EnhanceComboBox(ui->maxLLVMThreads, emu_settings::MaxLLVMThreads, true, true, std::thread::hardware_concurrency()); + SubscribeTooltip(ui->maxLLVMThreads, json_emu_misc["maxLLVMThreads"].toString()); + ui->maxLLVMThreads->setItemText(ui->maxLLVMThreads->findData("0"), tr("All (%1)").arg(std::thread::hardware_concurrency())); + SubscribeTooltip(ui->combo_configs, json_emu_gui["configs"].toString()); SubscribeTooltip(ui->combo_stylesheets, json_emu_gui["stylesheets"].toString()); @@ -727,7 +732,6 @@ settings_dialog::settings_dialog(std::shared_ptr guiSettings, std: if (game) { ui->gb_stylesheets->setEnabled(false); - ui->gb_configs->setEnabled(false); ui->gb_settings->setEnabled(false); ui->gb_colors->setEnabled(false); ui->gb_viewport->setEnabled(false); diff --git a/rpcs3/rpcs3qt/settings_dialog.ui b/rpcs3/rpcs3qt/settings_dialog.ui index 63bdb78730..0a6934abd5 100644 --- a/rpcs3/rpcs3qt/settings_dialog.ui +++ b/rpcs3/rpcs3qt/settings_dialog.ui @@ -6,8 +6,8 @@ 0 0 - 787 - 566 + 1011 + 775 @@ -1377,20 +1377,13 @@ - + - UI Configurations + Max LLVM Compile Threads - + - - - - - - Apply - - + @@ -1439,12 +1432,22 @@ - 0 + 20 0 + + + + + + + Apply + + +