Qt/Core: implement max llvm compile threads

This commit is contained in:
Megamouse 2018-01-24 17:38:38 +01:00 committed by Ivan
parent c8965564e4
commit b9c10a186d
7 changed files with 34 additions and 19 deletions

View File

@ -1161,7 +1161,9 @@ extern void ppu_initialize(const ppu_module& info)
static semaphore<> jmutex;
// Initialize semaphore with the max number of threads
semaphore<INT32_MAX> jcores(std::thread::hardware_concurrency());
u32 max_threads = static_cast<u32>(g_cfg.core.llvm_threads);
s32 thread_count = max_threads > 0 ? std::min(max_threads, std::thread::hardware_concurrency()) : std::thread::hardware_concurrency();
semaphore<INT32_MAX> jcores(thread_count);
if (!jcores.get())
{

View File

@ -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 };

View File

@ -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)"
}
},

View File

@ -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)));
}

View File

@ -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"}},

View File

@ -22,6 +22,7 @@
#include "Crypto/unself.h"
#include <unordered_set>
#include <thread>
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<gui_settings> 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<gui_settings> 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);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>787</width>
<height>566</height>
<width>1011</width>
<height>775</height>
</rect>
</property>
<property name="sizePolicy">
@ -1377,20 +1377,13 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_58">
<item>
<widget class="QGroupBox" name="gb_configs">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>UI Configurations</string>
<string>Max LLVM Compile Threads</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_44">
<layout class="QVBoxLayout" name="verticalLayout_63">
<item>
<widget class="QComboBox" name="combo_configs"/>
</item>
<item>
<widget class="QPushButton" name="pb_apply_config">
<property name="text">
<string>Apply</string>
</property>
</widget>
<widget class="QComboBox" name="maxLLVMThreads"/>
</item>
</layout>
</widget>
@ -1439,12 +1432,22 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="combo_configs"/>
</item>
<item>
<widget class="QPushButton" name="pb_apply_config">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>