summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorGravatar bunnei2018-07-17 00:05:13 -0400
committerGravatar bunnei2018-07-17 00:26:23 -0400
commit170e19d4eab455ad4d28ad72799cc6687692392d (patch)
treeab2c73b4cd29b32e6c79c0274d65fe7cee7f6070 /src/core/hle/kernel
parentMerge pull request #669 from lioncash/dynarmic (diff)
downloadyuzu-170e19d4eab455ad4d28ad72799cc6687692392d.tar.gz
yuzu-170e19d4eab455ad4d28ad72799cc6687692392d.tar.xz
yuzu-170e19d4eab455ad4d28ad72799cc6687692392d.zip
nvflinger: Fix for BufferQueue event handling.
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp10
-rw-r--r--src/core/hle/kernel/hle_ipc.h4
2 files changed, 11 insertions, 3 deletions
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<ServerSession> server_s
29 29
30SharedPtr<Event> HLERequestContext::SleepClientThread(SharedPtr<Thread> thread, 30SharedPtr<Event> HLERequestContext::SleepClientThread(SharedPtr<Thread> thread,
31 const std::string& reason, u64 timeout, 31 const std::string& reason, u64 timeout,
32 WakeupCallback&& callback) { 32 WakeupCallback&& callback,
33 Kernel::SharedPtr<Kernel::Event> event) {
33 34
34 // Put the client thread to sleep until the wait event is signaled or the timeout expires. 35 // Put the client thread to sleep until the wait event is signaled or the timeout expires.
35 thread->wakeup_callback = 36 thread->wakeup_callback =
@@ -41,7 +42,12 @@ SharedPtr<Event> HLERequestContext::SleepClientThread(SharedPtr<Thread> thread,
41 return true; 42 return true;
42 }; 43 };
43 44
44 auto event = Kernel::Event::Create(Kernel::ResetType::OneShot, "HLE Pause Event: " + reason); 45 if (!event) {
46 // Create event if not provided
47 event = Kernel::Event::Create(Kernel::ResetType::OneShot, "HLE Pause Event: " + reason);
48 }
49
50 event->Clear();
45 thread->status = THREADSTATUS_WAIT_HLE_EVENT; 51 thread->status = THREADSTATUS_WAIT_HLE_EVENT;
46 thread->wait_objects = {event}; 52 thread->wait_objects = {event};
47 event->AddWaitingThread(thread); 53 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:
118 * @param callback Callback to be invoked when the thread is resumed. This callback must write 118 * @param callback Callback to be invoked when the thread is resumed. This callback must write
119 * the entire command response once again, regardless of the state of it before this function 119 * the entire command response once again, regardless of the state of it before this function
120 * was called. 120 * was called.
121 * @param event Event to use to wake up the thread. If unspecified, an event will be created.
121 * @returns Event that when signaled will resume the thread and call the callback function. 122 * @returns Event that when signaled will resume the thread and call the callback function.
122 */ 123 */
123 SharedPtr<Event> SleepClientThread(SharedPtr<Thread> thread, const std::string& reason, 124 SharedPtr<Event> SleepClientThread(SharedPtr<Thread> thread, const std::string& reason,
124 u64 timeout, WakeupCallback&& callback); 125 u64 timeout, WakeupCallback&& callback,
126 Kernel::SharedPtr<Kernel::Event> event = nullptr);
125 127
126 void ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming); 128 void ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming);
127 129