diff options
author | 2023-09-07 18:45:58 -0700 | |
---|---|---|
committer | 2023-09-14 15:54:13 -0700 | |
commit | 6cdd3fd7dab0149041ee8dd7273fe83888d2b1e3 (patch) | |
tree | d16cd080fb54219293612a4e97496e02460f6392 /libs/gui/BufferQueueProducer.cpp | |
parent | 3821b0df36c612755b711d8d5a7b63377d7cf5d9 (diff) |
libgui: plumb setFrameRate thru BufferQueue
The current implementation just assumes that the Surface
and BLASTBufferQueue lives in the same process and rely
on inheritance to handle setFrameRate. This doesn't work
for any usecase that the Surface is Parceled to a diffrent process.
Bug: 281695725
Test: atest CtsGraphicsTestCases --test-filter SetFrameRateTest*
Change-Id: I4e08b92b618fa7b863ca3ef4f7b46d9f1c30c775
Diffstat (limited to 'libs/gui/BufferQueueProducer.cpp')
-rw-r--r-- | libs/gui/BufferQueueProducer.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp index 920b83dba9..67dff6dec6 100644 --- a/libs/gui/BufferQueueProducer.cpp +++ b/libs/gui/BufferQueueProducer.cpp @@ -32,6 +32,8 @@ #include <gui/BufferItem.h> #include <gui/BufferQueueCore.h> #include <gui/BufferQueueProducer.h> +#include <gui/Flags.h> +#include <gui/FrameRateUtils.h> #include <gui/GLConsumer.h> #include <gui/IConsumerListener.h> #include <gui/IProducerListener.h> @@ -1751,4 +1753,27 @@ status_t BufferQueueProducer::setAutoPrerotation(bool autoPrerotation) { return NO_ERROR; } +#if FLAG_BQ_SET_FRAME_RATE +status_t BufferQueueProducer::setFrameRate(float frameRate, int8_t compatibility, + int8_t changeFrameRateStrategy) { + ATRACE_CALL(); + BQ_LOGV("setFrameRate: %.2f", frameRate); + + if (!ValidateFrameRate(frameRate, compatibility, changeFrameRateStrategy, + "BufferQueueProducer::setFrameRate")) { + return BAD_VALUE; + } + + sp<IConsumerListener> listener; + { + std::lock_guard<std::mutex> lock(mCore->mMutex); + listener = mCore->mConsumerListener; + } + if (listener != nullptr) { + listener->onSetFrameRate(frameRate, compatibility, changeFrameRateStrategy); + } + return NO_ERROR; +} +#endif + } // namespace android |