summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/DisplayDevice.cpp
diff options
context:
space:
mode:
author Dominik Laskowski <domlaskowski@google.com> 2024-07-31 11:04:24 -0400
committer Dominik Laskowski <domlaskowski@google.com> 2025-02-10 14:23:15 -0500
commit251e612d09ee1762dede0a873d5bb4c2c8d354d7 (patch)
tree3cc48af2b71f3c9a1edb2acec69137c9f813640a /services/surfaceflinger/DisplayDevice.cpp
parent23069b31e310e3e8d898505b27528e26351a37c6 (diff)
SF: Let DM resize framebuffer on resolution change
The goal of this change is to synchronize resolution switching across SF and DM. The lack of synchronization causes glitches, which are currently papered over in HWC by dropping frames whose size don't match the active resolution. A mode set involving a resolution switch was finalized by destroying the DisplayDevice and thus its HWC layers. Remove this special case in favor of letting DM call SurfaceControl.setDisplaySize right after requesting the mode set via setDesiredDisplayModeSpecs. Emit a mode change event to DM as soon as the DisplayModeRequest becomes the desired mode. In response, DM sends the transaction that resizes the display via setDisplaySize, so wait until that commit before modesetting to the new resolution, and resize the framebuffer in that same frame. Display projection depends on display size, so update the latter first when committing DisplayDeviceState. Fixes: 355427258 Flag: com.android.graphics.surfaceflinger.flags.synced_resolution_switch Test: Internal (caiman) and external displays, with different rotations. Test: Inner display (comet) with install orientation. Change-Id: Ifaf300f3b5f907f7cd10b8db2aa6165ad2106530
Diffstat (limited to 'services/surfaceflinger/DisplayDevice.cpp')
-rw-r--r--services/surfaceflinger/DisplayDevice.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index c743ea2ff4..e8b09b043e 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -223,9 +223,7 @@ void DisplayDevice::setFlags(uint32_t flags) {
mFlags = flags;
}
-void DisplayDevice::setDisplaySize(int width, int height) {
- LOG_FATAL_IF(!isVirtual(), "Changing the display size is supported only for virtual displays.");
- const auto size = ui::Size(width, height);
+void DisplayDevice::setDisplaySize(ui::Size size) {
mCompositionDisplay->setDisplaySize(size);
if (mRefreshRateOverlay) {
mRefreshRateOverlay->setViewport(size);