Variable refresh rate for virtual display
Allow virtual display to request a refresh rate, so it can be different
from VSYNC frequencies. SurfaceFlinger drops frames for the
corresponding virtual display based on the refresh rate.
Bug: 241286579
Test: atest libgui_test libsurfaceflinger_unittest SurfaceFlinger_test
Change-Id: I4fba0e553618bb4c7333514b16206ae4277acf72
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 207dfe2..170af48 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -483,7 +483,8 @@
EXCLUDES(mStateLock);
// Implements ISurfaceComposer
- sp<IBinder> createDisplay(const String8& displayName, bool secure);
+ sp<IBinder> createDisplay(const String8& displayName, bool secure,
+ float requestedRefreshRate = 0);
void destroyDisplay(const sp<IBinder>& displayToken);
std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const EXCLUDES(mStateLock) {
Mutex::Autolock lock(mStateLock);
@@ -1403,7 +1404,7 @@
sp<gui::IDisplayEventConnection>* outConnection) override;
binder::Status createConnection(sp<gui::ISurfaceComposerClient>* outClient) override;
binder::Status createDisplay(const std::string& displayName, bool secure,
- sp<IBinder>* outDisplay) override;
+ float requestedRefreshRate, sp<IBinder>* outDisplay) override;
binder::Status destroyDisplay(const sp<IBinder>& display) override;
binder::Status getPhysicalDisplayIds(std::vector<int64_t>* outDisplayIds) override;
binder::Status getPhysicalDisplayToken(int64_t displayId, sp<IBinder>* outDisplay) override;