bridge: fix more possible command skips

gpu: show window after os launch
This commit is contained in:
DH 2024-09-05 22:12:59 +03:00
parent d3b9ff4292
commit 5830d66c4b
4 changed files with 20 additions and 17 deletions

View file

@ -243,7 +243,7 @@ private:
void sendCommand(CommandId id, std::initializer_list<std::uint64_t> 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<std::uint64_t>(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<CommandId>(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;

View file

@ -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;

View file

@ -1790,13 +1790,13 @@ static void printSpirv(const std::vector<uint32_t> &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
}

View file

@ -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);