Services/GSP: Mark the thread ids as unused when a GSP session is destroyed.

This fixes the games that call RegisterInterruptRelayQueue and UnregisterInterruptRelayQueue frequently.
This commit is contained in:
Subv 2018-01-02 12:09:43 -05:00
parent d17f148e48
commit 75f68c4860
2 changed files with 6 additions and 3 deletions

View File

@ -362,12 +362,9 @@ void GSP_GPU::UnregisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x14, 0, 0);
SessionData* session_data = GetSessionData(ctx.Session());
session_data->thread_id = 0;
session_data->interrupt_event = nullptr;
session_data->registered = false;
// TODO(Subv): Reset next_thread_id so that it doesn't go past the maximum of 4.
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS);
@ -768,5 +765,10 @@ SessionData::SessionData() {
used_thread_ids[thread_id] = true;
}
SessionData::~SessionData() {
// Free the thread id slot so that other sessions can use it.
used_thread_ids[thread_id] = false;
}
} // namespace GSP
} // namespace Service

View File

@ -181,6 +181,7 @@ static_assert(sizeof(CommandBuffer) == 0x200, "CommandBuffer struct has incorrec
struct SessionData : public Kernel::SessionRequestHandler::SessionDataBase {
SessionData();
~SessionData();
/// Event triggered when GSP interrupt has been signalled
Kernel::SharedPtr<Kernel::Event> interrupt_event;