diff options
author | Dan Stoza | 2015-04-29 12:21:49 -0500 |
---|---|---|
committer | Gerrit Code Review | 2015-04-29 12:21:51 -0500 |
commit | 8de71a2408f632407c25942a39c31f78c7f64ffd (patch) | |
tree | 0cce3d9d5ed8c64b1b83f0394fc71ba8cd623561 /libs | |
parent | ca8c569598d79b4bbe4fc08a4ea97619df3b7262 (diff) | |
parent | 81cde67a5528af6fbb7a3d49930fd3ca8ff49b34 (diff) | |
download | frameworks-native-8de71a2408f632407c25942a39c31f78c7f64ffd.tar.gz frameworks-native-8de71a2408f632407c25942a39c31f78c7f64ffd.tar.xz frameworks-native-8de71a2408f632407c25942a39c31f78c7f64ffd.zip |
Merge "BufferQueue: Add NATIVE_WINDOW_BUFFER_AGE query"
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gui/BufferQueueCore.cpp | 3 | ||||
-rw-r--r-- | libs/gui/BufferQueueProducer.cpp | 16 |
2 files changed, 18 insertions, 1 deletions
diff --git a/libs/gui/BufferQueueCore.cpp b/libs/gui/BufferQueueCore.cpp index bc75ca753..887f2cbf0 100644 --- a/libs/gui/BufferQueueCore.cpp +++ b/libs/gui/BufferQueueCore.cpp | |||
@@ -70,7 +70,8 @@ BufferQueueCore::BufferQueueCore(const sp<IGraphicBufferAlloc>& allocator) : | |||
70 | mTransformHint(0), | 70 | mTransformHint(0), |
71 | mIsAllocating(false), | 71 | mIsAllocating(false), |
72 | mIsAllocatingCondition(), | 72 | mIsAllocatingCondition(), |
73 | mAllowAllocation(true) | 73 | mAllowAllocation(true), |
74 | mBufferAge(0) | ||
74 | { | 75 | { |
75 | if (allocator == NULL) { | 76 | if (allocator == NULL) { |
76 | sp<ISurfaceComposer> composer(ComposerService::getComposerService()); | 77 | sp<ISurfaceComposer> composer(ComposerService::getComposerService()); |
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp index 86e45c8b0..7251d369a 100644 --- a/libs/gui/BufferQueueProducer.cpp +++ b/libs/gui/BufferQueueProducer.cpp | |||
@@ -337,10 +337,19 @@ status_t BufferQueueProducer::dequeueBuffer(int *outSlot, | |||
337 | mSlots[found].mEglDisplay = EGL_NO_DISPLAY; | 337 | mSlots[found].mEglDisplay = EGL_NO_DISPLAY; |
338 | mSlots[found].mEglFence = EGL_NO_SYNC_KHR; | 338 | mSlots[found].mEglFence = EGL_NO_SYNC_KHR; |
339 | mSlots[found].mFence = Fence::NO_FENCE; | 339 | mSlots[found].mFence = Fence::NO_FENCE; |
340 | mCore->mBufferAge = 0; | ||
340 | 341 | ||
341 | returnFlags |= BUFFER_NEEDS_REALLOCATION; | 342 | returnFlags |= BUFFER_NEEDS_REALLOCATION; |
343 | } else { | ||
344 | // We add 1 because that will be the frame number when this buffer | ||
345 | // is queued | ||
346 | mCore->mBufferAge = | ||
347 | mCore->mFrameCounter + 1 - mSlots[found].mFrameNumber; | ||
342 | } | 348 | } |
343 | 349 | ||
350 | BQ_LOGV("dequeueBuffer: setting buffer age to %" PRIu64, | ||
351 | mCore->mBufferAge); | ||
352 | |||
344 | if (CC_UNLIKELY(mSlots[found].mFence == NULL)) { | 353 | if (CC_UNLIKELY(mSlots[found].mFence == NULL)) { |
345 | BQ_LOGE("dequeueBuffer: about to return a NULL fence - " | 354 | BQ_LOGE("dequeueBuffer: about to return a NULL fence - " |
346 | "slot=%d w=%d h=%d format=%u", | 355 | "slot=%d w=%d h=%d format=%u", |
@@ -784,6 +793,13 @@ int BufferQueueProducer::query(int what, int *outValue) { | |||
784 | case NATIVE_WINDOW_DEFAULT_DATASPACE: | 793 | case NATIVE_WINDOW_DEFAULT_DATASPACE: |
785 | value = static_cast<int32_t>(mCore->mDefaultBufferDataSpace); | 794 | value = static_cast<int32_t>(mCore->mDefaultBufferDataSpace); |
786 | break; | 795 | break; |
796 | case NATIVE_WINDOW_BUFFER_AGE: | ||
797 | if (mCore->mBufferAge > INT32_MAX) { | ||
798 | value = 0; | ||
799 | } else { | ||
800 | value = static_cast<int32_t>(mCore->mBufferAge); | ||
801 | } | ||
802 | break; | ||
787 | default: | 803 | default: |
788 | return BAD_VALUE; | 804 | return BAD_VALUE; |
789 | } | 805 | } |