SF: Pass transformHint with releaseBuffer
We want the client to receive the tranformHint as early
as possible, in particular prior to beginning rendering
of a new frame. Since the releaseBuffer callback may
cause the client to begin rendering we should include
our most up to date transform hint here.
Bug: 184842607
Test: Existing tests pass
Change-Id: I61127d78f44b7332ad9ff3cade772fa6b475365f
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp
index a2868c6..b9a293f 100644
--- a/libs/gui/BLASTBufferQueue.cpp
+++ b/libs/gui/BLASTBufferQueue.cpp
@@ -302,23 +302,25 @@
// So we pass in a weak pointer to the BBQ and if it still alive, then we release the buffer.
// Otherwise, this is a no-op.
static void releaseBufferCallbackThunk(wp<BLASTBufferQueue> context, uint64_t graphicBufferId,
- const sp<Fence>& releaseFence) {
+ const sp<Fence>& releaseFence, uint32_t transformHint) {
sp<BLASTBufferQueue> blastBufferQueue = context.promote();
ALOGV("releaseBufferCallbackThunk graphicBufferId=%" PRIu64 " blastBufferQueue=%s",
graphicBufferId, blastBufferQueue ? "alive" : "dead");
if (blastBufferQueue) {
- blastBufferQueue->releaseBufferCallback(graphicBufferId, releaseFence);
+ blastBufferQueue->releaseBufferCallback(graphicBufferId, releaseFence, transformHint);
}
}
void BLASTBufferQueue::releaseBufferCallback(uint64_t graphicBufferId,
- const sp<Fence>& releaseFence) {
+ const sp<Fence>& releaseFence,
+ uint32_t transformHint) {
ATRACE_CALL();
std::unique_lock _lock{mMutex};
BQA_LOGV("releaseBufferCallback graphicBufferId=%" PRIu64, graphicBufferId);
if (mSurfaceControl != nullptr) {
- mTransformHint = mSurfaceControl->getTransformHint();
+ mTransformHint = transformHint;
+ mSurfaceControl->setTransformHint(transformHint);
mBufferItemConsumer->setTransformHint(mTransformHint);
}
@@ -412,7 +414,7 @@
auto releaseBufferCallback =
std::bind(releaseBufferCallbackThunk, wp<BLASTBufferQueue>(this) /* callbackContext */,
- std::placeholders::_1, std::placeholders::_2);
+ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
t->setBuffer(mSurfaceControl, buffer, releaseBufferCallback);
t->setDataspace(mSurfaceControl, static_cast<ui::Dataspace>(bufferItem.mDataSpace));
t->setHdrMetadata(mSurfaceControl, bufferItem.mHdrMetadata);