diff --git a/rpcsx/core/include/rx/Config.hpp b/rpcsx/core/include/rx/Config.hpp index 4572cb5b6..031b3fed1 100644 --- a/rpcsx/core/include/rx/Config.hpp +++ b/rpcsx/core/include/rx/Config.hpp @@ -5,6 +5,8 @@ namespace rx { struct Config { int gpuIndex = 0; bool validateGpu = false; + bool disableGpuCache = false; + bool debugGpu = false; }; extern Config g_config; diff --git a/rpcsx/core/src/watchdog.cpp b/rpcsx/core/src/watchdog.cpp index d926e0aeb..0e2a057e7 100644 --- a/rpcsx/core/src/watchdog.cpp +++ b/rpcsx/core/src/watchdog.cpp @@ -1,6 +1,7 @@ #include "rx/watchdog.hpp" #include "gpu/DeviceCtl.hpp" #include "orbis/KernelContext.hpp" +#include "rx/Config.hpp" #include #include #include @@ -18,8 +19,6 @@ #include #include -static constexpr bool kDebugGpu = false; - static std::atomic g_exitRequested; static std::atomic g_runGpuRequested; static pid_t g_watchdogPid; @@ -39,7 +38,7 @@ static void runGPU() { auto childPid = ::fork(); - if (kDebugGpu) { + if (rx::g_config.debugGpu) { if (childPid == 0) { return; } @@ -113,7 +112,7 @@ std::filesystem::path rx::getShmGuestPath(std::string_view path) { } void rx::createGpuDevice() { - if (kDebugGpu) { + if (rx::g_config.debugGpu) { runGPU(); } else { sendMessage(MessageId::RunGPU, 0); @@ -166,7 +165,7 @@ void rx::startWatchdog() { pid_t initProcessPid = fork(); - if (kDebugGpu) { + if (rx::g_config.debugGpu) { if (initProcessPid == 0) { initProcessPid = watchdogPid; } else { diff --git a/rpcsx/gpu/Cache.cpp b/rpcsx/gpu/Cache.cpp index 69ae65231..09bf3ee60 100644 --- a/rpcsx/gpu/Cache.cpp +++ b/rpcsx/gpu/Cache.cpp @@ -2,6 +2,7 @@ #include "Device.hpp" #include "amdgpu/tiler.hpp" #include "gnm/vulkan.hpp" +#include "rx/Config.hpp" #include "rx/hexdump.hpp" #include "rx/mem.hpp" #include "shader/Evaluator.hpp" @@ -24,8 +25,6 @@ using namespace amdgpu; using namespace shader; -static constexpr bool kDisableCache = false; - static bool testHostInvalidations(Device *device, int vmId, std::uint64_t address, std::uint64_t size) { auto firstPage = address / rx::mem::pageSize; @@ -703,7 +702,7 @@ struct CachedHostVisibleBuffer : CachedBuffer { using CachedBuffer::update; bool expensive() { - return !kDisableCache && addressRange.size() >= rx::mem::pageSize; + return !rx::g_config.disableGpuCache && addressRange.size() >= rx::mem::pageSize; } bool flush(void *target, rx::AddressRange range) { @@ -779,7 +778,7 @@ struct CachedImageBuffer : Cache::Entry { unsigned depth = 1; bool expensive() { - if (kDisableCache) { + if (rx::g_config.disableGpuCache) { return false; } @@ -954,7 +953,7 @@ struct CachedImage : Cache::Entry { bool expensive() { return false; - if (kDisableCache) { + if (rx::g_config.disableGpuCache) { return false; } diff --git a/rpcsx/main.cpp b/rpcsx/main.cpp index 87c582a16..20373a46f 100644 --- a/rpcsx/main.cpp +++ b/rpcsx/main.cpp @@ -688,6 +688,7 @@ static void usage(const char *argv0) { std::println(" --fw "); std::println( " --gpu - specify physical gpu index to use, default is 0"); + std::println(" --disable-cache - disable cache of gpu resources"); // std::println(" --presenter "); std::println(" --trace"); } @@ -912,6 +913,18 @@ int main(int argc, const char *argv[]) { continue; } + if (argv[argIndex] == std::string_view("--disable-cache")) { + argIndex++; + rx::g_config.disableGpuCache = true; + continue; + } + + if (argv[argIndex] == std::string_view("--debug-gpu")) { + argIndex++; + rx::g_config.debugGpu = true; + continue; + } + if (argv[argIndex] == std::string_view("--gpu")) { if (argc <= argIndex + 1) { usage(argv[0]);