summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2013-09-19 13:36:07 -0700
committerThe Android Automerger <android-build@android.com>2013-09-20 03:37:01 -0700
commita7395b4078b0b4f812132065acd8a3abecb2e274 (patch)
treee0cccac866e3d032b8c482aee33fbc30cd740fcf
parent7fa91dc3a767b73caa1b48b468be26ca9d03bb91 (diff)
downloadframeworks_native-android-4.4_r0.8.zip
frameworks_native-android-4.4_r0.8.tar.gz
frameworks_native-android-4.4_r0.8.tar.bz2
GLConsumer: Add query for current frame number.android-4.4_r0.8
Surface the underlying frame number of the current texture. Bug: 10830400 Change-Id: Ide3a7da12ea0aac54588beb6bf00dbfe2cd37653
-rw-r--r--include/gui/GLConsumer.h11
-rw-r--r--libs/gui/GLConsumer.cpp8
2 files changed, 19 insertions, 0 deletions
diff --git a/include/gui/GLConsumer.h b/include/gui/GLConsumer.h
index 00f38b4..75ee30c 100644
--- a/include/gui/GLConsumer.h
+++ b/include/gui/GLConsumer.h
@@ -141,6 +141,13 @@ public:
// documented by the source.
int64_t getTimestamp();
+ // getFrameNumber retrieves the frame number associated with the texture
+ // image set by the most recent call to updateTexImage.
+ //
+ // The frame number is an incrementing counter set to 0 at the creation of
+ // the BufferQueue associated with this consumer.
+ int64_t getFrameNumber();
+
// setDefaultBufferSize is used to set the size of buffers returned by
// requestBuffers when a with and height of zero is requested.
// A call to setDefaultBufferSize() may trigger requestBuffers() to
@@ -337,6 +344,10 @@ private:
// gets set each time updateTexImage is called.
int64_t mCurrentTimestamp;
+ // mCurrentFrameNumber is the frame counter for the current texture.
+ // It gets set each time updateTexImage is called.
+ int64_t mCurrentFrameNumber;
+
uint32_t mDefaultWidth, mDefaultHeight;
// mFilteringEnabled indicates whether the transform matrix is computed for
diff --git a/libs/gui/GLConsumer.cpp b/libs/gui/GLConsumer.cpp
index 0a2afbf..cf3f12a 100644
--- a/libs/gui/GLConsumer.cpp
+++ b/libs/gui/GLConsumer.cpp
@@ -96,6 +96,7 @@ GLConsumer::GLConsumer(const sp<IGraphicBufferConsumer>& bq, uint32_t tex,
mCurrentScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
mCurrentFence(Fence::NO_FENCE),
mCurrentTimestamp(0),
+ mCurrentFrameNumber(0),
mDefaultWidth(1),
mDefaultHeight(1),
mFilteringEnabled(true),
@@ -380,6 +381,7 @@ status_t GLConsumer::updateAndReleaseLocked(const BufferQueue::BufferItem& item)
mCurrentScalingMode = item.mScalingMode;
mCurrentTimestamp = item.mTimestamp;
mCurrentFence = item.mFence;
+ mCurrentFrameNumber = item.mFrameNumber;
computeCurrentTransformMatrixLocked();
@@ -819,6 +821,12 @@ nsecs_t GLConsumer::getTimestamp() {
return mCurrentTimestamp;
}
+nsecs_t GLConsumer::getFrameNumber() {
+ ST_LOGV("getFrameNumber");
+ Mutex::Autolock lock(mMutex);
+ return mCurrentFrameNumber;
+}
+
EGLImageKHR GLConsumer::createImage(EGLDisplay dpy,
const sp<GraphicBuffer>& graphicBuffer) {
EGLClientBuffer cbuf = (EGLClientBuffer)graphicBuffer->getNativeBuffer();