SF: Rename HwcConfigIndexType to DisplayModeId
Bug: 159590486
Bug: 176148651
Test: atest libsurfaceflinger_unittest
Change-Id: Ie177b213bb7a8ab9f67a51d2b5cf27d8fd97b780
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index d91b542..0a51659 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -981,7 +981,7 @@
Mutex::Autolock lock(mStateLock);
if (const auto display = getDisplayDeviceLocked(displayToken)) {
- activeConfig = display->getActiveConfig().value();
+ activeConfig = display->getActiveMode().value();
isPrimary = display->isPrimary();
} else {
ALOGE("%s: Invalid display token %p", __FUNCTION__, displayToken.get());
@@ -1013,7 +1013,7 @@
} else {
// Check is we are already at the desired config
const auto display = getDefaultDisplayDeviceLocked();
- if (!display || display->getActiveConfig() == refreshRate.getConfigId()) {
+ if (!display || display->getActiveMode() == refreshRate.getConfigId()) {
return;
}
@@ -1056,7 +1056,7 @@
ALOGW("Attempt to set allowed display configs for virtual display");
return INVALID_OPERATION;
} else {
- const HwcConfigIndexType config(mode);
+ const DisplayModeId config(mode);
const auto fps = mRefreshRateConfigs->getRefreshRateFromConfigId(config).getFps();
// Keep the old switching type.
const auto allowGroupSwitching =
@@ -1081,12 +1081,11 @@
return;
}
- auto oldRefreshRate =
- mRefreshRateConfigs->getRefreshRateFromConfigId(display->getActiveConfig());
+ auto oldRefreshRate = mRefreshRateConfigs->getRefreshRateFromConfigId(display->getActiveMode());
std::lock_guard<std::mutex> lock(mActiveConfigLock);
mRefreshRateConfigs->setCurrentConfigId(mUpcomingActiveConfig.configId);
- display->setActiveConfig(mUpcomingActiveConfig.configId);
+ display->setActiveMode(mUpcomingActiveConfig.configId);
auto refreshRate =
mRefreshRateConfigs->getRefreshRateFromConfigId(mUpcomingActiveConfig.configId);
@@ -1136,7 +1135,7 @@
ALOGV("performSetActiveConfig changing active config to %zu(%s)",
refreshRate.getConfigId().value(), refreshRate.getName().c_str());
const auto display = getDefaultDisplayDeviceLocked();
- if (!display || display->getActiveConfig() == desiredActiveConfig->configId) {
+ if (!display || display->getActiveMode() == desiredActiveConfig->configId) {
// display is not valid or we are already in the requested mode
// on both cases there is nothing left to do
desiredActiveConfigChangeDone();
@@ -1608,7 +1607,7 @@
*compositorTiming = getBE().mCompositorTiming;
}
-bool SurfaceFlinger::isDisplayConfigAllowed(HwcConfigIndexType configId) const {
+bool SurfaceFlinger::isDisplayConfigAllowed(DisplayModeId configId) const {
return mRefreshRateConfigs->isConfigAllowed(configId);
}
@@ -2479,7 +2478,7 @@
if (!state.isVirtual()) {
const auto physicalId = display->getPhysicalId();
auto activeConfigId = getHwComposer().getActiveMode(physicalId)->getId();
- display->setActiveConfig(activeConfigId);
+ display->setActiveMode(activeConfigId);
display->setDeviceProductInfo(state.physical->deviceProductInfo);
}
@@ -5419,7 +5418,7 @@
// mRefreshRateConfigs->getCurrentRefreshRate()
static_cast<void>(schedule([=] {
const auto desiredActiveConfig = getDesiredActiveConfig();
- const std::optional<HwcConfigIndexType> desiredConfigId = desiredActiveConfig
+ const std::optional<DisplayModeId> desiredConfigId = desiredActiveConfig
? std::make_optional(desiredActiveConfig->configId)
: std::nullopt;
@@ -6040,7 +6039,7 @@
repaintEverythingForHWC();
}
- display->setActiveConfig(policy->defaultConfig);
+ display->setActiveMode(policy->defaultConfig);
const nsecs_t vsyncPeriod = getHwComposer()
.getModes(displayId)[policy->defaultConfig.value()]
->getVsyncPeriod();
@@ -6070,11 +6069,11 @@
// TODO(b/140204874): Leave the event in until we do proper testing with all apps that might
// be depending in this callback.
const nsecs_t vsyncPeriod =
- mRefreshRateConfigs->getRefreshRateFromConfigId(display->getActiveConfig())
+ mRefreshRateConfigs->getRefreshRateFromConfigId(display->getActiveMode())
.getVsyncPeriod();
const auto physicalId = display->getPhysicalId();
mScheduler->onPrimaryDisplayConfigChanged(mAppConnectionHandle, physicalId,
- display->getActiveConfig(), vsyncPeriod);
+ display->getActiveMode(), vsyncPeriod);
toggleKernelIdleTimer();
auto configId = mScheduler->getPreferredConfigId();
@@ -6119,7 +6118,7 @@
return INVALID_OPERATION;
} else {
using Policy = scheduler::RefreshRateConfigs::Policy;
- const Policy policy{HwcConfigIndexType(defaultConfig),
+ const Policy policy{DisplayModeId(defaultConfig),
allowGroupSwitching,
{Fps(primaryRefreshRateMin), Fps(primaryRefreshRateMax)},
{Fps(appRequestRefreshRateMin), Fps(appRequestRefreshRateMax)}};