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/BLASTBufferQueue.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/BLASTBufferQueue.cpp')
-rw-r--r-- | libs/gui/BLASTBufferQueue.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index 207fa4fd31..dd0a028865 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -26,6 +26,8 @@ #include <gui/BufferQueueConsumer.h> #include <gui/BufferQueueCore.h> #include <gui/BufferQueueProducer.h> +#include <gui/Flags.h> +#include <gui/FrameRateUtils.h> #include <gui/GLConsumer.h> #include <gui/IProducerListener.h> #include <gui/Surface.h> @@ -39,6 +41,9 @@ #include <android-base/thread_annotations.h> #include <chrono> +#include <com_android_graphics_libgui_flags.h> + +using namespace com::android::graphics::libgui; using namespace std::chrono_literals; namespace { @@ -139,6 +144,16 @@ void BLASTBufferItemConsumer::onSidebandStreamChanged() { } } +#if FLAG_BQ_SET_FRAME_RATE +void BLASTBufferItemConsumer::onSetFrameRate(float frameRate, int8_t compatibility, + int8_t changeFrameRateStrategy) { + sp<BLASTBufferQueue> bbq = mBLASTBufferQueue.promote(); + if (bbq != nullptr) { + bbq->setFrameRate(frameRate, compatibility, changeFrameRateStrategy); + } +} +#endif + void BLASTBufferItemConsumer::resizeFrameEventHistory(size_t newSize) { Mutex::Autolock lock(mMutex); mFrameEventHistory.resize(newSize); @@ -890,6 +905,10 @@ public: status_t setFrameRate(float frameRate, int8_t compatibility, int8_t changeFrameRateStrategy) override { + if (flags::bq_setframerate()) { + return Surface::setFrameRate(frameRate, compatibility, changeFrameRateStrategy); + } + std::lock_guard _lock{mMutex}; if (mDestroyed) { return DEAD_OBJECT; |