diff --git a/hw/amdgpu/bridge/include/amdgpu/bridge/bridge.hpp b/hw/amdgpu/bridge/include/amdgpu/bridge/bridge.hpp index f07c85e72..e1f9297c8 100644 --- a/hw/amdgpu/bridge/include/amdgpu/bridge/bridge.hpp +++ b/hw/amdgpu/bridge/include/amdgpu/bridge/bridge.hpp @@ -243,7 +243,7 @@ private: void sendCommand(CommandId id, std::initializer_list args) { std::uint64_t exp = 0; - while (!header->lock.compare_exchange_weak( + while (!header->lock.compare_exchange_strong( exp, 1, std::memory_order::acquire, std::memory_order::relaxed)) { exp = 0; } @@ -263,6 +263,8 @@ private: std::uint64_t position = header->push; if (position + cmdSize > header->size) { + waitPuller(position); + if (position < header->size) { header->commands[position] = static_cast(CommandId::Nop) | @@ -271,7 +273,6 @@ private: position = 0; header->push = position; - waitPuller(position); } return position; @@ -298,6 +299,12 @@ struct BridgePuller { } auto pos = header->pull; + + if (pos >= header->size) { + header->pull = 0; + continue; + } + auto cmd = header->commands[pos]; CommandId cmdId = static_cast(cmd); std::uint32_t argsCount = cmd >> 32; @@ -307,13 +314,7 @@ struct BridgePuller { unpackCommand(cmdId, header->commands + pos + 1, argsCount); } - auto newPull = pos + argsCount + 1; - - if (newPull >= header->size) { - newPull = 0; - } - - header->pull = newPull; + header->pull = pos + argsCount + 1; } return processed; diff --git a/hw/amdgpu/bridge/src/bridge.cpp b/hw/amdgpu/bridge/src/bridge.cpp index 51a190668..fbcd35c8a 100644 --- a/hw/amdgpu/bridge/src/bridge.cpp +++ b/hw/amdgpu/bridge/src/bridge.cpp @@ -36,7 +36,8 @@ amdgpu::bridge::createShmCommandBuffer(const char *name) { } gShmFd = fd; - auto result = new (memory) amdgpu::bridge::BridgeHeader(); + auto result = new (memory) amdgpu::bridge::BridgeHeader; + std::memset(result, 0, sizeof(*result)); result->size = (kShmSize - sizeof(amdgpu::bridge::BridgeHeader)) / sizeof(std::uint64_t); return result; diff --git a/hw/amdgpu/device/src/device.cpp b/hw/amdgpu/device/src/device.cpp index 500b024ab..0f883403c 100644 --- a/hw/amdgpu/device/src/device.cpp +++ b/hw/amdgpu/device/src/device.cpp @@ -1790,13 +1790,13 @@ static void printSpirv(const std::vector &bin) { return; } - spirv_cross::CompilerGLSL glsl(bin); - spirv_cross::CompilerGLSL::Options options; - options.version = 460; - options.es = false; - options.vulkan_semantics = true; - glsl.set_common_options(options); - std::printf("%s\n", glsl.compile().c_str()); + // spirv_cross::CompilerGLSL glsl(bin); + // spirv_cross::CompilerGLSL::Options options; + // options.version = 460; + // options.es = false; + // options.vulkan_semantics = true; + // glsl.set_common_options(options); + // std::printf("%s\n", glsl.compile().c_str()); #endif } diff --git a/rpcsx-os/main.cpp b/rpcsx-os/main.cpp index b8271d9ec..86c769ba3 100644 --- a/rpcsx-os/main.cpp +++ b/rpcsx-os/main.cpp @@ -1821,6 +1821,7 @@ int main(int argc, const char *argv[]) { mainThread->tid = initProcess->pid + baseId; mainThread->state = orbis::ThreadState::RUNNING; mainThread->hostTid = ::gettid(); + orbis::g_currentThread = mainThread; auto executableModule = rx::linker::loadModuleFile(argv[argIndex], mainThread);