Implement a way to check if the command record thread is idle

Useful for debugging and testing
This commit is contained in:
Billy Laws 2022-12-27 18:01:20 +00:00
parent c67f27e914
commit 89c6fab1cb
2 changed files with 9 additions and 0 deletions

View File

@ -140,6 +140,7 @@ namespace skyline::gpu::interconnect {
signal::SetSignalHandler({SIGINT, SIGILL, SIGTRAP, SIGBUS, SIGFPE, SIGSEGV}, signal::ExceptionalSignalHandler);
incoming.Process([this, renderDocApi, &gpu](Slot *slot) {
idle = false;
VkInstance instance{*gpu.vkInstance};
if (renderDocApi && slot->capture)
renderDocApi->StartFrameCapture(RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(instance), nullptr);
@ -157,6 +158,7 @@ namespace skyline::gpu::interconnect {
}
outgoing.Push(slot);
idle = true;
}, [] {});
} catch (const signal::SignalException &e) {
Logger::Error("{}\nStack Trace:{}", e.what(), state.loader->GetStackTrace(e.frames));
@ -173,6 +175,10 @@ namespace skyline::gpu::interconnect {
}
}
bool CommandRecordThread::IsIdle() const {
return idle;
}
CommandRecordThread::Slot *CommandRecordThread::AcquireSlot() {
auto startTime{util::GetTimeNs()};
auto slot{outgoing.Pop()};

View File

@ -68,6 +68,7 @@ namespace skyline::gpu::interconnect {
CircularQueue<Slot *> incoming; //!< Slots pending recording
CircularQueue<Slot *> outgoing; //!< Slots that have been submitted, may still be active on the GPU
std::list<Slot> slots;
std::atomic<bool> idle;
std::thread thread;
@ -78,6 +79,8 @@ namespace skyline::gpu::interconnect {
public:
CommandRecordThread(const DeviceState &state);
bool IsIdle() const;
/**
* @return A free slot, `Reset` needs to be called before accessing it
*/