mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 21:41:26 +12:00
implement "Enable TSX" combobox
This commit is contained in:
parent
2bc4cb4e58
commit
af71cf0922
8 changed files with 98 additions and 6 deletions
|
@ -33,8 +33,13 @@ bool utils::has_avx2()
|
||||||
|
|
||||||
bool utils::has_rtm()
|
bool utils::has_rtm()
|
||||||
{
|
{
|
||||||
// Check RTM and MPX extensions in order to filter out TSX on Haswell CPUs
|
static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(7, 0)[1] & 0x800) == 0x800;
|
||||||
static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(7, 0)[1] & 0x4800) == 0x4800;
|
return g_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool utils::has_mpx()
|
||||||
|
{
|
||||||
|
static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(7, 0)[1] & 0x4000) == 0x4000;
|
||||||
return g_value;
|
return g_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +119,10 @@ std::string utils::get_system_info()
|
||||||
if (has_rtm())
|
if (has_rtm())
|
||||||
{
|
{
|
||||||
result += " | TSX";
|
result += " | TSX";
|
||||||
|
if (!has_mpx())
|
||||||
|
{
|
||||||
|
result += " disabled by default";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -37,6 +37,8 @@ namespace utils
|
||||||
|
|
||||||
bool has_rtm();
|
bool has_rtm();
|
||||||
|
|
||||||
|
bool has_mpx();
|
||||||
|
|
||||||
bool has_512();
|
bool has_512();
|
||||||
|
|
||||||
bool has_xop();
|
bool has_xop();
|
||||||
|
|
|
@ -38,13 +38,15 @@
|
||||||
|
|
||||||
#include "Utilities/GDBDebugServer.h"
|
#include "Utilities/GDBDebugServer.h"
|
||||||
|
|
||||||
|
#include "Utilities/sysinfo.h"
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(HAVE_VULKAN)
|
#if defined(_WIN32) || defined(HAVE_VULKAN)
|
||||||
#include "Emu/RSX/VK/VulkanAPI.h"
|
#include "Emu/RSX/VK/VulkanAPI.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cfg_root g_cfg;
|
cfg_root g_cfg;
|
||||||
|
|
||||||
bool g_use_rtm = utils::has_rtm();
|
bool g_use_rtm;
|
||||||
|
|
||||||
std::string g_cfg_defaults;
|
std::string g_cfg_defaults;
|
||||||
|
|
||||||
|
@ -222,6 +224,22 @@ inline void fmt_class_string<detail_level>::format(std::string& out, u64 arg)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void fmt_class_string<tsx_usage>::format(std::string& out, u64 arg)
|
||||||
|
{
|
||||||
|
format_enum(out, arg, [](tsx_usage value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case tsx_usage::disabled: return "Disabled";
|
||||||
|
case tsx_usage::enabled: return "Enabled";
|
||||||
|
case tsx_usage::forced: return "Forced";
|
||||||
|
}
|
||||||
|
|
||||||
|
return unknown;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void Emulator::Init()
|
void Emulator::Init()
|
||||||
{
|
{
|
||||||
if (!g_tty)
|
if (!g_tty)
|
||||||
|
@ -627,6 +645,13 @@ void Emulator::Load(bool add_only)
|
||||||
|
|
||||||
LOG_NOTICE(LOADER, "Used configuration:\n%s\n", g_cfg.to_string());
|
LOG_NOTICE(LOADER, "Used configuration:\n%s\n", g_cfg.to_string());
|
||||||
|
|
||||||
|
// Set RTM usage
|
||||||
|
g_use_rtm = utils::has_rtm() && ((utils::has_mpx() && g_cfg.core.enable_TSX == tsx_usage::enabled) || g_cfg.core.enable_TSX == tsx_usage::forced);
|
||||||
|
if (g_use_rtm && !utils::has_mpx())
|
||||||
|
{
|
||||||
|
LOG_WARNING(GENERAL, "TSX forced by User");
|
||||||
|
}
|
||||||
|
|
||||||
// Load patches from different locations
|
// Load patches from different locations
|
||||||
fxm::check_unlocked<patch_engine>()->append(fs::get_config_dir() + "data/" + m_title_id + "/patch.yml");
|
fxm::check_unlocked<patch_engine>()->append(fs::get_config_dir() + "data/" + m_title_id + "/patch.yml");
|
||||||
fxm::check_unlocked<patch_engine>()->append(m_cache_path + "/patch.yml");
|
fxm::check_unlocked<patch_engine>()->append(m_cache_path + "/patch.yml");
|
||||||
|
|
|
@ -155,6 +155,13 @@ enum class detail_level
|
||||||
high,
|
high,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class tsx_usage
|
||||||
|
{
|
||||||
|
disabled,
|
||||||
|
enabled,
|
||||||
|
forced,
|
||||||
|
};
|
||||||
|
|
||||||
enum CellNetCtlState : s32;
|
enum CellNetCtlState : s32;
|
||||||
enum CellSysutilLang : s32;
|
enum CellSysutilLang : s32;
|
||||||
|
|
||||||
|
@ -326,6 +333,7 @@ struct cfg_root : cfg::node
|
||||||
cfg::_bool spu_accurate_putlluc{this, "Accurate PUTLLUC", false};
|
cfg::_bool spu_accurate_putlluc{this, "Accurate PUTLLUC", false};
|
||||||
cfg::_bool spu_verification{this, "SPU Verification", true}; // Should be enabled
|
cfg::_bool spu_verification{this, "SPU Verification", true}; // Should be enabled
|
||||||
cfg::_bool spu_cache{this, "SPU Cache", true};
|
cfg::_bool spu_cache{this, "SPU Cache", true};
|
||||||
|
cfg::_enum<tsx_usage> enable_TSX{this, "Enable TSX", tsx_usage::enabled}; // Enable TSX. Forcing this on Haswell/Broadwell CPUs should be used carefully
|
||||||
|
|
||||||
cfg::_enum<lib_loading_type> lib_loading{this, "Lib Loader", lib_loading_type::liblv2only};
|
cfg::_enum<lib_loading_type> lib_loading{this, "Lib Loader", lib_loading_type::liblv2only};
|
||||||
cfg::_bool hook_functions{this, "Hook static functions"};
|
cfg::_bool hook_functions{this, "Hook static functions"};
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
"debug": {
|
"debug": {
|
||||||
"ppuDebug": "Never use this.",
|
"ppuDebug": "Never use this.",
|
||||||
"spuDebug": "Never use this.",
|
"spuDebug": "Never use this.",
|
||||||
|
"enableTSX": "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.",
|
||||||
"readColor": "Never use this.",
|
"readColor": "Never use this.",
|
||||||
"dumpDepth": "Never use this.",
|
"dumpDepth": "Never use this.",
|
||||||
"readDepth": "Never use this.",
|
"readDepth": "Never use this.",
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
PPUDebug,
|
PPUDebug,
|
||||||
SPUDebug,
|
SPUDebug,
|
||||||
MaxLLVMThreads,
|
MaxLLVMThreads,
|
||||||
|
EnableTSX,
|
||||||
|
|
||||||
// Graphics
|
// Graphics
|
||||||
Renderer,
|
Renderer,
|
||||||
|
@ -205,6 +206,7 @@ private:
|
||||||
{ PPUDebug, { "Core", "PPU Debug"}},
|
{ PPUDebug, { "Core", "PPU Debug"}},
|
||||||
{ SPUDebug, { "Core", "SPU Debug"}},
|
{ SPUDebug, { "Core", "SPU Debug"}},
|
||||||
{ MaxLLVMThreads, { "Core", "Max LLVM Compile Threads"}},
|
{ MaxLLVMThreads, { "Core", "Max LLVM Compile Threads"}},
|
||||||
|
{ EnableTSX, { "Core", "Enable TSX"}},
|
||||||
|
|
||||||
// Graphics Tab
|
// Graphics Tab
|
||||||
{ Renderer, { "Video", "Renderer"}},
|
{ Renderer, { "Video", "Renderer"}},
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
#include "Crypto/unself.h"
|
#include "Crypto/unself.h"
|
||||||
|
#include "Utilities/sysinfo.h"
|
||||||
|
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
@ -1080,6 +1081,40 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
||||||
xemu_settings->EnhanceCheckBox(ui->spuDebug, emu_settings::SPUDebug);
|
xemu_settings->EnhanceCheckBox(ui->spuDebug, emu_settings::SPUDebug);
|
||||||
SubscribeTooltip(ui->spuDebug, json_debug["spuDebug"].toString());
|
SubscribeTooltip(ui->spuDebug, json_debug["spuDebug"].toString());
|
||||||
|
|
||||||
|
if (utils::has_rtm())
|
||||||
|
{
|
||||||
|
xemu_settings->EnhanceComboBox(ui->enableTSX, emu_settings::EnableTSX);
|
||||||
|
SubscribeTooltip(ui->enableTSX, json_debug["enableTSX"].toString());
|
||||||
|
|
||||||
|
static const QString tsx_forced = qstr(fmt::format("%s", tsx_usage::forced));
|
||||||
|
static const QString tsx_default = qstr(xemu_settings->GetSettingDefault(emu_settings::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 (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))
|
||||||
|
{
|
||||||
|
// Reset if the messagebox was answered with no. This prevents the currentIndexChanged signal in EnhanceComboBox
|
||||||
|
ui->enableTSX->setCurrentText(tsx_default);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->label_enableTSX->setHidden(true);
|
||||||
|
ui->enableTSX->setHidden(true);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Layout fix for High Dpi
|
// Layout fix for High Dpi
|
||||||
//
|
//
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>752</width>
|
<width>849</width>
|
||||||
<height>519</height>
|
<height>615</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>7</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="coreTab">
|
<widget class="QWidget" name="coreTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -1969,6 +1969,16 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_enableTSX">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable TSX:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="enableTSX"/>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue