Merge pull request #3461 from B3n30/release_right
GSP_GPU: Release the GPU right if the active session closes the gpu session
This commit is contained in:
commit
7d19ada5b8
|
@ -52,14 +52,14 @@ public:
|
|||
* associated ServerSession alive for the duration of the connection.
|
||||
* @param server_session Owning pointer to the ServerSession associated with the connection.
|
||||
*/
|
||||
void ClientConnected(SharedPtr<ServerSession> server_session);
|
||||
virtual void ClientConnected(SharedPtr<ServerSession> server_session);
|
||||
|
||||
/**
|
||||
* Signals that a client has just disconnected from this HLE handler and releases the
|
||||
* associated ServerSession.
|
||||
* @param server_session ServerSession associated with the connection.
|
||||
*/
|
||||
void ClientDisconnected(SharedPtr<ServerSession> server_session);
|
||||
virtual void ClientDisconnected(SharedPtr<ServerSession> server_session);
|
||||
|
||||
/// Empty placeholder structure for services with no per-session data. The session data classes
|
||||
/// in each service must inherit from this.
|
||||
|
|
|
@ -86,6 +86,13 @@ static inline InterruptRelayQueue* GetInterruptRelayQueue(
|
|||
return reinterpret_cast<InterruptRelayQueue*>(ptr);
|
||||
}
|
||||
|
||||
void GSP_GPU::ClientDisconnected(Kernel::SharedPtr<Kernel::ServerSession> server_session) {
|
||||
SessionData* session_data = GetSessionData(server_session);
|
||||
if (active_thread_id == session_data->thread_id)
|
||||
ReleaseRight(session_data);
|
||||
SessionRequestHandler::ClientDisconnected(server_session);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a single GSP GPU hardware registers with a single u32 value
|
||||
* (For internal use.)
|
||||
|
@ -678,13 +685,17 @@ void GSP_GPU::AcquireRight(Kernel::HLERequestContext& ctx) {
|
|||
rb.Push(RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
void GSP_GPU::ReleaseRight(SessionData* session_data) {
|
||||
ASSERT_MSG(active_thread_id == session_data->thread_id,
|
||||
"Wrong thread tried to release GPU right");
|
||||
active_thread_id = -1;
|
||||
}
|
||||
|
||||
void GSP_GPU::ReleaseRight(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x17, 0, 0);
|
||||
|
||||
SessionData* session_data = GetSessionData(ctx.Session());
|
||||
ASSERT_MSG(active_thread_id == session_data->thread_id,
|
||||
"Wrong thread tried to release GPU right");
|
||||
active_thread_id = -1;
|
||||
ReleaseRight(session_data);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
|
|
|
@ -196,6 +196,8 @@ public:
|
|||
GSP_GPU();
|
||||
~GSP_GPU() = default;
|
||||
|
||||
void ClientDisconnected(Kernel::SharedPtr<Kernel::ServerSession> server_session) override;
|
||||
|
||||
/**
|
||||
* Signals that the specified interrupt type has occurred to userland code
|
||||
* @param interrupt_id ID of interrupt that is being signalled
|
||||
|
@ -334,6 +336,12 @@ private:
|
|||
*/
|
||||
void ReleaseRight(Kernel::HLERequestContext& ctx);
|
||||
|
||||
/**
|
||||
* Releases rights to the GPU.
|
||||
* Will fail if the session_data doesn't have the GPU right
|
||||
*/
|
||||
void ReleaseRight(SessionData* session_data);
|
||||
|
||||
/**
|
||||
* GSP_GPU::ImportDisplayCaptureInfo service function
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue