SF: Add DisplayDevice::initiateModeChange
This CL creates DisplayDevice::initiateModeChange which calls
HWC::setActiveConfigWithConstraints. SF should call DisplayDevice
instead of directly calling HWComposer.
This is a step towards removing the cached display modes from
the HWComposer class.
Test: presubmit
Bug: 159590486
Change-Id: Id05d2eacbbb6ed335fe205231b85e8af9a8ccd91
diff --git a/services/surfaceflinger/tests/unittests/HWComposerTest.cpp b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
index 71986fe..1e24c0a 100644
--- a/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
+++ b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
@@ -35,6 +35,7 @@
#include "DisplayHardware/DisplayMode.h"
#include "DisplayHardware/HWComposer.h"
+#include "DisplayHardware/Hal.h"
#include "mock/DisplayHardware/MockComposer.h"
// TODO(b/129481165): remove the #pragma below and fix conversion issues
@@ -230,7 +231,7 @@
constraints.seamlessRequired = false;
hal::VsyncPeriodChangeTimeline timeline = {0, 0, 0};
- constexpr DisplayModeId kConfigIndex(0);
+ constexpr Config kConfigIndex = 0;
const auto status =
hwc.setActiveModeWithConstraints(physicalId, kConfigIndex, constraints, &timeline);
EXPECT_EQ(NO_ERROR, status);
@@ -243,8 +244,10 @@
hwc.allocatePhysicalDisplay(hwcId, physicalId);
for (size_t configIndex = 0; configIndex < kConfigs.size(); configIndex++) {
- const auto status = hwc.setActiveModeWithConstraints(physicalId, DisplayModeId(configIndex),
- constraints, &timeline);
+ const auto status =
+ hwc.setActiveModeWithConstraints(physicalId,
+ static_cast<hal::HWConfigId>(configIndex),
+ constraints, &timeline);
EXPECT_EQ(NO_ERROR, status) << "Error when switching to config " << configIndex;
}
}
diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
index 9a9eeab..fc284ff 100644
--- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
+++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
@@ -598,7 +598,8 @@
std::optional<DisplayConnectionType> connectionType,
std::optional<hal::HWDisplayId> hwcDisplayId, bool isPrimary)
: mFlinger(flinger),
- mCreationArgs(flinger.mFlinger.get(), mDisplayToken, compositionDisplay),
+ mCreationArgs(flinger.mFlinger.get(), flinger.mFlinger->getHwComposer(),
+ mDisplayToken, compositionDisplay),
mHwcDisplayId(hwcDisplayId) {
mCreationArgs.connectionType = connectionType;
mCreationArgs.isPrimary = isPrimary;