From 4f969e22713ee510ef29741773b8d6721ebe9e49 Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 12 Feb 2018 19:40:19 -0500 Subject: [PATCH] TransactParcel: Move WriteBlock to narrowest scope. --- src/core/hle/service/vi/vi.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index dd4d3e517..7d9a41ded 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -442,18 +442,20 @@ private: void TransactParcel(u32 id, TransactionId transaction, const std::vector& input_data, VAddr output_addr, u64 output_size) { auto buffer_queue = nv_flinger->GetBufferQueue(id); - std::vector response_buffer; + if (transaction == TransactionId::Connect) { IGBPConnectRequestParcel request{input_data}; IGBPConnectResponseParcel response{1280, 720}; - response_buffer = response.Serialize(); + std::vector response_buffer = response.Serialize(); + Memory::WriteBlock(output_addr, response_buffer.data(), response_buffer.size()); } else if (transaction == TransactionId::SetPreallocatedBuffer) { IGBPSetPreallocatedBufferRequestParcel request{input_data}; buffer_queue->SetPreallocatedBuffer(request.data.slot, request.buffer); IGBPSetPreallocatedBufferResponseParcel response{}; - response_buffer = response.Serialize(); + std::vector response_buffer = response.Serialize(); + Memory::WriteBlock(output_addr, response_buffer.data(), response_buffer.size()); } else if (transaction == TransactionId::DequeueBuffer) { IGBPDequeueBufferRequestParcel request{input_data}; @@ -461,21 +463,24 @@ private: request.data.height); IGBPDequeueBufferResponseParcel response{slot}; - response_buffer = response.Serialize(); + std::vector response_buffer = response.Serialize(); + Memory::WriteBlock(output_addr, response_buffer.data(), response_buffer.size()); } else if (transaction == TransactionId::RequestBuffer) { IGBPRequestBufferRequestParcel request{input_data}; auto& buffer = buffer_queue->RequestBuffer(request.slot); IGBPRequestBufferResponseParcel response{buffer}; - response_buffer = response.Serialize(); + std::vector response_buffer = response.Serialize(); + Memory::WriteBlock(output_addr, response_buffer.data(), response_buffer.size()); } else if (transaction == TransactionId::QueueBuffer) { IGBPQueueBufferRequestParcel request{input_data}; buffer_queue->QueueBuffer(request.data.slot, request.data.transform); IGBPQueueBufferResponseParcel response{1280, 720}; - response_buffer = response.Serialize(); + std::vector response_buffer = response.Serialize(); + Memory::WriteBlock(output_addr, response_buffer.data(), response_buffer.size()); } else if (transaction == TransactionId::Query) { IGBPQueryRequestParcel request{input_data}; @@ -483,13 +488,11 @@ private: buffer_queue->Query(static_cast(request.type)); IGBPQueryResponseParcel response{value}; - response_buffer = response.Serialize(); - + std::vector response_buffer = response.Serialize(); + Memory::WriteBlock(output_addr, response_buffer.data(), response_buffer.size()); } else { ASSERT_MSG(false, "Unimplemented"); } - - Memory::WriteBlock(output_addr, response_buffer.data(), output_size); } void TransactParcel(Kernel::HLERequestContext& ctx) {