From 966c31810a2504ca47b29928cdba4e983d60ba6d Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Tue, 27 Dec 2022 19:11:02 +0000 Subject: [PATCH] Return appropriate fences in surfaceflinger queue buffer --- .../cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp | 3 ++- .../cpp/skyline/services/hosbinder/GraphicBufferProducer.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp b/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp index d3238961..4b4c50c4 100644 --- a/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp +++ b/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp @@ -141,7 +141,7 @@ namespace skyline::service::hosbinder { } buffer->state = BufferState::Dequeued; - fence = AndroidFence{}; // We just let the presentation engine return a buffer which is ready to be written into, there is no need for further synchronization + fence = buffer->fence; // We just let the presentation engine return a buffer which is ready to be written into, there is no need for further synchronization Logger::Debug("#{} - Dimensions: {}x{}, Format: {}, Usage: 0x{:X}, Is Async: {}", slot, width, height, ToString(format), usage, async); return AndroidStatus::Ok; @@ -385,6 +385,7 @@ namespace skyline::service::hosbinder { buffer.state = BufferState::Queued; buffer.frameNumber = ++frameNumber; + buffer.fence = fence; width = defaultWidth; height = defaultHeight; diff --git a/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.h b/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.h index 544425ed..f598db3c 100644 --- a/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.h +++ b/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.h @@ -44,6 +44,7 @@ namespace skyline::service::hosbinder { u64 frameNumber{}; //!< The amount of frames that have been queued using this slot bool wasBufferRequested{}; //!< If GraphicBufferProducer::RequestBuffer has been called with this buffer bool isPreallocated{}; //!< If this slot's graphic buffer has been preallocated or attached + AndroidFence fence{}; std::shared_ptr texture{}; std::unique_ptr graphicBuffer{}; };