From 30475ffc43d8daed449b3015614383ee25859731 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Sun, 26 Jun 2022 15:21:20 +0530 Subject: [PATCH] Fix `queueBuffer` `GraphicBuffer` Compatibility Check Newer versions of the Deko3D homebrew were crashing due to this check and it was discovered that the check was incorrect and rather than comparing the `NvSurface` what had to be compared was the `GraphicBuffer` associated with the slot directly. Co-authored-by: lynxnb --- .../services/hosbinder/GraphicBufferProducer.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp b/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp index e69147ef..a3e307d4 100644 --- a/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp +++ b/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp @@ -129,15 +129,14 @@ namespace skyline::service::hosbinder { height = height ? height : defaultHeight; format = (format != AndroidPixelFormat::None) ? format : defaultFormat; - if (!buffer->graphicBuffer) { + auto &graphicBuffer{buffer->graphicBuffer}; + if (!graphicBuffer) // Horizon OS doesn't ever allocate memory for the buffers on the GraphicBufferProducer end // All buffers must be preallocated on the client application and attached to an Android buffer using SetPreallocatedBuffer return AndroidStatus::NoMemory; - } - auto &handle{buffer->graphicBuffer->graphicHandle}; - auto &surface{handle.surfaces.front()}; - if (handle.format != format || surface.width != width || surface.height != height || (buffer->graphicBuffer->usage & usage) != usage) { - Logger::Warn("Buffer which has been dequeued isn't compatible with the supplied parameters: Dimensions: {}x{}={}x{}, Format: {}={}, Usage: 0x{:X}=0x{:X}", width, height, surface.width, surface.height, ToString(format), ToString(buffer->graphicBuffer->format), usage, buffer->graphicBuffer->usage); + + if (graphicBuffer->format != format || graphicBuffer->width != width || graphicBuffer->height != height || (graphicBuffer->usage & usage) != usage) { + Logger::Warn("Buffer which has been dequeued isn't compatible with the supplied parameters: Dimensions: {}x{}={}x{}, Format: {}={}, Usage: 0x{:X}=0x{:X}", width, height, graphicBuffer->width, graphicBuffer->height, ToString(format), ToString(graphicBuffer->format), usage, graphicBuffer->usage); // Nintendo doesn't deallocate the slot which was picked in here and reallocate it as a compatible buffer // This is related to the comment above, Nintendo only allocates buffers on the client side return AndroidStatus::NoInit;