Reland "SF: Set an initial mode [...] for external displays"
Rebased and modified from Iec154c488ef7af9b8e1d6386509e97c9ce85103b,
patch set 3. Does not include
I688b0c922747a80e881965a1dc243d11ba2c7438, which was reverted.
DM currently always picks 1080p@60 for an external display. More work
(tracked in b/318534874) needs to be done in SF in order to use that
mode initially. In the meantime, have SF pick the same mode on hotplug
so that it avoids extra mode switches.
Move "force" into DisplayModeRequest. If a request is already pending
this allows forcing the final request if a pending request forced it,
even if the new request does not. This matches how emitEvent is handled.
If a DisplayModeRequest is forced, don't early exit in
initiateDisplayModeChanges, which does not honor "force".
When loading display modes for an external display, look for 1080p@60
and treat it as the active mode. If the display does not have 1080p@60,
pick the mode closest to (but not exceeding) 1080p@60. DM will pick an
appropriate mode later. When adding that display, apply that active mode
so it will be used by SF.
Fixes: 305813445
Test: libsurfaceflinger_unittest
Test: YouTube is not frozen or choppy on external display hotplug.
Test: Remove the option of 1080p@60 and connect.
Change-Id: I6864d88b327e0f207947b44ce14b97f323170714
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index c8e2a4d..4ed8ec6 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -719,7 +719,7 @@
// Show hdr sdr ratio overlay
bool mHdrSdrRatioOverlay = false;
- void setDesiredMode(display::DisplayModeRequest&&, bool force = false) REQUIRES(mStateLock);
+ void setDesiredMode(display::DisplayModeRequest&&) REQUIRES(mStateLock);
status_t setActiveModeFromBackdoor(const sp<display::DisplayToken>&, DisplayModeId, Fps minFps,
Fps maxFps);