summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-07-04 10:19:25 -0400
committerGravatar FernandoS272019-07-05 15:49:35 -0400
commit0fc98958a3efdc30e2d6ece5a2654df0987ce7ac (patch)
tree9f03719e8869f94013fbb4e4f1362c2fbbcd5ed3
parentNv_Host_Ctrl: Correct difference calculation (diff)
downloadyuzu-0fc98958a3efdc30e2d6ece5a2654df0987ce7ac.tar.gz
yuzu-0fc98958a3efdc30e2d6ece5a2654df0987ce7ac.tar.xz
yuzu-0fc98958a3efdc30e2d6ece5a2654df0987ce7ac.zip
NVServices: Correct delayed responses.
-rw-r--r--src/core/hle/service/nvdrv/interface.cpp43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp
index b8877b6cb..d5be64ed2 100644
--- a/src/core/hle/service/nvdrv/interface.cpp
+++ b/src/core/hle/service/nvdrv/interface.cpp
@@ -46,32 +46,27 @@ void NVDRV::Ioctl(Kernel::HLERequestContext& ctx) {
46 46
47 u32 result = nvdrv->Ioctl(fd, command, ctx.ReadBuffer(), output, ctrl); 47 u32 result = nvdrv->Ioctl(fd, command, ctx.ReadBuffer(), output, ctrl);
48 48
49 if (!ctrl.must_delay) { 49 if (ctrl.must_delay) {
50 IPC::ResponseBuilder rb{ctx, 3}; 50 ctrl.fresh_call = false;
51 rb.Push(RESULT_SUCCESS); 51 ctx.SleepClientThread(
52 rb.Push(result); 52 "NVServices::DelayedResponse", ctrl.timeout,
53 53 [=](Kernel::SharedPtr<Kernel::Thread> thread, Kernel::HLERequestContext& ctx,
54 Kernel::ThreadWakeupReason reason) {
55 IoctlCtrl ctrl2{ctrl};
56 std::vector<u8> output2 = output;
57 u32 result = nvdrv->Ioctl(fd, command, ctx.ReadBuffer(), output2, ctrl2);
58 ctx.WriteBuffer(output2);
59 IPC::ResponseBuilder rb{ctx, 3};
60 rb.Push(RESULT_SUCCESS);
61 rb.Push(result);
62 },
63 nvdrv->GetEventWriteable(ctrl.event_id));
64 } else {
54 ctx.WriteBuffer(output); 65 ctx.WriteBuffer(output);
55 return;
56 } 66 }
57 ctrl.fresh_call = false; 67 IPC::ResponseBuilder rb{ctx, 3};
58 ctx.SleepClientThread( 68 rb.Push(RESULT_SUCCESS);
59 "NVServices::DelayedResponse", ctrl.timeout, 69 rb.Push(result);
60 [this, ctrl = ctrl](Kernel::SharedPtr<Kernel::Thread> thread,
61 Kernel::HLERequestContext& ctx, Kernel::ThreadWakeupReason reason) {
62 IPC::RequestParser rp{ctx};
63 u32 fd = rp.Pop<u32>();
64 u32 command = rp.Pop<u32>();
65 std::vector<u8> output(ctx.GetWriteBufferSize());
66 IoctlCtrl ctrl2{ctrl};
67 u32 result = nvdrv->Ioctl(fd, command, ctx.ReadBuffer(), output, ctrl2);
68 IPC::ResponseBuilder rb{ctx, 3};
69 rb.Push(RESULT_SUCCESS);
70 rb.Push(result);
71
72 ctx.WriteBuffer(output);
73 },
74 nvdrv->GetEventWriteable(ctrl.event_id));
75} 70}
76 71
77void NVDRV::Close(Kernel::HLERequestContext& ctx) { 72void NVDRV::Close(Kernel::HLERequestContext& ctx) {