diff options
| author | 2017-07-18 11:05:49 -0600 | |
|---|---|---|
| committer | 2017-07-25 14:18:53 -0600 | |
| commit | b4f7493fbdb1d9d5b437a1dcb82e98b1531f4e3e (patch) | |
| tree | e6aef13bfd9d4ee5f0fb956e0715c95bc27801ac /libs/gui/BufferQueueProducer.cpp | |
| parent | b8b53824fb8b38c24072b482a18a95b4a55d8943 (diff) | |
Have the Surface class track the buffer age.
Have the Surface class track the buffer age, so that Surface::query()
can return the buffer age without having to use a binder call to
BufferQueueProducer::query(). The idea is for
BufferQueueProducer::dequeueBuffer() to return the value, which the
Surface class will cache for later use by Surface::query().
Bug: b/27903668
Test: Use systrace to no ensure query binder call after dequeueBuffer.
Change-Id: I7a4d79d02ea68781b464a463f0ecdf64978b7fb8
Diffstat (limited to 'libs/gui/BufferQueueProducer.cpp')
| -rw-r--r-- | libs/gui/BufferQueueProducer.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp index 3d94a029e5..3424012acf 100644 --- a/libs/gui/BufferQueueProducer.cpp +++ b/libs/gui/BufferQueueProducer.cpp @@ -347,10 +347,10 @@ status_t BufferQueueProducer::waitForFreeSlotThenRelock(FreeSlotCaller caller, return NO_ERROR; } -status_t BufferQueueProducer::dequeueBuffer(int *outSlot, - sp<android::Fence> *outFence, uint32_t width, uint32_t height, - PixelFormat format, uint64_t usage, - FrameEventHistoryDelta* outTimestamps) { +status_t BufferQueueProducer::dequeueBuffer(int* outSlot, sp<android::Fence>* outFence, + uint32_t width, uint32_t height, PixelFormat format, + uint64_t usage, uint64_t* outBufferAge, + FrameEventHistoryDelta* outTimestamps) { ATRACE_CALL(); { // Autolock scope Mutex::Autolock lock(mCore->mMutex); @@ -558,6 +558,9 @@ status_t BufferQueueProducer::dequeueBuffer(int *outSlot, mSlots[*outSlot].mFrameNumber, mSlots[*outSlot].mGraphicBuffer->handle, returnFlags); + if (outBufferAge) { + *outBufferAge = mCore->mBufferAge; + } addAndGetFrameTimestamps(nullptr, outTimestamps); return returnFlags; |