SF: Remove display config functions from HWC2

HWC2 is unnecessary stateful stopgap between HWComposer and
ComposerHal. In this CL the following functions are removed from HWC2
  * getActiveConfig
  * getActiveConfigIndex
  * getDisplayVsyncPeriod

and ComposerHal is called directly from HWComposer. This way display
configs are stored only in HWComposer.

Additionally HWC2::Display::Config is renamed to DisplayMode and
it's extracted in its own file.

From the perspective of SurfaceFlinger this CL is not modifying
behaviour.

Bug: 159590486
Bug: 175678215
Test: atest libsurfaceflinger_unittest
Change-Id: I8cb450209adf038d891cff00d1c2690c8e6d94f7
diff --git a/services/surfaceflinger/tests/unittests/HWComposerTest.cpp b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
index bc1e88a..5bab534 100644
--- a/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
+++ b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp
@@ -190,10 +190,10 @@
                 .WillRepeatedly(DoAll(SetArgPointee<3>(1), Return(V2_1::Error::NONE)));
     }
 
-    void testSetActiveConfigWithConstraintsCommon(bool isVsyncPeriodSwitchSupported);
+    void testSetActiveModeWithConstraintsCommon(bool isVsyncPeriodSwitchSupported);
 };
 
-void HWComposerConfigsTest::testSetActiveConfigWithConstraintsCommon(
+void HWComposerConfigsTest::testSetActiveModeWithConstraintsCommon(
         bool isVsyncPeriodSwitchSupported) {
     EXPECT_CALL(*mHal, getMaxVirtualDisplayCount()).WillOnce(Return(0));
     EXPECT_CALL(*mHal, getCapabilities()).WillOnce(Return(std::vector<hal::Capability>{}));
@@ -229,9 +229,9 @@
     constraints.seamlessRequired = false;
 
     hal::VsyncPeriodChangeTimeline timeline = {0, 0, 0};
-    constexpr size_t kConfigIndex = 0;
+    constexpr HwcConfigIndexType kConfigIndex(0);
     const auto status =
-            hwc.setActiveConfigWithConstraints(physicalId, kConfigIndex, constraints, &timeline);
+            hwc.setActiveModeWithConstraints(physicalId, kConfigIndex, constraints, &timeline);
     EXPECT_EQ(NO_ERROR, status);
 
     const std::vector<Config> kConfigs{7, 8, 9, 10, 11};
@@ -243,17 +243,18 @@
 
     for (size_t configIndex = 0; configIndex < kConfigs.size(); configIndex++) {
         const auto status =
-                hwc.setActiveConfigWithConstraints(physicalId, configIndex, constraints, &timeline);
+                hwc.setActiveModeWithConstraints(physicalId, HwcConfigIndexType(configIndex),
+                                                 constraints, &timeline);
         EXPECT_EQ(NO_ERROR, status) << "Error when switching to config " << configIndex;
     }
 }
 
-TEST_F(HWComposerConfigsTest, setActiveConfigWithConstraintsWithVsyncSwitchingSupported) {
-    testSetActiveConfigWithConstraintsCommon(/*supported=*/true);
+TEST_F(HWComposerConfigsTest, setActiveModeWithConstraintsWithVsyncSwitchingSupported) {
+    testSetActiveModeWithConstraintsCommon(/*supported=*/true);
 }
 
-TEST_F(HWComposerConfigsTest, setActiveConfigWithConstraintsWithVsyncSwitchingNotSupported) {
-    testSetActiveConfigWithConstraintsCommon(/*supported=*/false);
+TEST_F(HWComposerConfigsTest, setActiveModeWithConstraintsWithVsyncSwitchingNotSupported) {
+    testSetActiveModeWithConstraintsCommon(/*supported=*/false);
 }
 
 } // namespace