SF: Rename HwcConfigIndexType to DisplayModeId
Bug: 159590486
Bug: 176148651
Test: atest libsurfaceflinger_unittest
Change-Id: Ie177b213bb7a8ab9f67a51d2b5cf27d8fd97b780
diff --git a/services/surfaceflinger/CompositionEngine/tests/MockHWComposer.h b/services/surfaceflinger/CompositionEngine/tests/MockHWComposer.h
index d0ba8fe..4d36f0c 100644
--- a/services/surfaceflinger/CompositionEngine/tests/MockHWComposer.h
+++ b/services/surfaceflinger/CompositionEngine/tests/MockHWComposer.h
@@ -96,7 +96,7 @@
MOCK_CONST_METHOD1(isVsyncPeriodSwitchSupported, bool(PhysicalDisplayId));
MOCK_CONST_METHOD1(getDisplayVsyncPeriod, nsecs_t(PhysicalDisplayId));
MOCK_METHOD4(setActiveModeWithConstraints,
- status_t(PhysicalDisplayId, HwcConfigIndexType,
+ status_t(PhysicalDisplayId, DisplayModeId,
const hal::VsyncPeriodChangeConstraints&,
hal::VsyncPeriodChangeTimeline*));
MOCK_METHOD2(setAutoLowLatencyMode, status_t(PhysicalDisplayId, bool));
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index 8551365..fe9db5a 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -139,12 +139,12 @@
return mPowerMode != hal::PowerMode::OFF;
}
-void DisplayDevice::setActiveConfig(HwcConfigIndexType mode) {
- mActiveConfig = mode;
+void DisplayDevice::setActiveMode(DisplayModeId mode) {
+ mActiveMode = mode;
}
-HwcConfigIndexType DisplayDevice::getActiveConfig() const {
- return mActiveConfig;
+DisplayModeId DisplayDevice::getActiveMode() const {
+ return mActiveMode;
}
ui::Dataspace DisplayDevice::getCompositionDataSpace() const {
@@ -210,7 +210,7 @@
result.append(" ");
StringAppendF(&result, "powerMode=%s (%d), ", to_string(mPowerMode).c_str(),
static_cast<int32_t>(mPowerMode));
- StringAppendF(&result, "activeConfig=%zu, ", mActiveConfig.value());
+ StringAppendF(&result, "activeConfig=%zu, ", mActiveMode.value());
StringAppendF(&result, "deviceProductInfo=");
if (mDeviceProductInfo) {
mDeviceProductInfo->dump(result);
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index cc38ab0..d29f97d 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -39,9 +39,9 @@
#include <utils/Timers.h>
#include "DisplayHardware/DisplayIdentification.h"
+#include "DisplayHardware/DisplayMode.h"
#include "DisplayHardware/Hal.h"
#include "DisplayHardware/PowerAdvisor.h"
-#include "Scheduler/HwcStrongTypes.h"
namespace android {
@@ -159,8 +159,8 @@
/* ------------------------------------------------------------------------
* Display active config management.
*/
- HwcConfigIndexType getActiveConfig() const;
- void setActiveConfig(HwcConfigIndexType mode);
+ DisplayModeId getActiveMode() const;
+ void setActiveMode(DisplayModeId mode);
// release HWC resources (if any) for removable displays
void disconnect();
@@ -189,7 +189,7 @@
hardware::graphics::composer::hal::PowerMode mPowerMode =
hardware::graphics::composer::hal::PowerMode::OFF;
- HwcConfigIndexType mActiveConfig;
+ DisplayModeId mActiveMode;
// TODO(b/74619554): Remove special cases for primary display.
const bool mIsPrimary;
diff --git a/services/surfaceflinger/DisplayHardware/DisplayMode.h b/services/surfaceflinger/DisplayHardware/DisplayMode.h
index 69fd00e..7ae54f1 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayMode.h
+++ b/services/surfaceflinger/DisplayHardware/DisplayMode.h
@@ -17,11 +17,12 @@
#pragma once
#include "DisplayHardware/Hal.h"
-#include "Scheduler/HwcStrongTypes.h"
+#include "Scheduler/StrongTyping.h"
#include <android/configuration.h>
#include <utils/Timers.h>
+#include <cstddef>
#include <memory>
#include <vector>
@@ -32,6 +33,7 @@
class DisplayMode;
using DisplayModePtr = std::shared_ptr<const DisplayMode>;
using DisplayModes = std::vector<DisplayModePtr>;
+using DisplayModeId = StrongTyping<size_t, struct DisplayModeIdTag, Compare, Hash>;
class DisplayMode {
public:
@@ -43,7 +45,7 @@
return std::const_pointer_cast<const DisplayMode>(std::move(mDisplayMode));
}
- Builder& setId(HwcConfigIndexType id) {
+ Builder& setId(DisplayModeId id) {
mDisplayMode->mId = id;
return *this;
}
@@ -104,7 +106,7 @@
std::shared_ptr<DisplayMode> mDisplayMode;
};
- HwcConfigIndexType getId() const { return mId; }
+ DisplayModeId getId() const { return mId; }
hal::HWConfigId getHwcId() const { return mHwcId; }
int32_t getWidth() const { return mWidth; }
@@ -118,7 +120,7 @@
explicit DisplayMode(hal::HWConfigId id) : mHwcId(id) {}
hal::HWConfigId mHwcId;
- HwcConfigIndexType mId;
+ DisplayModeId mId;
int32_t mWidth = -1;
int32_t mHeight = -1;
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index ca67935..6350144 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -318,7 +318,7 @@
displayData.modes.clear();
for (auto configId : configIds) {
auto mode = DisplayMode::Builder(configId)
- .setId(HwcConfigIndexType(displayData.modes.size()))
+ .setId(DisplayModeId(displayData.modes.size()))
.setWidth(getAttribute(hwcDisplayId, configId, hal::Attribute::WIDTH))
.setHeight(getAttribute(hwcDisplayId, configId, hal::Attribute::HEIGHT))
.setVsyncPeriod(getAttribute(hwcDisplayId, configId,
@@ -674,7 +674,7 @@
}
status_t HWComposer::setActiveModeWithConstraints(
- PhysicalDisplayId displayId, HwcConfigIndexType modeId,
+ PhysicalDisplayId displayId, DisplayModeId modeId,
const hal::VsyncPeriodChangeConstraints& constraints,
hal::VsyncPeriodChangeTimeline* outTimeline) {
RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX);
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index 2b3d2d4..59c3699 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -198,7 +198,7 @@
virtual DisplayConnectionType getDisplayConnectionType(PhysicalDisplayId) const = 0;
virtual bool isVsyncPeriodSwitchSupported(PhysicalDisplayId) const = 0;
virtual nsecs_t getDisplayVsyncPeriod(PhysicalDisplayId) const = 0;
- virtual status_t setActiveModeWithConstraints(PhysicalDisplayId, HwcConfigIndexType,
+ virtual status_t setActiveModeWithConstraints(PhysicalDisplayId, DisplayModeId,
const hal::VsyncPeriodChangeConstraints&,
hal::VsyncPeriodChangeTimeline* outTimeline) = 0;
virtual status_t setAutoLowLatencyMode(PhysicalDisplayId, bool on) = 0;
@@ -329,7 +329,7 @@
DisplayConnectionType getDisplayConnectionType(PhysicalDisplayId) const override;
bool isVsyncPeriodSwitchSupported(PhysicalDisplayId) const override;
nsecs_t getDisplayVsyncPeriod(PhysicalDisplayId displayId) const override;
- status_t setActiveModeWithConstraints(PhysicalDisplayId, HwcConfigIndexType,
+ status_t setActiveModeWithConstraints(PhysicalDisplayId, DisplayModeId,
const hal::VsyncPeriodChangeConstraints&,
hal::VsyncPeriodChangeTimeline* outTimeline) override;
status_t setAutoLowLatencyMode(PhysicalDisplayId, bool) override;
diff --git a/services/surfaceflinger/Scheduler/EventThread.cpp b/services/surfaceflinger/Scheduler/EventThread.cpp
index b63e8c8..c12a7b1 100644
--- a/services/surfaceflinger/Scheduler/EventThread.cpp
+++ b/services/surfaceflinger/Scheduler/EventThread.cpp
@@ -41,9 +41,10 @@
#include <utils/Errors.h>
#include <utils/Trace.h>
-#include "EventThread.h"
+#include "DisplayHardware/DisplayMode.h"
#include "FrameTimeline.h"
-#include "HwcStrongTypes.h"
+
+#include "EventThread.h"
#undef LOG_TAG
#define LOG_TAG "EventThread"
@@ -117,8 +118,8 @@
return event;
}
-DisplayEventReceiver::Event makeConfigChanged(PhysicalDisplayId displayId,
- HwcConfigIndexType configId, nsecs_t vsyncPeriod) {
+DisplayEventReceiver::Event makeConfigChanged(PhysicalDisplayId displayId, DisplayModeId configId,
+ nsecs_t vsyncPeriod) {
DisplayEventReceiver::Event event;
event.header = {DisplayEventReceiver::DISPLAY_EVENT_CONFIG_CHANGED, displayId, systemTime()};
event.config.configId = configId.value();
@@ -368,7 +369,7 @@
mCondition.notify_all();
}
-void EventThread::onConfigChanged(PhysicalDisplayId displayId, HwcConfigIndexType configId,
+void EventThread::onConfigChanged(PhysicalDisplayId displayId, DisplayModeId configId,
nsecs_t vsyncPeriod) {
std::lock_guard<std::mutex> lock(mMutex);
diff --git a/services/surfaceflinger/Scheduler/EventThread.h b/services/surfaceflinger/Scheduler/EventThread.h
index e75b718..15efe21 100644
--- a/services/surfaceflinger/Scheduler/EventThread.h
+++ b/services/surfaceflinger/Scheduler/EventThread.h
@@ -31,7 +31,7 @@
#include <thread>
#include <vector>
-#include "HwcStrongTypes.h"
+#include "DisplayHardware/DisplayMode.h"
// ---------------------------------------------------------------------------
namespace android {
@@ -124,7 +124,7 @@
virtual void onHotplugReceived(PhysicalDisplayId displayId, bool connected) = 0;
// called when SF changes the active config and apps needs to be notified about the change
- virtual void onConfigChanged(PhysicalDisplayId displayId, HwcConfigIndexType configId,
+ virtual void onConfigChanged(PhysicalDisplayId displayId, DisplayModeId configId,
nsecs_t vsyncPeriod) = 0;
// called when SF updates the Frame Rate Override list
@@ -173,7 +173,7 @@
void onHotplugReceived(PhysicalDisplayId displayId, bool connected) override;
- void onConfigChanged(PhysicalDisplayId displayId, HwcConfigIndexType configId,
+ void onConfigChanged(PhysicalDisplayId displayId, DisplayModeId configId,
nsecs_t vsyncPeriod) override;
void onFrameRateOverridesChanged(PhysicalDisplayId displayId,
diff --git a/services/surfaceflinger/Scheduler/HwcStrongTypes.h b/services/surfaceflinger/Scheduler/HwcStrongTypes.h
deleted file mode 100644
index b6a33a2..0000000
--- a/services/surfaceflinger/Scheduler/HwcStrongTypes.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include "StrongTyping.h"
-
-#include <cstddef>
-
-namespace android {
-
-// Strong types for the different indexes as they are referring to a different base.
-using HwcConfigIndexType = StrongTyping<size_t, struct HwcConfigIndexTypeTag, Compare, Add, Hash>;
-
-} // namespace android
\ No newline at end of file
diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
index b02596a..0f1e267 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
+++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
@@ -489,7 +489,7 @@
}
std::optional<Fps> RefreshRateConfigs::onKernelTimerChanged(
- std::optional<HwcConfigIndexType> desiredActiveConfigId, bool timerExpired) const {
+ std::optional<DisplayModeId> desiredActiveConfigId, bool timerExpired) const {
std::lock_guard lock(mLock);
const auto& current = desiredActiveConfigId ? *mRefreshRates.at(*desiredActiveConfigId)
@@ -554,26 +554,25 @@
return *mRefreshRates.at(getCurrentPolicyLocked()->defaultConfig);
}
-void RefreshRateConfigs::setCurrentConfigId(HwcConfigIndexType configId) {
+void RefreshRateConfigs::setCurrentConfigId(DisplayModeId configId) {
std::lock_guard lock(mLock);
mCurrentRefreshRate = mRefreshRates.at(configId).get();
}
-RefreshRateConfigs::RefreshRateConfigs(const DisplayModes& configs,
- HwcConfigIndexType currentConfigId)
+RefreshRateConfigs::RefreshRateConfigs(const DisplayModes& configs, DisplayModeId currentConfigId)
: mKnownFrameRates(constructKnownFrameRates(configs)) {
updateDisplayConfigs(configs, currentConfigId);
}
void RefreshRateConfigs::updateDisplayConfigs(const DisplayModes& configs,
- HwcConfigIndexType currentConfigId) {
+ DisplayModeId currentConfigId) {
std::lock_guard lock(mLock);
LOG_ALWAYS_FATAL_IF(configs.empty());
LOG_ALWAYS_FATAL_IF(currentConfigId.value() >= configs.size());
mRefreshRates.clear();
- for (auto configId = HwcConfigIndexType(0); configId.value() < configs.size(); configId++) {
- const auto& config = configs.at(static_cast<size_t>(configId.value()));
+ for (const auto& config : configs) {
+ const auto configId = config->getId();
const auto fps = Fps::fromPeriodNsecs(config->getVsyncPeriod());
mRefreshRates.emplace(configId,
std::make_unique<RefreshRate>(configId, config, fps,
@@ -663,7 +662,7 @@
return mDisplayManagerPolicy;
}
-bool RefreshRateConfigs::isConfigAllowed(HwcConfigIndexType config) const {
+bool RefreshRateConfigs::isConfigAllowed(DisplayModeId config) const {
std::lock_guard lock(mLock);
for (const RefreshRate* refreshRate : mAppRequestRefreshRates) {
if (refreshRate->configId == config) {
diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
index a5d37c2..ef193ca 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
+++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
@@ -27,7 +27,6 @@
#include "DisplayHardware/DisplayMode.h"
#include "DisplayHardware/HWComposer.h"
#include "Fps.h"
-#include "HwcStrongTypes.h"
#include "Scheduler/SchedulerUtils.h"
#include "Scheduler/Seamlessness.h"
#include "Scheduler/StrongTyping.h"
@@ -65,10 +64,10 @@
};
public:
- RefreshRate(HwcConfigIndexType configId, DisplayModePtr config, Fps fps, ConstructorTag)
+ RefreshRate(DisplayModeId configId, DisplayModePtr config, Fps fps, ConstructorTag)
: configId(configId), hwcConfig(config), fps(std::move(fps)) {}
- HwcConfigIndexType getConfigId() const { return configId; }
+ DisplayModeId getConfigId() const { return configId; }
nsecs_t getVsyncPeriod() const { return hwcConfig->getVsyncPeriod(); }
int32_t getConfigGroup() const { return hwcConfig->getConfigGroup(); }
std::string getName() const { return to_string(fps); }
@@ -99,7 +98,7 @@
// This config ID corresponds to the position of the config in the vector that is stored
// on the device.
- const HwcConfigIndexType configId;
+ const DisplayModeId configId;
// The config itself
DisplayModePtr hwcConfig;
// Refresh rate in frames per second
@@ -107,7 +106,7 @@
};
using AllRefreshRatesMapType =
- std::unordered_map<HwcConfigIndexType, std::unique_ptr<const RefreshRate>>;
+ std::unordered_map<DisplayModeId, std::unique_ptr<const RefreshRate>>;
struct FpsRange {
Fps min{0.0f};
@@ -131,7 +130,7 @@
public:
// The default config, used to ensure we only initiate display config switches within the
// same config group as defaultConfigId's group.
- HwcConfigIndexType defaultConfig;
+ DisplayModeId defaultConfig;
// Whether or not we switch config groups to get the best frame rate.
bool allowGroupSwitching = kAllowGroupSwitchingDefault;
// The primary refresh rate range represents display manager's general guidance on the
@@ -148,18 +147,18 @@
Policy() = default;
- Policy(HwcConfigIndexType defaultConfig, const FpsRange& range)
+ Policy(DisplayModeId defaultConfig, const FpsRange& range)
: Policy(defaultConfig, kAllowGroupSwitchingDefault, range, range) {}
- Policy(HwcConfigIndexType defaultConfig, bool allowGroupSwitching, const FpsRange& range)
+ Policy(DisplayModeId defaultConfig, bool allowGroupSwitching, const FpsRange& range)
: Policy(defaultConfig, allowGroupSwitching, range, range) {}
- Policy(HwcConfigIndexType defaultConfig, const FpsRange& primaryRange,
+ Policy(DisplayModeId defaultConfig, const FpsRange& primaryRange,
const FpsRange& appRequestRange)
: Policy(defaultConfig, kAllowGroupSwitchingDefault, primaryRange, appRequestRange) {}
- Policy(HwcConfigIndexType defaultConfig, bool allowGroupSwitching,
- const FpsRange& primaryRange, const FpsRange& appRequestRange)
+ Policy(DisplayModeId defaultConfig, bool allowGroupSwitching, const FpsRange& primaryRange,
+ const FpsRange& appRequestRange)
: defaultConfig(defaultConfig),
allowGroupSwitching(allowGroupSwitching),
primaryRange(primaryRange),
@@ -199,7 +198,7 @@
Policy getDisplayManagerPolicy() const EXCLUDES(mLock);
// Returns true if config is allowed by the current policy.
- bool isConfigAllowed(HwcConfigIndexType config) const EXCLUDES(mLock);
+ bool isConfigAllowed(DisplayModeId config) const EXCLUDES(mLock);
// Describes the different options the layer voted for refresh rate
enum class LayerVoteType {
@@ -265,7 +264,7 @@
return {mMinSupportedRefreshRate->getFps(), mMaxSupportedRefreshRate->getFps()};
}
- std::optional<Fps> onKernelTimerChanged(std::optional<HwcConfigIndexType> desiredActiveConfigId,
+ std::optional<Fps> onKernelTimerChanged(std::optional<DisplayModeId> desiredActiveConfigId,
bool timerExpired) const EXCLUDES(mLock);
// Returns the highest refresh rate according to the current policy. May change at runtime. Only
@@ -279,16 +278,16 @@
// the policy.
RefreshRate getCurrentRefreshRateByPolicy() const;
- // Returns the refresh rate that corresponds to a HwcConfigIndexType. This may change at
+ // Returns the refresh rate that corresponds to a DisplayModeId. This may change at
// runtime.
// TODO(b/159590486) An invalid config id may be given here if the dipslay configs have changed.
- RefreshRate getRefreshRateFromConfigId(HwcConfigIndexType configId) const EXCLUDES(mLock) {
+ RefreshRate getRefreshRateFromConfigId(DisplayModeId configId) const EXCLUDES(mLock) {
std::lock_guard lock(mLock);
return *mRefreshRates.at(configId);
};
// Stores the current configId the device operates at
- void setCurrentConfigId(HwcConfigIndexType configId) EXCLUDES(mLock);
+ void setCurrentConfigId(DisplayModeId configId) EXCLUDES(mLock);
// Returns a string that represents the layer vote type
static std::string layerVoteTypeString(LayerVoteType vote);
@@ -296,9 +295,9 @@
// Returns a known frame rate that is the closest to frameRate
Fps findClosestKnownFrameRate(Fps frameRate) const;
- RefreshRateConfigs(const DisplayModes& configs, HwcConfigIndexType currentConfigId);
+ RefreshRateConfigs(const DisplayModes& configs, DisplayModeId currentConfigId);
- void updateDisplayConfigs(const DisplayModes& configs, HwcConfigIndexType currentConfig)
+ void updateDisplayConfigs(const DisplayModes& configs, DisplayModeId currentConfig)
EXCLUDES(mLock);
// Returns whether switching configs (refresh rate or resolution) is possible.
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp
index 92786fd..588b83d 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.cpp
+++ b/services/surfaceflinger/Scheduler/Scheduler.cpp
@@ -349,7 +349,7 @@
}
void Scheduler::onPrimaryDisplayConfigChanged(ConnectionHandle handle, PhysicalDisplayId displayId,
- HwcConfigIndexType configId, nsecs_t vsyncPeriod) {
+ DisplayModeId configId, nsecs_t vsyncPeriod) {
{
std::lock_guard<std::mutex> lock(mFeatureStateLock);
// Cache the last reported config for primary display.
@@ -389,7 +389,7 @@
void Scheduler::onNonPrimaryDisplayConfigChanged(ConnectionHandle handle,
PhysicalDisplayId displayId,
- HwcConfigIndexType configId, nsecs_t vsyncPeriod) {
+ DisplayModeId configId, nsecs_t vsyncPeriod) {
android::EventThread* thread;
{
std::lock_guard<std::mutex> lock(mConnectionsLock);
@@ -603,7 +603,7 @@
scheduler::LayerHistory::Summary summary = mLayerHistory->summarize(systemTime());
scheduler::RefreshRateConfigs::GlobalSignals consideredSignals;
- HwcConfigIndexType newConfigId;
+ DisplayModeId newConfigId;
bool frameRateChanged;
bool frameRateOverridesChanged;
{
@@ -789,7 +789,7 @@
template <class T>
bool Scheduler::handleTimerStateChanged(T* currentState, T newState) {
- HwcConfigIndexType newConfigId;
+ DisplayModeId newConfigId;
bool refreshRateChanged = false;
bool frameRateOverridesChanged;
scheduler::RefreshRateConfigs::GlobalSignals consideredSignals;
@@ -829,7 +829,7 @@
return consideredSignals.touch;
}
-HwcConfigIndexType Scheduler::calculateRefreshRateConfigIndexType(
+DisplayModeId Scheduler::calculateRefreshRateConfigIndexType(
scheduler::RefreshRateConfigs::GlobalSignals* consideredSignals) {
ATRACE_CALL();
if (consideredSignals) *consideredSignals = {};
@@ -851,7 +851,7 @@
.getConfigId();
}
-std::optional<HwcConfigIndexType> Scheduler::getPreferredConfigId() {
+std::optional<DisplayModeId> Scheduler::getPreferredConfigId() {
std::lock_guard<std::mutex> lock(mFeatureStateLock);
// Make sure that the default config ID is first updated, before returned.
if (mFeatures.configId.has_value()) {
diff --git a/services/surfaceflinger/Scheduler/Scheduler.h b/services/surfaceflinger/Scheduler/Scheduler.h
index cae3fe7..340ca8e 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.h
+++ b/services/surfaceflinger/Scheduler/Scheduler.h
@@ -87,11 +87,10 @@
sp<EventThreadConnection> getEventConnection(ConnectionHandle);
void onHotplugReceived(ConnectionHandle, PhysicalDisplayId, bool connected);
- void onPrimaryDisplayConfigChanged(ConnectionHandle, PhysicalDisplayId,
- HwcConfigIndexType configId, nsecs_t vsyncPeriod)
- EXCLUDES(mFeatureStateLock);
+ void onPrimaryDisplayConfigChanged(ConnectionHandle, PhysicalDisplayId, DisplayModeId configId,
+ nsecs_t vsyncPeriod) EXCLUDES(mFeatureStateLock);
void onNonPrimaryDisplayConfigChanged(ConnectionHandle, PhysicalDisplayId,
- HwcConfigIndexType configId, nsecs_t vsyncPeriod);
+ DisplayModeId configId, nsecs_t vsyncPeriod);
void onScreenAcquired(ConnectionHandle);
void onScreenReleased(ConnectionHandle);
@@ -154,7 +153,7 @@
void dumpVsync(std::string&) const;
// Get the appropriate refresh for current conditions.
- std::optional<HwcConfigIndexType> getPreferredConfigId();
+ std::optional<DisplayModeId> getPreferredConfigId();
// Notifies the scheduler about a refresh rate timeline change.
void onNewVsyncPeriodChangeTimeline(const hal::VsyncPeriodChangeTimeline& timeline);
@@ -226,9 +225,9 @@
void setVsyncPeriod(nsecs_t period);
// This function checks whether individual features that are affecting the refresh rate
- // selection were initialized, prioritizes them, and calculates the HwcConfigIndexType
+ // selection were initialized, prioritizes them, and calculates the DisplayModeId
// for the suggested refresh rate.
- HwcConfigIndexType calculateRefreshRateConfigIndexType(
+ DisplayModeId calculateRefreshRateConfigIndexType(
scheduler::RefreshRateConfigs::GlobalSignals* consideredSignals = nullptr)
REQUIRES(mFeatureStateLock);
@@ -284,7 +283,7 @@
TouchState touch = TouchState::Inactive;
TimerState displayPowerTimer = TimerState::Expired;
- std::optional<HwcConfigIndexType> configId;
+ std::optional<DisplayModeId> configId;
LayerHistory::Summary contentRequirements;
bool isDisplayPowerStateNormal = true;
@@ -293,7 +292,7 @@
struct ConfigChangedParams {
ConnectionHandle handle;
PhysicalDisplayId displayId;
- HwcConfigIndexType configId;
+ DisplayModeId configId;
nsecs_t vsyncPeriod;
};
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)}};
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index b2b7cac..c90fb4a 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -414,7 +414,7 @@
};
struct ActiveConfigInfo {
- HwcConfigIndexType configId;
+ DisplayModeId configId;
Scheduler::ConfigEvent event = Scheduler::ConfigEvent::None;
bool operator!=(const ActiveConfigInfo& other) const {
@@ -918,7 +918,7 @@
// the desired refresh rate.
void changeRefreshRateLocked(const RefreshRate&, Scheduler::ConfigEvent) REQUIRES(mStateLock);
- bool isDisplayConfigAllowed(HwcConfigIndexType configId) const REQUIRES(mStateLock);
+ bool isDisplayConfigAllowed(DisplayModeId configId) const REQUIRES(mStateLock);
// Gets the fence for the previous frame.
// Must be called on the main thread.
diff --git a/services/surfaceflinger/tests/unittests/EventThreadTest.cpp b/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
index 0cd50ce..45bc29c 100644
--- a/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
+++ b/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
@@ -27,8 +27,8 @@
#include <utils/Errors.h>
#include "AsyncCallRecorder.h"
+#include "DisplayHardware/DisplayMode.h"
#include "Scheduler/EventThread.h"
-#include "Scheduler/HwcStrongTypes.h"
using namespace std::chrono_literals;
using namespace std::placeholders;
@@ -540,17 +540,17 @@
}
TEST_F(EventThreadTest, postConfigChangedPrimary) {
- mThread->onConfigChanged(INTERNAL_DISPLAY_ID, HwcConfigIndexType(7), 16666666);
+ mThread->onConfigChanged(INTERNAL_DISPLAY_ID, DisplayModeId(7), 16666666);
expectConfigChangedEventReceivedByConnection(INTERNAL_DISPLAY_ID, 7, 16666666);
}
TEST_F(EventThreadTest, postConfigChangedExternal) {
- mThread->onConfigChanged(EXTERNAL_DISPLAY_ID, HwcConfigIndexType(5), 16666666);
+ mThread->onConfigChanged(EXTERNAL_DISPLAY_ID, DisplayModeId(5), 16666666);
expectConfigChangedEventReceivedByConnection(EXTERNAL_DISPLAY_ID, 5, 16666666);
}
TEST_F(EventThreadTest, postConfigChangedPrimary64bit) {
- mThread->onConfigChanged(DISPLAY_ID_64BIT, HwcConfigIndexType(7), 16666666);
+ mThread->onConfigChanged(DISPLAY_ID_64BIT, DisplayModeId(7), 16666666);
expectConfigChangedEventReceivedByConnection(DISPLAY_ID_64BIT, 7, 16666666);
}
@@ -559,7 +559,7 @@
sp<MockEventThreadConnection> suppressConnection =
createConnection(suppressConnectionEventRecorder);
- mThread->onConfigChanged(INTERNAL_DISPLAY_ID, HwcConfigIndexType(9), 16666666);
+ mThread->onConfigChanged(INTERNAL_DISPLAY_ID, DisplayModeId(9), 16666666);
expectConfigChangedEventReceivedByConnection(INTERNAL_DISPLAY_ID, 9, 16666666);
auto args = suppressConnectionEventRecorder.waitForCall();
diff --git a/services/surfaceflinger/tests/unittests/HWComposerTest.cpp b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
index 5bab534..71986fe 100644
--- a/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
+++ b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
@@ -33,6 +33,7 @@
#include <gui/LayerMetadata.h>
#include <log/log.h>
+#include "DisplayHardware/DisplayMode.h"
#include "DisplayHardware/HWComposer.h"
#include "mock/DisplayHardware/MockComposer.h"
@@ -229,7 +230,7 @@
constraints.seamlessRequired = false;
hal::VsyncPeriodChangeTimeline timeline = {0, 0, 0};
- constexpr HwcConfigIndexType kConfigIndex(0);
+ constexpr DisplayModeId kConfigIndex(0);
const auto status =
hwc.setActiveModeWithConstraints(physicalId, kConfigIndex, constraints, &timeline);
EXPECT_EQ(NO_ERROR, status);
@@ -242,9 +243,8 @@
hwc.allocatePhysicalDisplay(hwcId, physicalId);
for (size_t configIndex = 0; configIndex < kConfigs.size(); configIndex++) {
- const auto status =
- hwc.setActiveModeWithConstraints(physicalId, HwcConfigIndexType(configIndex),
- constraints, &timeline);
+ const auto status = hwc.setActiveModeWithConstraints(physicalId, DisplayModeId(configIndex),
+ constraints, &timeline);
EXPECT_EQ(NO_ERROR, status) << "Error when switching to config " << configIndex;
}
}
diff --git a/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp b/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp
index 7024c1e..04cafbc 100644
--- a/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp
+++ b/services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp
@@ -111,14 +111,16 @@
}
RefreshRateConfigs mConfigs{{DisplayMode::Builder(0)
+ .setId(DisplayModeId(0))
.setVsyncPeriod(int32_t(LO_FPS_PERIOD))
.setConfigGroup(0)
.build(),
DisplayMode::Builder(1)
+ .setId(DisplayModeId(1))
.setVsyncPeriod(int32_t(HI_FPS_PERIOD))
.setConfigGroup(0)
.build()},
- HwcConfigIndexType(0)};
+ DisplayModeId(0)};
mock::NoOpSchedulerCallback mSchedulerCallback;
diff --git a/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp b/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp
index 27c181d..0a747ab 100644
--- a/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp
+++ b/services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp
@@ -72,13 +72,13 @@
}
// Test config IDs
- static inline const HwcConfigIndexType HWC_CONFIG_ID_60 = HwcConfigIndexType(0);
- static inline const HwcConfigIndexType HWC_CONFIG_ID_90 = HwcConfigIndexType(1);
- static inline const HwcConfigIndexType HWC_CONFIG_ID_72 = HwcConfigIndexType(2);
- static inline const HwcConfigIndexType HWC_CONFIG_ID_120 = HwcConfigIndexType(3);
- static inline const HwcConfigIndexType HWC_CONFIG_ID_30 = HwcConfigIndexType(4);
- static inline const HwcConfigIndexType HWC_CONFIG_ID_25 = HwcConfigIndexType(5);
- static inline const HwcConfigIndexType HWC_CONFIG_ID_50 = HwcConfigIndexType(6);
+ static inline const DisplayModeId HWC_CONFIG_ID_60 = DisplayModeId(0);
+ static inline const DisplayModeId HWC_CONFIG_ID_90 = DisplayModeId(1);
+ static inline const DisplayModeId HWC_CONFIG_ID_72 = DisplayModeId(2);
+ static inline const DisplayModeId HWC_CONFIG_ID_120 = DisplayModeId(3);
+ static inline const DisplayModeId HWC_CONFIG_ID_30 = DisplayModeId(4);
+ static inline const DisplayModeId HWC_CONFIG_ID_25 = DisplayModeId(5);
+ static inline const DisplayModeId HWC_CONFIG_ID_50 = DisplayModeId(6);
// Test configs
DisplayModePtr mConfig60 = createConfig(HWC_CONFIG_ID_60, 0, Fps(60.0f).getPeriodNsecs());
@@ -144,8 +144,8 @@
RefreshRate mExpected120Config = {HWC_CONFIG_ID_120, mConfig120, Fps(120),
RefreshRate::ConstructorTag(0)};
private:
- DisplayModePtr createConfig(HwcConfigIndexType configId, int32_t configGroup,
- int64_t vsyncPeriod, ui::Size resolution = ui::Size());
+ DisplayModePtr createConfig(DisplayModeId configId, int32_t configGroup, int64_t vsyncPeriod,
+ ui::Size resolution = ui::Size());
};
using Builder = DisplayMode::Builder;
@@ -162,10 +162,10 @@
ALOGD("**** Tearing down after %s.%s\n", test_info->test_case_name(), test_info->name());
}
-DisplayModePtr RefreshRateConfigsTest::createConfig(HwcConfigIndexType configId,
- int32_t configGroup, int64_t vsyncPeriod,
- ui::Size resolution) {
+DisplayModePtr RefreshRateConfigsTest::createConfig(DisplayModeId configId, int32_t configGroup,
+ int64_t vsyncPeriod, ui::Size resolution) {
return DisplayMode::Builder(hal::HWConfigId(configId.value()))
+ .setId(configId)
.setVsyncPeriod(int32_t(vsyncPeriod))
.setConfigGroup(configGroup)
.setHeight(resolution.height)
@@ -187,8 +187,7 @@
auto refreshRateConfigs =
std::make_unique<RefreshRateConfigs>(m60OnlyConfigDevice,
/*currentConfigId=*/HWC_CONFIG_ID_60);
- ASSERT_LT(refreshRateConfigs->setDisplayManagerPolicy(
- {HwcConfigIndexType(10), {Fps(60), Fps(60)}}),
+ ASSERT_LT(refreshRateConfigs->setDisplayManagerPolicy({DisplayModeId(10), {Fps(60), Fps(60)}}),
0);
ASSERT_LT(refreshRateConfigs->setDisplayManagerPolicy({HWC_CONFIG_ID_60, {Fps(20), Fps(40)}}),
0);
@@ -1334,7 +1333,7 @@
// Return the config ID from calling getBestRefreshRate() for a single layer with the
// given voteType and fps.
auto getFrameRate = [&](LayerVoteType voteType, Fps fps, bool touchActive = false,
- bool focused = true) -> HwcConfigIndexType {
+ bool focused = true) -> DisplayModeId {
layers[0].vote = voteType;
layers[0].desiredRefreshRate = fps;
layers[0].focused = focused;
@@ -1391,8 +1390,7 @@
auto layers = std::vector<LayerRequirement>{LayerRequirement{.weight = 1.0f}};
layers[0].name = "Test layer";
- const auto getIdleFrameRate = [&](LayerVoteType voteType,
- bool touchActive) -> HwcConfigIndexType {
+ const auto getIdleFrameRate = [&](LayerVoteType voteType, bool touchActive) -> DisplayModeId {
layers[0].vote = voteType;
layers[0].desiredRefreshRate = Fps(90.f);
RefreshRateConfigs::GlobalSignals consideredSignals;
diff --git a/services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp b/services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp
index 4a96fc5..ceccd81 100644
--- a/services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp
+++ b/services/surfaceflinger/tests/unittests/RefreshRateStatsTest.cpp
@@ -25,7 +25,7 @@
#include <log/log.h>
#include <thread>
-#include "Scheduler/HwcStrongTypes.h"
+#include "DisplayHardware/DisplayMode.h"
#include "Scheduler/RefreshRateConfigs.h"
#include "Scheduler/RefreshRateStats.h"
#include "mock/MockTimeStats.h"
@@ -40,8 +40,8 @@
class RefreshRateStatsTest : public testing::Test {
protected:
- static inline const auto CONFIG_ID_0 = HwcConfigIndexType(0);
- static inline const auto CONFIG_ID_1 = HwcConfigIndexType(1);
+ static inline const auto CONFIG_ID_0 = DisplayModeId(0);
+ static inline const auto CONFIG_ID_1 = DisplayModeId(1);
static inline const auto CONFIG_GROUP_0 = 0;
static constexpr int64_t VSYNC_90 = 11111111;
static constexpr int64_t VSYNC_60 = 16666667;
@@ -62,8 +62,7 @@
std::unique_ptr<RefreshRateConfigs> mRefreshRateConfigs;
std::unique_ptr<RefreshRateStats> mRefreshRateStats;
- DisplayModePtr createConfig(HwcConfigIndexType configId, int32_t configGroup,
- int64_t vsyncPeriod);
+ DisplayModePtr createConfig(DisplayModeId configId, int32_t configGroup, int64_t vsyncPeriod);
};
RefreshRateStatsTest::RefreshRateStatsTest() {
@@ -78,9 +77,10 @@
ALOGD("**** Tearing down after %s.%s\n", test_info->test_case_name(), test_info->name());
}
-DisplayModePtr RefreshRateStatsTest::createConfig(HwcConfigIndexType configId, int32_t configGroup,
+DisplayModePtr RefreshRateStatsTest::createConfig(DisplayModeId configId, int32_t configGroup,
int64_t vsyncPeriod) {
return DisplayMode::Builder(static_cast<hal::HWConfigId>(configId.value()))
+ .setId(configId)
.setVsyncPeriod(static_cast<int32_t>(vsyncPeriod))
.setConfigGroup(configGroup)
.build();
diff --git a/services/surfaceflinger/tests/unittests/SchedulerTest.cpp b/services/surfaceflinger/tests/unittests/SchedulerTest.cpp
index 757c702..e688e10 100644
--- a/services/surfaceflinger/tests/unittests/SchedulerTest.cpp
+++ b/services/surfaceflinger/tests/unittests/SchedulerTest.cpp
@@ -53,7 +53,7 @@
const scheduler::RefreshRateConfigs
mConfigs{{DisplayMode::Builder(0).setVsyncPeriod(16'666'667).setConfigGroup(0).build()},
- HwcConfigIndexType(0)};
+ DisplayModeId(0)};
mock::SchedulerCallback mSchedulerCallback;
@@ -175,7 +175,7 @@
}
TEST_F(SchedulerTest, onNonPrimaryDisplayConfigChanged_invalidParameters) {
- HwcConfigIndexType configId = HwcConfigIndexType(111);
+ DisplayModeId configId = DisplayModeId(111);
nsecs_t vsyncPeriod = 111111;
// If the handle is incorrect, the function should return before
diff --git a/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetupNewDisplayDeviceInternalTest.cpp b/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetupNewDisplayDeviceInternalTest.cpp
index cedb404..ca7c755 100644
--- a/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetupNewDisplayDeviceInternalTest.cpp
+++ b/services/surfaceflinger/tests/unittests/SurfaceFlinger_SetupNewDisplayDeviceInternalTest.cpp
@@ -264,8 +264,8 @@
EXPECT_EQ(Case::HdrSupport::HDR_DOLBY_VISION_SUPPORTED, device->hasDolbyVisionSupport());
// Note: This is not Case::Display::HWC_ACTIVE_CONFIG_ID as the ids are
// remapped, and the test only ever sets up one config. If there were an error
- // looking up the remapped index, device->getActiveConfig() would be -1 instead.
- EXPECT_EQ(0, device->getActiveConfig().value());
+ // looking up the remapped index, device->getActiveMode() would be -1 instead.
+ EXPECT_EQ(0, device->getActiveMode().value());
EXPECT_EQ(Case::PerFrameMetadataSupport::PER_FRAME_METADATA_KEYS,
device->getSupportedPerFrameMetadata());
}
diff --git a/services/surfaceflinger/tests/unittests/TestableScheduler.h b/services/surfaceflinger/tests/unittests/TestableScheduler.h
index 2192977..d3e90e3 100644
--- a/services/surfaceflinger/tests/unittests/TestableScheduler.h
+++ b/services/surfaceflinger/tests/unittests/TestableScheduler.h
@@ -91,7 +91,7 @@
}
void onNonPrimaryDisplayConfigChanged(ConnectionHandle handle, PhysicalDisplayId displayId,
- HwcConfigIndexType configId, nsecs_t vsyncPeriod) {
+ DisplayModeId configId, nsecs_t vsyncPeriod) {
return Scheduler::onNonPrimaryDisplayConfigChanged(handle, displayId, configId,
vsyncPeriod);
}
diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
index 2b8a67d..9a9eeab 100644
--- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
+++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
@@ -210,15 +210,21 @@
std::unique_ptr<EventThread> appEventThread,
std::unique_ptr<EventThread> sfEventThread,
ISchedulerCallback* callback = nullptr, bool hasMultipleConfigs = false) {
- DisplayModes configs{
- DisplayMode::Builder(0).setVsyncPeriod(16'666'667).setConfigGroup(0).build()};
+ DisplayModes configs{DisplayMode::Builder(0)
+ .setId(DisplayModeId(0))
+ .setVsyncPeriod(16'666'667)
+ .setConfigGroup(0)
+ .build()};
if (hasMultipleConfigs) {
- configs.emplace_back(
- DisplayMode::Builder(1).setVsyncPeriod(11'111'111).setConfigGroup(0).build());
+ configs.emplace_back(DisplayMode::Builder(1)
+ .setId(DisplayModeId(1))
+ .setVsyncPeriod(11'111'111)
+ .setConfigGroup(0)
+ .build());
}
- const auto currConfig = HwcConfigIndexType(0);
+ const auto currConfig = DisplayModeId(0);
mFlinger->mRefreshRateConfigs =
std::make_unique<scheduler::RefreshRateConfigs>(configs, currConfig);
const auto currFps =
diff --git a/services/surfaceflinger/tests/unittests/mock/MockEventThread.h b/services/surfaceflinger/tests/unittests/mock/MockEventThread.h
index 650d52d..40437bf 100644
--- a/services/surfaceflinger/tests/unittests/mock/MockEventThread.h
+++ b/services/surfaceflinger/tests/unittests/mock/MockEventThread.h
@@ -33,7 +33,7 @@
MOCK_METHOD0(onScreenReleased, void());
MOCK_METHOD0(onScreenAcquired, void());
MOCK_METHOD2(onHotplugReceived, void(PhysicalDisplayId, bool));
- MOCK_METHOD3(onConfigChanged, void(PhysicalDisplayId, HwcConfigIndexType, nsecs_t));
+ MOCK_METHOD3(onConfigChanged, void(PhysicalDisplayId, DisplayModeId, nsecs_t));
MOCK_METHOD2(onFrameRateOverridesChanged,
void(PhysicalDisplayId, std::vector<FrameRateOverride>));
MOCK_CONST_METHOD1(dump, void(std::string&));