From 6cdd3fd7dab0149041ee8dd7273fe83888d2b1e3 Mon Sep 17 00:00:00 2001 From: Ady Abraham Date: Thu, 7 Sep 2023 18:45:58 -0700 Subject: 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 --- libs/gui/BLASTBufferQueue.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'libs/gui/BLASTBufferQueue.cpp') 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 #include #include +#include +#include #include #include #include @@ -39,6 +41,9 @@ #include #include +#include + +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 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; -- cgit v1.2.3-59-g8ed1b