1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

Qt: Consider TSX-FA in settings dialog

This commit is contained in:
Megamouse 2021-11-04 20:01:01 +01:00
parent c3888f5bbb
commit 067b35217a
4 changed files with 63 additions and 19 deletions

View File

@ -350,7 +350,10 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, emu_settings_type type,
for (int i = 0; i < combobox->count(); i++)
{
const QVariantList var_list = combobox->itemData(i).toList();
ensure(var_list.size() == 2 && var_list[0].canConvert<QString>());
if (var_list.size() != 2 || !var_list[0].canConvert<QString>())
{
fmt::throw_exception("Invalid data found in combobox entry %d (text='%s', listsize=%d, itemcount=%d)", i, sstr(combobox->itemText(i)), var_list.size(), combobox->count());
}
if (value == var_list[0].toString())
{
@ -394,6 +397,8 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, emu_settings_type type,
connect(combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), combobox, [this, is_ranged, combobox, type](int index)
{
if (index < 0) return;
if (is_ranged)
{
SetSetting(type, sstr(combobox->itemData(index)));
@ -401,7 +406,10 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, emu_settings_type type,
else
{
const QVariantList var_list = combobox->itemData(index).toList();
ensure(var_list.size() == 2 && var_list[0].canConvert<QString>());
if (var_list.size() != 2 || !var_list[0].canConvert<QString>())
{
fmt::throw_exception("Invalid data found in combobox entry %d (text='%s', listsize=%d, itemcount=%d)", index, sstr(combobox->itemText(index)), var_list.size(), combobox->count());
}
SetSetting(type, sstr(var_list[0]));
}
});

View File

@ -130,6 +130,8 @@ memory_string_searcher::memory_string_searcher(QWidget* parent, std::shared_ptr<
connect(m_cbox_input_mode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this](int index)
{
if (index < 0) return;
if ((1 << index) == no_mode)
{
m_modes = {};

View File

@ -244,26 +244,57 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
m_emu_settings->EnhanceComboBox(ui->enableTSX, emu_settings_type::EnableTSX);
SubscribeTooltip(ui->gb_tsx, tooltips.settings.enable_tsx);
static const QString tsx_enabled = qstr(fmt::format("%s", tsx_usage::enabled));
static const QString tsx_forced = qstr(fmt::format("%s", tsx_usage::forced));
static const QString tsx_default = qstr(m_emu_settings->GetSettingDefault(emu_settings_type::EnableTSX));
// connect the toogled signal so that the stateChanged signal in EnhanceCheckBox can be prevented
connect(ui->enableTSX, &QComboBox::currentTextChanged, [this](const QString& text)
if (!utils::has_mpx() || utils::has_tsx_force_abort())
{
if (text == tsx_forced && !utils::has_mpx() && QMessageBox::No == QMessageBox::critical(this, tr("Haswell/Broadwell TSX Warning"), tr(
R"(
<p style="white-space: nowrap;">
RPCS3 has detected you are using TSX functions on a Haswell or Broadwell CPU.<br>
Intel has deactivated these functions in newer Microcode revisions, since they can lead to unpredicted behaviour.<br>
That means using TSX may break games or even <font color="red"><b>damage</b></font> your data.<br>
We recommend to disable this feature and update your computer BIOS.<br><br>
Do you wish to use TSX anyway?
</p>
)"
), QMessageBox::Yes, QMessageBox::No))
ui->enableTSX->removeItem(ui->enableTSX->findText(m_emu_settings->GetLocalizedSetting(tsx_enabled, emu_settings_type::EnableTSX, static_cast<int>(tsx_usage::enabled))));
ui->enableTSX->setCurrentIndex(ui->enableTSX->findText(m_emu_settings->GetLocalizedSetting(tsx_default, emu_settings_type::EnableTSX, static_cast<int>(g_cfg.core.enable_TSX.def))));
}
// connect the toogled signal so that the stateChanged signal in EnhanceCheckBox can be prevented
connect(ui->enableTSX, &QComboBox::currentTextChanged, this, [this](const QString& text)
{
if (text == m_emu_settings->GetLocalizedSetting(tsx_forced, emu_settings_type::EnableTSX, static_cast<int>(tsx_usage::forced)) &&
(!utils::has_mpx() || utils::has_tsx_force_abort()))
{
// Reset if the messagebox was answered with no. This prevents the currentIndexChanged signal in EnhanceComboBox
ui->enableTSX->setCurrentText(tsx_default);
QString title;
QString message;
if (!utils::has_mpx())
{
title = tr("Haswell/Broadwell TSX Warning");
message = tr(
R"(
<p style="white-space: nowrap;">
RPCS3 has detected that you are using TSX functions on a Haswell or Broadwell CPU.<br>
Intel has deactivated these functions in newer Microcode revisions, since they can lead to unpredicted behaviour.<br>
That means using TSX may break games or even <font color="red"><b>damage</b></font> your data.<br>
We recommend to disable this feature and update your computer BIOS.<br><br>
Do you wish to use TSX anyway?
</p>
)");
}
else
{
title = tr("TSX-FA Warning");
message = tr(
R"(
<p style="white-space: nowrap;">
RPCS3 has detected your CPU only supports TSX-FA.<br>
That means using TSX may break games or even <font color="red"><b>damage</b></font> your data.<br>
We recommend to disable this feature.<br><br>
Do you wish to use TSX anyway?
</p>
)");
}
if (QMessageBox::No == QMessageBox::critical(this, title, message, QMessageBox::Yes, QMessageBox::No))
{
// Reset if the messagebox was answered with no. This prevents the currentIndexChanged signal in EnhanceComboBox
ui->enableTSX->setCurrentText(m_emu_settings->GetLocalizedSetting(tsx_default, emu_settings_type::EnableTSX, static_cast<int>(g_cfg.core.enable_TSX.def)));
}
}
});
}
@ -467,6 +498,8 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
connect(ui->zcullPrecisionMode, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index)
{
if (index < 0) return;
bool relaxed = false, precise = false;
switch (static_cast<zcull_precision_level>(ui->zcullPrecisionMode->itemData(index).toInt()))
@ -780,6 +813,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
const auto enable_buffering = [this, enable_buffering_options](int index)
{
if (index < 0) return;
const QVariantList var_list = ui->audioOutBox->itemData(index).toList();
ensure(var_list.size() == 2 && var_list[0].canConvert<QString>());
const QString text = var_list[0].toString();
@ -1727,7 +1761,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
ui->combo_updates->setCurrentIndex(ui->combo_updates->findData(m_gui_settings->GetValue(gui::m_check_upd_start).toString()));
connect(ui->combo_updates, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index)
{
m_gui_settings->SetValue(gui::m_check_upd_start, ui->combo_updates->itemData(index));
if (index >= 0) m_gui_settings->SetValue(gui::m_check_upd_start, ui->combo_updates->itemData(index));
});
const bool enable_ui_colors = m_gui_settings->GetValue(gui::m_enableUIColors).toBool();

View File

@ -66,7 +66,7 @@ public:
const QString accurate_xfloat = tr("Adds extra accuracy to SPU float vectors processing.\nFixes bugs in various games at the cost of performance.\nThis setting is only applied when SPU Decoder is set to Fast or LLVM.");
const QString enable_thread_scheduler = tr("Control how RPCS3 utilizes the threads of your system.\nEach option heavily depends on the game and on your CPU. It's recommended to try each option to find out which performs the best.\nChanging the thread scheduler is not supported on CPUs with less than 12 threads.");
const QString spu_loop_detection = tr("Try to detect loop conditions in SPU kernels and use them as scheduling hints.\nImproves performance and reduces CPU usage.\nMay cause severe audio stuttering in rare cases.");
const QString enable_tsx = tr("Enable usage of TSX instructions.\nNeeds to be forced on some Haswell or Broadwell CPUs.\nForcing this on older Hardware can lead to system instability, use it with caution.");
const QString enable_tsx = tr("Enable usage of TSX instructions.\nNeeds to be forced on some Haswell or Broadwell CPUs or CPUs with the TSX-FA instruction set.\nForcing TSX in these cases may lead to system and performance instability, use it with caution.");
const QString spu_block_size = tr("This option controls the SPU analyser, particularly the size of compiled units. The Mega and Giga modes may improve performance by tying smaller units together, decreasing the number of compiled units but increasing their size.\nUse the Safe mode for maximum compatibility.");
const QString preferred_spu_threads = tr("Some SPU stages are sensitive to race conditions and allowing a limited number at a time helps alleviate performance stalls.\nSetting this to a smaller value might improve performance and reduce stuttering in some games.\nLeave this on auto if performance is negatively affected when setting a small value.");
const QString full_width_avx512 = tr("Enables the use of code with full width AVX-512.\nThis code can be executed much faster, but may cause a loss in performance if your CPU model experiences downclocking on wide AVX-512 loads.\nNote that AVX-512 instructions will be used regardless of this option, just at 128 and 256 bit width.");