mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2024-12-27 03:56:01 +00:00
Merge pull request #181 from bunnei/vi-fixes-2
VI cleanup and add a hack for booting games
This commit is contained in:
commit
826e9c9782
|
@ -262,6 +262,11 @@ public:
|
||||||
Data data;
|
Data data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO(bunnei): Remove this. When set to 1, games will think a fence is valid and boot further.
|
||||||
|
// This will break libnx and potentially other apps that more stringently check this. This is here
|
||||||
|
// purely as a convenience, and should go away once we implement fences.
|
||||||
|
static constexpr u32 FENCE_HACK = 0;
|
||||||
|
|
||||||
class IGBPDequeueBufferResponseParcel : public Parcel {
|
class IGBPDequeueBufferResponseParcel : public Parcel {
|
||||||
public:
|
public:
|
||||||
explicit IGBPDequeueBufferResponseParcel(u32 slot) : Parcel(), slot(slot) {}
|
explicit IGBPDequeueBufferResponseParcel(u32 slot) : Parcel(), slot(slot) {}
|
||||||
|
@ -269,11 +274,20 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SerializeData() override {
|
void SerializeData() override {
|
||||||
Write(slot);
|
// TODO(bunnei): Find out what this all means. Writing anything non-zero here breaks libnx.
|
||||||
// TODO(Subv): Find out how this Fence is used.
|
Write<u32>(0);
|
||||||
std::array<u32_le, 11> fence = {};
|
Write<u32>(FENCE_HACK);
|
||||||
Write(fence);
|
Write<u32>(0);
|
||||||
Write<u32_le>(0);
|
Write<u32>(0);
|
||||||
|
Write<u32>(0);
|
||||||
|
Write<u32>(0);
|
||||||
|
Write<u32>(0);
|
||||||
|
Write<u32>(0);
|
||||||
|
Write<u32>(0);
|
||||||
|
Write<u32>(0);
|
||||||
|
Write<u32>(0);
|
||||||
|
Write<u32>(0);
|
||||||
|
Write<u32>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32_le slot;
|
u32_le slot;
|
||||||
|
@ -304,7 +318,7 @@ protected:
|
||||||
void SerializeData() override {
|
void SerializeData() override {
|
||||||
// TODO(bunnei): Find out what this all means. Writing anything non-zero here breaks libnx.
|
// TODO(bunnei): Find out what this all means. Writing anything non-zero here breaks libnx.
|
||||||
Write<u32_le>(0);
|
Write<u32_le>(0);
|
||||||
Write<u32_le>(0);
|
Write<u32_le>(FENCE_HACK);
|
||||||
Write<u32_le>(0);
|
Write<u32_le>(0);
|
||||||
Write(buffer);
|
Write(buffer);
|
||||||
Write<u32_le>(0);
|
Write<u32_le>(0);
|
||||||
|
@ -442,18 +456,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 +477,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 +502,13 @@ 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 if (transaction == TransactionId::CancelBuffer) {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called, transaction=CancelBuffer");
|
||||||
} 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) {
|
||||||
|
@ -555,7 +574,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<NVFlinger::NVFlinger> nv_flinger;
|
std::shared_ptr<NVFlinger::NVFlinger> nv_flinger;
|
||||||
};
|
}; // namespace VI
|
||||||
|
|
||||||
class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> {
|
class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue