summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/DisplayDevice.cpp
diff options
context:
space:
mode:
author Dominik Laskowski <domlaskowski@google.com> 2023-06-29 12:01:13 -0400
committer Dominik Laskowski <domlaskowski@google.com> 2023-08-01 11:50:29 -0400
commitfdac5651f516b543f7c2073d058405bfa425d39b (patch)
tree759321062c6bc6f6464b7d2c9c6ee45f918420ee /services/surfaceflinger/DisplayDevice.cpp
parent9bd0c2badd3190edc106930933f395d89e0a4e33 (diff)
SF: Fix mode setting for secondary displays
Desired modes were only propagated to HWC for the "active" display, i.e. generally the primary display and specially the rear display when in the folded state. In other words, mode setting did not happen for external displays, and the rear display when driving both displays concurrently. Store per-display state for whether a mode set is pending. Propagate the desired mode for both internal and external displays as long as they are powered on. Fixes: 277776378 Fixes: 289182528 Bug: 255635711 Bug: 255635821 Test: The 60 Hz constraint applies to both displays in concurrent mode. Test: ADB `set-user-preferred-display-mode` applies to external display. Test: DisplayModeSwitchingTest#inner{Xor,And}OuterDisplay Test: DisplayModeSwitchingTest#powerOffDuringModeSet Change-Id: I9da3a0be07f9fbb08f11485aa6ab9400259a4e09
Diffstat (limited to 'services/surfaceflinger/DisplayDevice.cpp')
-rw-r--r--services/surfaceflinger/DisplayDevice.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index 32bd890aee..3c7cbe693f 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -38,7 +38,6 @@
#include <log/log.h>
#include <system/window.h>
-#include "Display/DisplaySnapshot.h"
#include "DisplayDevice.h"
#include "FrontEnd/DisplayInfo.h"
#include "HdrSdrRatioOverlay.h"
@@ -231,10 +230,18 @@ status_t DisplayDevice::initiateModeChange(const ActiveModeInfo& info,
return BAD_VALUE;
}
mUpcomingActiveMode = info;
- ATRACE_INT(mActiveModeFPSHwcTrace.c_str(), info.modeOpt->modePtr->getFps().getIntValue());
- return mHwComposer.setActiveModeWithConstraints(getPhysicalId(),
- info.modeOpt->modePtr->getHwcId(), constraints,
- outTimeline);
+ mIsModeSetPending = true;
+
+ const auto& pendingMode = *info.modeOpt->modePtr;
+ ATRACE_INT(mActiveModeFPSHwcTrace.c_str(), pendingMode.getFps().getIntValue());
+
+ return mHwComposer.setActiveModeWithConstraints(getPhysicalId(), pendingMode.getHwcId(),
+ constraints, outTimeline);
+}
+
+void DisplayDevice::finalizeModeChange(DisplayModeId modeId, Fps displayFps, Fps renderFps) {
+ setActiveMode(modeId, displayFps, renderFps);
+ mIsModeSetPending = false;
}
nsecs_t DisplayDevice::getVsyncPeriodFromHWC() const {