diff options
author | 2021-06-15 16:56:21 -0700 | |
---|---|---|
committer | 2021-06-17 16:43:54 -0700 | |
commit | 899dcdb63ad9cb81d1987e89be08dc9603aad89b (patch) | |
tree | ce6ea8bb20845f18d901fab94e2ba9027d2757db /libs/gui/SurfaceComposerClient.cpp | |
parent | 0bde6b5a9837ab96484c988bb3f148d0b9b3ab4e (diff) |
SF: change acquired buffers based on the current refresh rate
BLASTBufferQueue set the max acquired buffers based on SF
vsync configuration (sf.duration and app.duration). This is calculated
based on the max supported refresh rate on the device, and it turn
is propogated to apps via min_undequeued_buffers to the app could
allocate enough buffers for maintaining the pipeline SF expects.
This leads to a higher latency when the device is running in a lower
refresh rate as there are more buffers on the buffer queue then required.
In this change we are holding on the these "extra buffers" and not
releasing them back to the buffer queue so the app would use the number
of buffers it needs based on the current refresh rate, and to avoid having
unnecessary long latency.
Bug: 188553729
Test: Run backpressure based game on 60Hz and 120Hz and collect systraces
Change-Id: I9d4e6278f0ddd28008ac437ab0576aa79d05166a
Diffstat (limited to 'libs/gui/SurfaceComposerClient.cpp')
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 660c5bd97d..c69435d328 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -328,7 +328,8 @@ void TransactionCompletedListener::onTransactionCompleted(ListenerStats listener surfaceStats.previousReleaseFence ? surfaceStats.previousReleaseFence : Fence::NO_FENCE, - surfaceStats.transformHint); + surfaceStats.transformHint, + surfaceStats.currentMaxAcquiredBufferCount); } } } @@ -364,9 +365,9 @@ void TransactionCompletedListener::onTransactionCompleted(ListenerStats listener } } -void TransactionCompletedListener::onReleaseBuffer(uint64_t graphicBufferId, - sp<Fence> releaseFence, - uint32_t transformHint) { +void TransactionCompletedListener::onReleaseBuffer(uint64_t graphicBufferId, sp<Fence> releaseFence, + uint32_t transformHint, + uint32_t currentMaxAcquiredBufferCount) { ReleaseBufferCallback callback; { std::scoped_lock<std::mutex> lock(mMutex); @@ -376,7 +377,7 @@ void TransactionCompletedListener::onReleaseBuffer(uint64_t graphicBufferId, ALOGE("Could not call release buffer callback, buffer not found %" PRIu64, graphicBufferId); return; } - callback(graphicBufferId, releaseFence, transformHint); + callback(graphicBufferId, releaseFence, transformHint, currentMaxAcquiredBufferCount); } ReleaseBufferCallback TransactionCompletedListener::popReleaseBufferCallbackLocked( |