diff options
author | bunnei <bunneidev@gmail.com> | 2018-02-10 04:50:29 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-02-10 05:33:49 +0100 |
commit | c83a1b232028ae4d84eb255e8c04154e9b6e8930 (patch) | |
tree | fb8771cb86b9ae84bab9b65d064feb2bb4c3f7a1 /src/core/hle/service/vi | |
parent | nvflinger: (Hack) Use first available buffer if none are found. (diff) | |
download | yuzu-c83a1b232028ae4d84eb255e8c04154e9b6e8930.tar yuzu-c83a1b232028ae4d84eb255e8c04154e9b6e8930.tar.gz yuzu-c83a1b232028ae4d84eb255e8c04154e9b6e8930.tar.bz2 yuzu-c83a1b232028ae4d84eb255e8c04154e9b6e8930.tar.lz yuzu-c83a1b232028ae4d84eb255e8c04154e9b6e8930.tar.xz yuzu-c83a1b232028ae4d84eb255e8c04154e9b6e8930.tar.zst yuzu-c83a1b232028ae4d84eb255e8c04154e9b6e8930.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/vi/vi.cpp | 78 |
1 files changed, 46 insertions, 32 deletions
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index a0eee9e4b..69ac2fe07 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -397,7 +397,7 @@ public: {0, &IHOSBinderDriver::TransactParcel, "TransactParcel"}, {1, &IHOSBinderDriver::AdjustRefcount, "AdjustRefcount"}, {2, &IHOSBinderDriver::GetNativeHandle, "GetNativeHandle"}, - {3, nullptr, "TransactParcelAuto"}, + {3, &IHOSBinderDriver::TransactParcelAuto, "TransactParcelAuto"}, }; RegisterHandlers(functions); } @@ -421,35 +421,21 @@ private: SetPreallocatedBuffer = 14 }; - void TransactParcel(Kernel::HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - u32 id = rp.Pop<u32>(); - auto transaction = static_cast<TransactionId>(rp.Pop<u32>()); - u32 flags = rp.Pop<u32>(); - - auto& input_buffer = ctx.BufferDescriptorA()[0]; - std::vector<u8> input_data(input_buffer.Size()); - Memory::ReadBlock(input_buffer.Address(), input_data.data(), input_buffer.Size()); - - auto& output_buffer = ctx.BufferDescriptorB()[0]; - + void TransactParcel(u32 id, TransactionId transaction, const std::vector<u8>& input_data, + VAddr output_addr, u64 output_size) { auto buffer_queue = nv_flinger->GetBufferQueue(id); - LOG_WARNING(Service_VI, "(STUBBED) called, transaction=%x", transaction); + std::vector<u8> response_buffer; if (transaction == TransactionId::Connect) { IGBPConnectRequestParcel request{input_data}; IGBPConnectResponseParcel response{1280, 720}; - auto response_buffer = response.Serialize(); - Memory::WriteBlock(output_buffer.Address(), response_buffer.data(), - output_buffer.Size()); + response_buffer = response.Serialize(); } else if (transaction == TransactionId::SetPreallocatedBuffer) { IGBPSetPreallocatedBufferRequestParcel request{input_data}; buffer_queue->SetPreallocatedBuffer(request.data.slot, request.buffer); IGBPSetPreallocatedBufferResponseParcel response{}; - auto response_buffer = response.Serialize(); - Memory::WriteBlock(output_buffer.Address(), response_buffer.data(), - output_buffer.Size()); + response_buffer = response.Serialize(); } else if (transaction == TransactionId::DequeueBuffer) { IGBPDequeueBufferRequestParcel request{input_data}; @@ -457,27 +443,21 @@ private: request.data.height); IGBPDequeueBufferResponseParcel response{slot}; - auto response_buffer = response.Serialize(); - Memory::WriteBlock(output_buffer.Address(), response_buffer.data(), - output_buffer.Size()); + response_buffer = response.Serialize(); } else if (transaction == TransactionId::RequestBuffer) { IGBPRequestBufferRequestParcel request{input_data}; auto& buffer = buffer_queue->RequestBuffer(request.slot); IGBPRequestBufferResponseParcel response{buffer}; - auto response_buffer = response.Serialize(); - Memory::WriteBlock(output_buffer.Address(), response_buffer.data(), - output_buffer.Size()); + response_buffer = response.Serialize(); } else if (transaction == TransactionId::QueueBuffer) { IGBPQueueBufferRequestParcel request{input_data}; buffer_queue->QueueBuffer(request.data.slot); IGBPQueueBufferResponseParcel response{1280, 720}; - auto response_buffer = response.Serialize(); - Memory::WriteBlock(output_buffer.Address(), response_buffer.data(), - output_buffer.Size()); + response_buffer = response.Serialize(); } else if (transaction == TransactionId::Query) { IGBPQueryRequestParcel request{input_data}; @@ -485,13 +465,47 @@ private: buffer_queue->Query(static_cast<NVFlinger::BufferQueue::QueryType>(request.type)); IGBPQueryResponseParcel response{value}; - auto response_buffer = response.Serialize(); - Memory::WriteBlock(output_buffer.Address(), response_buffer.data(), - output_buffer.Size()); + response_buffer = response.Serialize(); + } else { ASSERT_MSG(false, "Unimplemented"); } + Memory::WriteBlock(output_addr, response_buffer.data(), output_size); + } + + void TransactParcel(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + u32 id = rp.Pop<u32>(); + auto transaction = static_cast<TransactionId>(rp.Pop<u32>()); + u32 flags = rp.Pop<u32>(); + LOG_DEBUG(Service_VI, "called, transaction=%x", transaction); + + auto& input_buffer = ctx.BufferDescriptorA()[0]; + auto& output_buffer = ctx.BufferDescriptorB()[0]; + std::vector<u8> input_data(input_buffer.Size()); + Memory::ReadBlock(input_buffer.Address(), input_data.data(), input_buffer.Size()); + + TransactParcel(id, transaction, input_data, output_buffer.Address(), output_buffer.Size()); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); + } + + void TransactParcelAuto(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + u32 id = rp.Pop<u32>(); + auto transaction = static_cast<TransactionId>(rp.Pop<u32>()); + u32 flags = rp.Pop<u32>(); + LOG_DEBUG(Service_VI, "called, transaction=%x", transaction); + + auto& input_buffer = ctx.BufferDescriptorX()[0]; + auto& output_buffer = ctx.BufferDescriptorC()[0]; + std::vector<u8> input_data(input_buffer.size); + Memory::ReadBlock(input_buffer.Address(), input_data.data(), input_buffer.size); + + TransactParcel(id, transaction, input_data, output_buffer.Address(), output_buffer.Size()); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } |