mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-16 03:38:38 +12:00
[Linux] Implement Feral Interactive's Gamemode for Potential Performance Increases (#17325)
Some checks failed
Generate Translation Template / Generate Translation Template (push) Failing after 55s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Failing after 1s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Failing after 1s
Build RPCS3 / RPCS3 FreeBSD (push) Failing after 0s
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
Build RPCS3 / RPCS3 Windows Clang (push) Has been cancelled
Some checks failed
Generate Translation Template / Generate Translation Template (push) Failing after 55s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Failing after 1s
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Failing after 1s
Build RPCS3 / RPCS3 FreeBSD (push) Failing after 0s
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm gcc (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Intel (push) Has been cancelled
Build RPCS3 / RPCS3 Mac Apple Silicon (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
Build RPCS3 / RPCS3 Windows Clang (push) Has been cancelled
Currently, this is a draft PR to implement Feral Interactive's Gamemode into RPCS3, which can improve game performance on certain Linux systems. At the moment, I am running into various compiler warnings when trying to include "gamemode_client.h" due to the file not using strict typings and old C-style casts. I know I can disable these flags during RPCS3's compilation but I wanted to check with the maintainers before going forward and if this feature should be implemented. It should be noted that RPCS3 only fails to compile and run if I include Feral's header file, but everything else compiles if I comment out the include. Targets Issue #11299
This commit is contained in:
parent
46150322a3
commit
ef566186be
17 changed files with 102 additions and 1 deletions
4
.gitmodules
vendored
4
.gitmodules
vendored
|
@ -108,3 +108,7 @@
|
||||||
path = 3rdparty/GPUOpen/VulkanMemoryAllocator
|
path = 3rdparty/GPUOpen/VulkanMemoryAllocator
|
||||||
url = ../../GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
|
url = ../../GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
|
||||||
ignore = dirty
|
ignore = dirty
|
||||||
|
[submodule "3rdparty/feralinteractive/feralinteractive"]
|
||||||
|
path = 3rdparty/feralinteractive/feralinteractive
|
||||||
|
url = ../../FeralInteractive/gamemode.git
|
||||||
|
ignore = dirty
|
||||||
|
|
4
3rdparty/CMakeLists.txt
vendored
4
3rdparty/CMakeLists.txt
vendored
|
@ -357,6 +357,9 @@ add_subdirectory(opencv EXCLUDE_FROM_ALL)
|
||||||
# FUSION
|
# FUSION
|
||||||
add_subdirectory(fusion EXCLUDE_FROM_ALL)
|
add_subdirectory(fusion EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
|
# FERAL INTERACTIVE
|
||||||
|
add_subdirectory(feralinteractive EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
# add nice ALIAS targets for ease of use
|
# add nice ALIAS targets for ease of use
|
||||||
if(USE_SYSTEM_LIBUSB)
|
if(USE_SYSTEM_LIBUSB)
|
||||||
add_library(3rdparty::libusb ALIAS usb-1.0-shared)
|
add_library(3rdparty::libusb ALIAS usb-1.0-shared)
|
||||||
|
@ -389,3 +392,4 @@ add_library(3rdparty::miniupnpc ALIAS libminiupnpc-static)
|
||||||
add_library(3rdparty::rtmidi ALIAS rtmidi)
|
add_library(3rdparty::rtmidi ALIAS rtmidi)
|
||||||
add_library(3rdparty::opencv ALIAS ${OPENCV_TARGET})
|
add_library(3rdparty::opencv ALIAS ${OPENCV_TARGET})
|
||||||
add_library(3rdparty::fusion ALIAS Fusion)
|
add_library(3rdparty::fusion ALIAS Fusion)
|
||||||
|
add_library(3rdparty::feralinteractive ALIAS 3rdparty_feralinteractive)
|
||||||
|
|
9
3rdparty/feralinteractive/CMakeLists.txt
vendored
Normal file
9
3rdparty/feralinteractive/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Feral Interactive
|
||||||
|
|
||||||
|
add_library(3rdparty_feralinteractive INTERFACE)
|
||||||
|
|
||||||
|
if (CMAKE_SYSTEM MATCHES "Linux")
|
||||||
|
target_include_directories(3rdparty_feralinteractive INTERFACE feralinteractive/lib)
|
||||||
|
target_compile_definitions(3rdparty_feralinteractive INTERFACE -DGAMEMODE_AVAILABLE)
|
||||||
|
target_link_libraries(3rdparty_feralinteractive INTERFACE feralinteractive)
|
||||||
|
endif()
|
1
3rdparty/feralinteractive/feralinteractive
vendored
Submodule
1
3rdparty/feralinteractive/feralinteractive
vendored
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit c54d6d4243b0dd0afcb49f2c9836d432da171a2b
|
|
@ -152,6 +152,15 @@ if(NOT WIN32)
|
||||||
add_compile_options(-pthread)
|
add_compile_options(-pthread)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
## Look for Gamemode if its installed on Linux
|
||||||
|
if(LINUX)
|
||||||
|
find_program(GAMEMODE_FOUND gamemoded) ## Only works if gamemode is installed on system (might include lib32 case)
|
||||||
|
if(GAMEMODE_FOUND)
|
||||||
|
add_compile_definitions(GAMEMODE_AVAILABLE)
|
||||||
|
endif()
|
||||||
|
message(GAMEMODE_AVAILABLE="${GAMEMODE_AVAILABLE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# TODO: do real installation, including copying directory structure
|
# TODO: do real installation, including copying directory structure
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/bin")
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/bin")
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/bin")
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/bin")
|
||||||
|
|
|
@ -2477,6 +2477,11 @@ void Emulator::Run(bool start_playtime)
|
||||||
{
|
{
|
||||||
Emu.GetCallbacks().enable_display_sleep(false);
|
Emu.GetCallbacks().enable_display_sleep(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_cfg.misc.enable_gamemode)
|
||||||
|
{
|
||||||
|
Emu.GetCallbacks().enable_gamemode(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Emulator::RunPPU()
|
void Emulator::RunPPU()
|
||||||
|
@ -3237,6 +3242,12 @@ void Emulator::Kill(bool allow_autoexit, bool savestate, savestate_stage* save_s
|
||||||
|
|
||||||
sys_log.notice("Stopping emulator...");
|
sys_log.notice("Stopping emulator...");
|
||||||
|
|
||||||
|
// Calling Gamemode Exit on Stop
|
||||||
|
if (g_cfg.misc.enable_gamemode)
|
||||||
|
{
|
||||||
|
Emu.GetCallbacks().enable_gamemode(false);
|
||||||
|
}
|
||||||
|
|
||||||
const bool continuous_savestate_mode = savestate && !g_cfg.savestate.suspend_emu;
|
const bool continuous_savestate_mode = savestate && !g_cfg.savestate.suspend_emu;
|
||||||
|
|
||||||
// Show visual feedback to the user in case that stopping takes a while.
|
// Show visual feedback to the user in case that stopping takes a while.
|
||||||
|
|
|
@ -112,6 +112,7 @@ struct EmuCallbacks
|
||||||
std::function<void(bool)> enable_display_sleep;
|
std::function<void(bool)> enable_display_sleep;
|
||||||
std::function<void()> check_microphone_permissions;
|
std::function<void()> check_microphone_permissions;
|
||||||
std::function<std::unique_ptr<class video_source>()> make_video_source;
|
std::function<std::unique_ptr<class video_source>()> make_video_source;
|
||||||
|
std::function<void(bool)> enable_gamemode;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace utils
|
namespace utils
|
||||||
|
|
|
@ -358,6 +358,7 @@ struct cfg_root : cfg::node
|
||||||
cfg::_bool silence_all_logs{ this, "Silence All Logs", false, true };
|
cfg::_bool silence_all_logs{ this, "Silence All Logs", false, true };
|
||||||
cfg::string title_format{ this, "Window Title Format", "FPS: %F | %R | %V | %T [%t]", true };
|
cfg::string title_format{ this, "Window Title Format", "FPS: %F | %R | %V | %T [%t]", true };
|
||||||
cfg::_bool pause_during_home_menu{this, "Pause Emulation During Home Menu", false, false };
|
cfg::_bool pause_during_home_menu{this, "Pause Emulation During Home Menu", false, false };
|
||||||
|
cfg::_bool enable_gamemode{ this, "Enable GameMode", false, false };
|
||||||
|
|
||||||
} misc{ this };
|
} misc{ this };
|
||||||
|
|
||||||
|
|
24
rpcs3/gamemode_control.cpp
Normal file
24
rpcs3/gamemode_control.cpp
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#include "gamemode_control.h"
|
||||||
|
|
||||||
|
#ifdef GAMEMODE_AVAILABLE
|
||||||
|
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||||
|
extern "C" {
|
||||||
|
#include "3rdparty/feralinteractive/feralinteractive/lib/gamemode_client.h"
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Enables and Disables GameMode based on user settings and system
|
||||||
|
void enable_gamemode([[maybe_unused]] bool enabled)
|
||||||
|
{
|
||||||
|
#if defined(GAMEMODE_AVAILABLE)
|
||||||
|
// Enable and Disable Gamemode
|
||||||
|
if (enabled)
|
||||||
|
{
|
||||||
|
gamemode_request_start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gamemode_request_end();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
3
rpcs3/gamemode_control.h
Normal file
3
rpcs3/gamemode_control.h
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
void enable_gamemode(bool enabled);
|
|
@ -1,6 +1,7 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "main_application.h"
|
#include "main_application.h"
|
||||||
#include "display_sleep_control.h"
|
#include "display_sleep_control.h"
|
||||||
|
#include "gamemode_control.h"
|
||||||
|
|
||||||
#include "util/types.hpp"
|
#include "util/types.hpp"
|
||||||
#include "util/logs.hpp"
|
#include "util/logs.hpp"
|
||||||
|
@ -374,5 +375,7 @@ EmuCallbacks main_application::CreateCallbacks()
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
callbacks.enable_gamemode = [](bool enabled){ enable_gamemode(enabled); };
|
||||||
|
|
||||||
return callbacks;
|
return callbacks;
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,6 +189,7 @@
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="display_sleep_control.cpp" />
|
<ClCompile Include="display_sleep_control.cpp" />
|
||||||
|
<ClCompile Include="gamemode_control.cpp" />
|
||||||
<ClCompile Include="Input\dualsense_pad_handler.cpp" />
|
<ClCompile Include="Input\dualsense_pad_handler.cpp" />
|
||||||
<ClCompile Include="Input\gui_pad_thread.cpp" />
|
<ClCompile Include="Input\gui_pad_thread.cpp" />
|
||||||
<ClCompile Include="Input\hid_pad_handler.cpp" />
|
<ClCompile Include="Input\hid_pad_handler.cpp" />
|
||||||
|
@ -921,6 +922,7 @@
|
||||||
<ClInclude Include="Input\basic_keyboard_handler.h" />
|
<ClInclude Include="Input\basic_keyboard_handler.h" />
|
||||||
<ClInclude Include="Input\basic_mouse_handler.h" />
|
<ClInclude Include="Input\basic_mouse_handler.h" />
|
||||||
<ClInclude Include="display_sleep_control.h" />
|
<ClInclude Include="display_sleep_control.h" />
|
||||||
|
<ClInclude Include="gamemode_control.h" />
|
||||||
<ClInclude Include="Input\ds3_pad_handler.h" />
|
<ClInclude Include="Input\ds3_pad_handler.h" />
|
||||||
<ClInclude Include="Input\ds4_pad_handler.h" />
|
<ClInclude Include="Input\ds4_pad_handler.h" />
|
||||||
<ClInclude Include="Input\dualsense_pad_handler.h" />
|
<ClInclude Include="Input\dualsense_pad_handler.h" />
|
||||||
|
|
|
@ -133,6 +133,7 @@ add_library(rpcs3_ui STATIC
|
||||||
welcome_dialog.ui
|
welcome_dialog.ui
|
||||||
|
|
||||||
../display_sleep_control.cpp
|
../display_sleep_control.cpp
|
||||||
|
../gamemode_control.cpp
|
||||||
../headless_application.cpp
|
../headless_application.cpp
|
||||||
../main_application.cpp
|
../main_application.cpp
|
||||||
../module_verifier.cpp
|
../module_verifier.cpp
|
||||||
|
|
|
@ -186,6 +186,7 @@ enum class emu_settings_type
|
||||||
ShowMouseAndKeyboardToggleHint,
|
ShowMouseAndKeyboardToggleHint,
|
||||||
WindowTitleFormat,
|
WindowTitleFormat,
|
||||||
PauseDuringHomeMenu,
|
PauseDuringHomeMenu,
|
||||||
|
EnableGamemode,
|
||||||
|
|
||||||
// Network
|
// Network
|
||||||
InternetStatus,
|
InternetStatus,
|
||||||
|
@ -388,6 +389,7 @@ inline static const std::map<emu_settings_type, cfg_location> settings_location
|
||||||
{ emu_settings_type::SilenceAllLogs, { "Miscellaneous", "Silence All Logs" }},
|
{ emu_settings_type::SilenceAllLogs, { "Miscellaneous", "Silence All Logs" }},
|
||||||
{ emu_settings_type::WindowTitleFormat, { "Miscellaneous", "Window Title Format" }},
|
{ emu_settings_type::WindowTitleFormat, { "Miscellaneous", "Window Title Format" }},
|
||||||
{ emu_settings_type::PauseDuringHomeMenu, { "Miscellaneous", "Pause Emulation During Home Menu" }},
|
{ emu_settings_type::PauseDuringHomeMenu, { "Miscellaneous", "Pause Emulation During Home Menu" }},
|
||||||
|
{ emu_settings_type::EnableGamemode, { "Miscellaneous", "Enable GameMode" }},
|
||||||
|
|
||||||
// Networking
|
// Networking
|
||||||
{ emu_settings_type::InternetStatus, { "Net", "Internet enabled"}},
|
{ emu_settings_type::InternetStatus, { "Net", "Internet enabled"}},
|
||||||
|
|
|
@ -1844,6 +1844,17 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||||
m_emu_settings->EnhanceCheckBox(ui->useNativeInterface, emu_settings_type::UseNativeInterface);
|
m_emu_settings->EnhanceCheckBox(ui->useNativeInterface, emu_settings_type::UseNativeInterface);
|
||||||
SubscribeTooltip(ui->useNativeInterface, tooltips.settings.use_native_interface);
|
SubscribeTooltip(ui->useNativeInterface, tooltips.settings.use_native_interface);
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
ui->enableGamemode->setVisible(true);
|
||||||
|
#endif
|
||||||
|
#if defined(GAMEMODE_AVAILABLE)
|
||||||
|
ui->enableGamemode->setEnabled(true);
|
||||||
|
m_emu_settings->EnhanceCheckBox(ui->enableGamemode, emu_settings_type::EnableGamemode);
|
||||||
|
SubscribeTooltip(ui->enableGamemode, tooltips.settings.enable_gamemode);
|
||||||
|
#else
|
||||||
|
SubscribeTooltip(ui->enableGamemode, tooltips.settings.no_gamemode);
|
||||||
|
#endif
|
||||||
|
|
||||||
m_emu_settings->EnhanceCheckBox(ui->showShaderCompilationHint, emu_settings_type::ShowShaderCompilationHint);
|
m_emu_settings->EnhanceCheckBox(ui->showShaderCompilationHint, emu_settings_type::ShowShaderCompilationHint);
|
||||||
SubscribeTooltip(ui->showShaderCompilationHint, tooltips.settings.show_shader_compilation_hint);
|
SubscribeTooltip(ui->showShaderCompilationHint, tooltips.settings.show_shader_compilation_hint);
|
||||||
|
|
||||||
|
|
|
@ -3022,6 +3022,19 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="enableGamemode">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="visible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable GameMode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="emulatorTabSpacerLeft">
|
<spacer name="emulatorTabSpacerLeft">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -129,6 +129,8 @@ public:
|
||||||
|
|
||||||
// emulator
|
// emulator
|
||||||
|
|
||||||
|
const QString enable_gamemode = tr("Activate Feral Interactive's GameMode.\nThis is a series of CPU and GPU optimizations and can potentially benefit game performance on some systems.");
|
||||||
|
const QString no_gamemode = tr("This requires Feral Interactive's GameMode to be installed.\nGameMode is a series of CPU and GPU optimizations and can potentially benefit game performance on some systems.\nTo install GameMode for your specific Linux distribution, go to the GitHub page:https://github.com/FeralInteractive/gamemode.");
|
||||||
const QString exit_on_stop = tr("Automatically close RPCS3 when closing a game, or when a game closes itself.");
|
const QString exit_on_stop = tr("Automatically close RPCS3 when closing a game, or when a game closes itself.");
|
||||||
const QString pause_on_focus_loss = tr("Automatically pause emulation when RPCS3 loses its focus or the application is inactive in order to save power and reduce CPU usage.\nDo note that emulation pausing in general is not perfect and may not be compatible with all games.\nAlthough it currently also pauses gameplay, it is not recommended to rely on it as this behavior may be changed in the future and it is not the purpose of this setting.");
|
const QString pause_on_focus_loss = tr("Automatically pause emulation when RPCS3 loses its focus or the application is inactive in order to save power and reduce CPU usage.\nDo note that emulation pausing in general is not perfect and may not be compatible with all games.\nAlthough it currently also pauses gameplay, it is not recommended to rely on it as this behavior may be changed in the future and it is not the purpose of this setting.");
|
||||||
const QString start_game_fullscreen = tr("Automatically puts the game window in fullscreen.\nDouble click on the game window or press Alt+Enter to toggle fullscreen and windowed mode.");
|
const QString start_game_fullscreen = tr("Automatically puts the game window in fullscreen.\nDouble click on the game window or press Alt+Enter to toggle fullscreen and windowed mode.");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue