From 170e19d4eab455ad4d28ad72799cc6687692392d Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 17 Jul 2018 00:05:13 -0400 Subject: nvflinger: Fix for BufferQueue event handling. --- src/core/hle/kernel/hle_ipc.cpp | 10 ++++++++-- src/core/hle/kernel/hle_ipc.h | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/core/hle/kernel') diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 2532dd450..b1e6f565b 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -29,7 +29,8 @@ void SessionRequestHandler::ClientDisconnected(SharedPtr server_s SharedPtr HLERequestContext::SleepClientThread(SharedPtr thread, const std::string& reason, u64 timeout, - WakeupCallback&& callback) { + WakeupCallback&& callback, + Kernel::SharedPtr event) { // Put the client thread to sleep until the wait event is signaled or the timeout expires. thread->wakeup_callback = @@ -41,7 +42,12 @@ SharedPtr HLERequestContext::SleepClientThread(SharedPtr thread, return true; }; - auto event = Kernel::Event::Create(Kernel::ResetType::OneShot, "HLE Pause Event: " + reason); + if (!event) { + // Create event if not provided + event = Kernel::Event::Create(Kernel::ResetType::OneShot, "HLE Pause Event: " + reason); + } + + event->Clear(); thread->status = THREADSTATUS_WAIT_HLE_EVENT; thread->wait_objects = {event}; event->AddWaitingThread(thread); diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 376263eac..c6eca7404 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -118,10 +118,12 @@ public: * @param callback Callback to be invoked when the thread is resumed. This callback must write * the entire command response once again, regardless of the state of it before this function * was called. + * @param event Event to use to wake up the thread. If unspecified, an event will be created. * @returns Event that when signaled will resume the thread and call the callback function. */ SharedPtr SleepClientThread(SharedPtr thread, const std::string& reason, - u64 timeout, WakeupCallback&& callback); + u64 timeout, WakeupCallback&& callback, + Kernel::SharedPtr event = nullptr); void ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming); -- cgit v1.2.3