yuzu-emu
/
yuzu
Archived
1
0
Fork 0

TransactParcel: Move WriteBlock to narrowest scope.

This commit is contained in:
bunnei 2018-02-12 19:40:19 -05:00
parent 0a87eb71ba
commit 4f969e2271
1 changed files with 13 additions and 10 deletions

View File

@ -442,18 +442,20 @@ private:
void TransactParcel(u32 id, TransactionId transaction, const std::vector<u8>& input_data, void TransactParcel(u32 id, TransactionId transaction, const std::vector<u8>& input_data,
VAddr output_addr, u64 output_size) { VAddr output_addr, u64 output_size) {
auto buffer_queue = nv_flinger->GetBufferQueue(id); auto buffer_queue = nv_flinger->GetBufferQueue(id);
std::vector<u8> response_buffer;
if (transaction == TransactionId::Connect) { if (transaction == TransactionId::Connect) {
IGBPConnectRequestParcel request{input_data}; IGBPConnectRequestParcel request{input_data};
IGBPConnectResponseParcel response{1280, 720}; IGBPConnectResponseParcel response{1280, 720};
response_buffer = response.Serialize(); std::vector<u8> response_buffer = response.Serialize();
Memory::WriteBlock(output_addr, response_buffer.data(), response_buffer.size());
} else if (transaction == TransactionId::SetPreallocatedBuffer) { } else if (transaction == TransactionId::SetPreallocatedBuffer) {
IGBPSetPreallocatedBufferRequestParcel request{input_data}; IGBPSetPreallocatedBufferRequestParcel request{input_data};
buffer_queue->SetPreallocatedBuffer(request.data.slot, request.buffer); buffer_queue->SetPreallocatedBuffer(request.data.slot, request.buffer);
IGBPSetPreallocatedBufferResponseParcel response{}; IGBPSetPreallocatedBufferResponseParcel response{};
response_buffer = response.Serialize(); std::vector<u8> response_buffer = response.Serialize();
Memory::WriteBlock(output_addr, response_buffer.data(), response_buffer.size());
} else if (transaction == TransactionId::DequeueBuffer) { } else if (transaction == TransactionId::DequeueBuffer) {
IGBPDequeueBufferRequestParcel request{input_data}; IGBPDequeueBufferRequestParcel request{input_data};
@ -461,21 +463,24 @@ private:
request.data.height); request.data.height);
IGBPDequeueBufferResponseParcel response{slot}; IGBPDequeueBufferResponseParcel response{slot};
response_buffer = response.Serialize(); std::vector<u8> response_buffer = response.Serialize();
Memory::WriteBlock(output_addr, response_buffer.data(), response_buffer.size());
} else if (transaction == TransactionId::RequestBuffer) { } else if (transaction == TransactionId::RequestBuffer) {
IGBPRequestBufferRequestParcel request{input_data}; IGBPRequestBufferRequestParcel request{input_data};
auto& buffer = buffer_queue->RequestBuffer(request.slot); auto& buffer = buffer_queue->RequestBuffer(request.slot);
IGBPRequestBufferResponseParcel response{buffer}; IGBPRequestBufferResponseParcel response{buffer};
response_buffer = response.Serialize(); std::vector<u8> response_buffer = response.Serialize();
Memory::WriteBlock(output_addr, response_buffer.data(), response_buffer.size());
} else if (transaction == TransactionId::QueueBuffer) { } else if (transaction == TransactionId::QueueBuffer) {
IGBPQueueBufferRequestParcel request{input_data}; IGBPQueueBufferRequestParcel request{input_data};
buffer_queue->QueueBuffer(request.data.slot, request.data.transform); buffer_queue->QueueBuffer(request.data.slot, request.data.transform);
IGBPQueueBufferResponseParcel response{1280, 720}; IGBPQueueBufferResponseParcel response{1280, 720};
response_buffer = response.Serialize(); std::vector<u8> response_buffer = response.Serialize();
Memory::WriteBlock(output_addr, response_buffer.data(), response_buffer.size());
} else if (transaction == TransactionId::Query) { } else if (transaction == TransactionId::Query) {
IGBPQueryRequestParcel request{input_data}; IGBPQueryRequestParcel request{input_data};
@ -483,13 +488,11 @@ private:
buffer_queue->Query(static_cast<NVFlinger::BufferQueue::QueryType>(request.type)); buffer_queue->Query(static_cast<NVFlinger::BufferQueue::QueryType>(request.type));
IGBPQueryResponseParcel response{value}; IGBPQueryResponseParcel response{value};
response_buffer = response.Serialize(); std::vector<u8> response_buffer = response.Serialize();
Memory::WriteBlock(output_addr, response_buffer.data(), response_buffer.size());
} else { } else {
ASSERT_MSG(false, "Unimplemented"); ASSERT_MSG(false, "Unimplemented");
} }
Memory::WriteBlock(output_addr, response_buffer.data(), output_size);
} }
void TransactParcel(Kernel::HLERequestContext& ctx) { void TransactParcel(Kernel::HLERequestContext& ctx) {