SF: Rename HwcConfigIndexType to DisplayModeId
Bug: 159590486
Bug: 176148651
Test: atest libsurfaceflinger_unittest
Change-Id: Ie177b213bb7a8ab9f67a51d2b5cf27d8fd97b780
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&));