mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-24 10:23:01 -06:00
Merge pull request #3606 from ReinUsesLisp/nvflinger
service/vi: Partially implement BufferQueue disconnect
This commit is contained in:
commit
a9f866264d
3 changed files with 44 additions and 10 deletions
|
@ -126,6 +126,13 @@ void BufferQueue::ReleaseBuffer(u32 slot) {
|
||||||
buffer_wait_event.writable->Signal();
|
buffer_wait_event.writable->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BufferQueue::Disconnect() {
|
||||||
|
queue.clear();
|
||||||
|
queue_sequence.clear();
|
||||||
|
id = 1;
|
||||||
|
layer_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
u32 BufferQueue::Query(QueryType type) {
|
u32 BufferQueue::Query(QueryType type) {
|
||||||
LOG_WARNING(Service, "(STUBBED) called type={}", static_cast<u32>(type));
|
LOG_WARNING(Service, "(STUBBED) called type={}", static_cast<u32>(type));
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ public:
|
||||||
Service::Nvidia::MultiFence& multi_fence);
|
Service::Nvidia::MultiFence& multi_fence);
|
||||||
std::optional<std::reference_wrapper<const Buffer>> AcquireBuffer();
|
std::optional<std::reference_wrapper<const Buffer>> AcquireBuffer();
|
||||||
void ReleaseBuffer(u32 slot);
|
void ReleaseBuffer(u32 slot);
|
||||||
|
void Disconnect();
|
||||||
u32 Query(QueryType type);
|
u32 Query(QueryType type);
|
||||||
|
|
||||||
u32 GetId() const {
|
u32 GetId() const {
|
||||||
|
|
|
@ -513,7 +513,8 @@ private:
|
||||||
|
|
||||||
auto& buffer_queue = nv_flinger->FindBufferQueue(id);
|
auto& buffer_queue = nv_flinger->FindBufferQueue(id);
|
||||||
|
|
||||||
if (transaction == TransactionId::Connect) {
|
switch (transaction) {
|
||||||
|
case TransactionId::Connect: {
|
||||||
IGBPConnectRequestParcel request{ctx.ReadBuffer()};
|
IGBPConnectRequestParcel request{ctx.ReadBuffer()};
|
||||||
IGBPConnectResponseParcel response{
|
IGBPConnectResponseParcel response{
|
||||||
static_cast<u32>(static_cast<u32>(DisplayResolution::UndockedWidth) *
|
static_cast<u32>(static_cast<u32>(DisplayResolution::UndockedWidth) *
|
||||||
|
@ -521,14 +522,18 @@ private:
|
||||||
static_cast<u32>(static_cast<u32>(DisplayResolution::UndockedHeight) *
|
static_cast<u32>(static_cast<u32>(DisplayResolution::UndockedHeight) *
|
||||||
Settings::values.resolution_factor)};
|
Settings::values.resolution_factor)};
|
||||||
ctx.WriteBuffer(response.Serialize());
|
ctx.WriteBuffer(response.Serialize());
|
||||||
} else if (transaction == TransactionId::SetPreallocatedBuffer) {
|
break;
|
||||||
|
}
|
||||||
|
case TransactionId::SetPreallocatedBuffer: {
|
||||||
IGBPSetPreallocatedBufferRequestParcel request{ctx.ReadBuffer()};
|
IGBPSetPreallocatedBufferRequestParcel request{ctx.ReadBuffer()};
|
||||||
|
|
||||||
buffer_queue.SetPreallocatedBuffer(request.data.slot, request.buffer);
|
buffer_queue.SetPreallocatedBuffer(request.data.slot, request.buffer);
|
||||||
|
|
||||||
IGBPSetPreallocatedBufferResponseParcel response{};
|
IGBPSetPreallocatedBufferResponseParcel response{};
|
||||||
ctx.WriteBuffer(response.Serialize());
|
ctx.WriteBuffer(response.Serialize());
|
||||||
} else if (transaction == TransactionId::DequeueBuffer) {
|
break;
|
||||||
|
}
|
||||||
|
case TransactionId::DequeueBuffer: {
|
||||||
IGBPDequeueBufferRequestParcel request{ctx.ReadBuffer()};
|
IGBPDequeueBufferRequestParcel request{ctx.ReadBuffer()};
|
||||||
const u32 width{request.data.width};
|
const u32 width{request.data.width};
|
||||||
const u32 height{request.data.height};
|
const u32 height{request.data.height};
|
||||||
|
@ -556,14 +561,18 @@ private:
|
||||||
},
|
},
|
||||||
buffer_queue.GetWritableBufferWaitEvent());
|
buffer_queue.GetWritableBufferWaitEvent());
|
||||||
}
|
}
|
||||||
} else if (transaction == TransactionId::RequestBuffer) {
|
break;
|
||||||
|
}
|
||||||
|
case TransactionId::RequestBuffer: {
|
||||||
IGBPRequestBufferRequestParcel request{ctx.ReadBuffer()};
|
IGBPRequestBufferRequestParcel request{ctx.ReadBuffer()};
|
||||||
|
|
||||||
auto& buffer = buffer_queue.RequestBuffer(request.slot);
|
auto& buffer = buffer_queue.RequestBuffer(request.slot);
|
||||||
|
|
||||||
IGBPRequestBufferResponseParcel response{buffer};
|
IGBPRequestBufferResponseParcel response{buffer};
|
||||||
ctx.WriteBuffer(response.Serialize());
|
ctx.WriteBuffer(response.Serialize());
|
||||||
} else if (transaction == TransactionId::QueueBuffer) {
|
break;
|
||||||
|
}
|
||||||
|
case TransactionId::QueueBuffer: {
|
||||||
IGBPQueueBufferRequestParcel request{ctx.ReadBuffer()};
|
IGBPQueueBufferRequestParcel request{ctx.ReadBuffer()};
|
||||||
|
|
||||||
buffer_queue.QueueBuffer(request.data.slot, request.data.transform,
|
buffer_queue.QueueBuffer(request.data.slot, request.data.transform,
|
||||||
|
@ -572,7 +581,9 @@ private:
|
||||||
|
|
||||||
IGBPQueueBufferResponseParcel response{1280, 720};
|
IGBPQueueBufferResponseParcel response{1280, 720};
|
||||||
ctx.WriteBuffer(response.Serialize());
|
ctx.WriteBuffer(response.Serialize());
|
||||||
} else if (transaction == TransactionId::Query) {
|
break;
|
||||||
|
}
|
||||||
|
case TransactionId::Query: {
|
||||||
IGBPQueryRequestParcel request{ctx.ReadBuffer()};
|
IGBPQueryRequestParcel request{ctx.ReadBuffer()};
|
||||||
|
|
||||||
const u32 value =
|
const u32 value =
|
||||||
|
@ -580,15 +591,30 @@ private:
|
||||||
|
|
||||||
IGBPQueryResponseParcel response{value};
|
IGBPQueryResponseParcel response{value};
|
||||||
ctx.WriteBuffer(response.Serialize());
|
ctx.WriteBuffer(response.Serialize());
|
||||||
} else if (transaction == TransactionId::CancelBuffer) {
|
break;
|
||||||
|
}
|
||||||
|
case TransactionId::CancelBuffer: {
|
||||||
LOG_CRITICAL(Service_VI, "(STUBBED) called, transaction=CancelBuffer");
|
LOG_CRITICAL(Service_VI, "(STUBBED) called, transaction=CancelBuffer");
|
||||||
} else if (transaction == TransactionId::Disconnect ||
|
break;
|
||||||
transaction == TransactionId::DetachBuffer) {
|
}
|
||||||
|
case TransactionId::Disconnect: {
|
||||||
|
LOG_WARNING(Service_VI, "(STUBBED) called, transaction=Disconnect");
|
||||||
|
const auto buffer = ctx.ReadBuffer();
|
||||||
|
|
||||||
|
buffer_queue.Disconnect();
|
||||||
|
|
||||||
|
IGBPEmptyResponseParcel response{};
|
||||||
|
ctx.WriteBuffer(response.Serialize());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TransactionId::DetachBuffer: {
|
||||||
const auto buffer = ctx.ReadBuffer();
|
const auto buffer = ctx.ReadBuffer();
|
||||||
|
|
||||||
IGBPEmptyResponseParcel response{};
|
IGBPEmptyResponseParcel response{};
|
||||||
ctx.WriteBuffer(response.Serialize());
|
ctx.WriteBuffer(response.Serialize());
|
||||||
} else {
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
ASSERT_MSG(false, "Unimplemented");
|
ASSERT_MSG(false, "Unimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue