Return the transform to apply in getLastQueuedBuffer
Bug: 28428955
Change-Id: Id48f7d3bf3f5deb074cf0a6a52a41caac875db41
diff --git a/include/gui/BufferQueueProducer.h b/include/gui/BufferQueueProducer.h
index 7256f73..a75ed98 100644
--- a/include/gui/BufferQueueProducer.h
+++ b/include/gui/BufferQueueProducer.h
@@ -184,7 +184,7 @@
// See IGraphicBufferProducer::getLastQueuedBuffer
virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
- sp<Fence>* outFence) override;
+ sp<Fence>* outFence, float outTransformMatrix[16]) override;
private:
// This is required by the IBinder::DeathRecipient interface
@@ -227,6 +227,9 @@
// since the previous buffer might have already been acquired.
sp<Fence> mLastQueueBufferFence;
+ Rect mLastQueuedCrop;
+ uint32_t mLastQueuedTransform;
+
// Take-a-ticket system for ensuring that onFrame* callbacks are called in
// the order that frames are queued. While the BufferQueue lock
// (mCore->mMutex) is held, a ticket is retained by the producer. After
diff --git a/include/gui/GLConsumer.h b/include/gui/GLConsumer.h
index 8de3302..6267625 100644
--- a/include/gui/GLConsumer.h
+++ b/include/gui/GLConsumer.h
@@ -132,6 +132,12 @@
// functions.
void getTransformMatrix(float mtx[16]);
+ // Computes the transform matrix documented by getTransformMatrix
+ // from the BufferItem sub parts.
+ static void computeTransformMatrix(float outTransform[16],
+ const sp<GraphicBuffer>& buf, const Rect& cropRect,
+ uint32_t transform, bool filtering);
+
// getTimestamp retrieves the timestamp associated with the texture image
// set by the most recent call to updateTexImage.
//
diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h
index 049406c..37ae6df 100644
--- a/include/gui/IGraphicBufferProducer.h
+++ b/include/gui/IGraphicBufferProducer.h
@@ -563,9 +563,11 @@
// the queue, outBuffer will be populated with nullptr and outFence will be
// populated with Fence::NO_FENCE
//
+ // outTransformMatrix is not modified if outBuffer is null.
+ //
// Returns NO_ERROR or the status of the Binder transaction
virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
- sp<Fence>* outFence) = 0;
+ sp<Fence>* outFence, float outTransformMatrix[16]) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index bbf427d..646203b 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -130,8 +130,9 @@
bool waitForNextFrame(uint64_t lastFrame, nsecs_t timeout);
// See IGraphicBufferProducer::getLastQueuedBuffer
+ // See GLConsumer::getTransformMatrix for outTransformMatrix format
status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
- sp<Fence>* outFence);
+ sp<Fence>* outFence, float outTransformMatrix[16]);
protected:
virtual ~Surface();