NVServices: Correct delayed responses.
This commit is contained in:
		
				
					committed by
					
						 FernandoS27
						FernandoS27
					
				
			
			
				
	
			
			
			
						parent
						
							8c91d5c166
						
					
				
				
					commit
					0fc98958a3
				
			| @@ -46,32 +46,27 @@ void NVDRV::Ioctl(Kernel::HLERequestContext& ctx) { | |||||||
|  |  | ||||||
|     u32 result = nvdrv->Ioctl(fd, command, ctx.ReadBuffer(), output, ctrl); |     u32 result = nvdrv->Ioctl(fd, command, ctx.ReadBuffer(), output, ctrl); | ||||||
|  |  | ||||||
|     if (!ctrl.must_delay) { |     if (ctrl.must_delay) { | ||||||
|         IPC::ResponseBuilder rb{ctx, 3}; |  | ||||||
|         rb.Push(RESULT_SUCCESS); |  | ||||||
|         rb.Push(result); |  | ||||||
|  |  | ||||||
|         ctx.WriteBuffer(output); |  | ||||||
|         return; |  | ||||||
|     } |  | ||||||
|         ctrl.fresh_call = false; |         ctrl.fresh_call = false; | ||||||
|         ctx.SleepClientThread( |         ctx.SleepClientThread( | ||||||
|             "NVServices::DelayedResponse", ctrl.timeout, |             "NVServices::DelayedResponse", ctrl.timeout, | ||||||
|         [this, ctrl = ctrl](Kernel::SharedPtr<Kernel::Thread> thread, |             [=](Kernel::SharedPtr<Kernel::Thread> thread, Kernel::HLERequestContext& ctx, | ||||||
|                             Kernel::HLERequestContext& ctx, Kernel::ThreadWakeupReason reason) { |                 Kernel::ThreadWakeupReason reason) { | ||||||
|             IPC::RequestParser rp{ctx}; |  | ||||||
|             u32 fd = rp.Pop<u32>(); |  | ||||||
|             u32 command = rp.Pop<u32>(); |  | ||||||
|             std::vector<u8> output(ctx.GetWriteBufferSize()); |  | ||||||
|                 IoctlCtrl ctrl2{ctrl}; |                 IoctlCtrl ctrl2{ctrl}; | ||||||
|             u32 result = nvdrv->Ioctl(fd, command, ctx.ReadBuffer(), output, ctrl2); |                 std::vector<u8> output2 = output; | ||||||
|  |                 u32 result = nvdrv->Ioctl(fd, command, ctx.ReadBuffer(), output2, ctrl2); | ||||||
|  |                 ctx.WriteBuffer(output2); | ||||||
|                 IPC::ResponseBuilder rb{ctx, 3}; |                 IPC::ResponseBuilder rb{ctx, 3}; | ||||||
|                 rb.Push(RESULT_SUCCESS); |                 rb.Push(RESULT_SUCCESS); | ||||||
|                 rb.Push(result); |                 rb.Push(result); | ||||||
|  |  | ||||||
|             ctx.WriteBuffer(output); |  | ||||||
|             }, |             }, | ||||||
|             nvdrv->GetEventWriteable(ctrl.event_id)); |             nvdrv->GetEventWriteable(ctrl.event_id)); | ||||||
|  |     } else { | ||||||
|  |         ctx.WriteBuffer(output); | ||||||
|  |     } | ||||||
|  |     IPC::ResponseBuilder rb{ctx, 3}; | ||||||
|  |     rb.Push(RESULT_SUCCESS); | ||||||
|  |     rb.Push(result); | ||||||
| } | } | ||||||
|  |  | ||||||
| void NVDRV::Close(Kernel::HLERequestContext& ctx) { | void NVDRV::Close(Kernel::HLERequestContext& ctx) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user