surfaceflinger: update for IComposer changes

The new IComposer introduces IComposerClient to manage resources and
replaces most state changing functions by a "command buffer" to batch
calls.

Test: builds and boots
Change-Id: Idd1060f83fab28330e7119ff0f5a5bda5429811a
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp
index dd909aa..10b0acf 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp
@@ -286,6 +286,9 @@
 {
     if (connected == Connection::Connected) {
         if (!display->isConnected()) {
+#ifndef BYPASS_IHWC
+            mComposer->setClientTargetSlotCount(display->getId());
+#endif
             display->loadConfigs();
             display->setConnected(true);
         }
@@ -650,7 +653,7 @@
             &numElements, layerIds.data(), types.data());
 #else
     std::vector<Hwc2::Layer> layerIds;
-    std::vector<Hwc2::IComposer::Composition> types;
+    std::vector<Hwc2::IComposerClient::Composition> types;
     auto intError = mDevice.mComposer->getChangedCompositionTypes(mId,
             layerIds, types);
     uint32_t numElements = layerIds.size();
@@ -805,8 +808,8 @@
     int32_t intError = mDevice.mGetDisplayType(mDevice.mHwcDevice, mId,
             &intType);
 #else
-    Hwc2::IComposer::DisplayType intType =
-        Hwc2::IComposer::DisplayType::INVALID;
+    Hwc2::IComposerClient::DisplayType intType =
+        Hwc2::IComposerClient::DisplayType::INVALID;
     auto intError = mDevice.mComposer->getDisplayType(mId, intType);
 #endif
     auto error = static_cast<Error>(intError);
@@ -970,7 +973,7 @@
 #else
     auto intError = mDevice.mComposer->setClientTarget(mId, target, fenceFd,
             static_cast<Hwc2::Dataspace>(dataspace),
-            std::vector<Hwc2::IComposer::Rect>());
+            std::vector<Hwc2::IComposerClient::Rect>());
 #endif
     return static_cast<Error>(intError);
 }
@@ -1020,7 +1023,7 @@
     auto intMode = static_cast<int32_t>(mode);
     int32_t intError = mDevice.mSetPowerMode(mDevice.mHwcDevice, mId, intMode);
 #else
-    auto intMode = static_cast<Hwc2::IComposer::PowerMode>(mode);
+    auto intMode = static_cast<Hwc2::IComposerClient::PowerMode>(mode);
     auto intError = mDevice.mComposer->setPowerMode(mId, intMode);
 #endif
     return static_cast<Error>(intError);
@@ -1033,7 +1036,7 @@
     int32_t intError = mDevice.mSetVsyncEnabled(mDevice.mHwcDevice, mId,
             intEnabled);
 #else
-    auto intEnabled = static_cast<Hwc2::IComposer::Vsync>(enabled);
+    auto intEnabled = static_cast<Hwc2::IComposerClient::Vsync>(enabled);
     auto intError = mDevice.mComposer->setVsyncEnabled(mId, intEnabled);
 #endif
     return static_cast<Error>(intError);
@@ -1070,7 +1073,7 @@
             configId, static_cast<int32_t>(attribute), &value);
 #else
     auto intError = mDevice.mComposer->getDisplayAttribute(mId,
-            configId, static_cast<Hwc2::IComposer::Attribute>(attribute),
+            configId, static_cast<Hwc2::IComposerClient::Attribute>(attribute),
             value);
 #endif
     auto error = static_cast<Error>(intError);
@@ -1221,7 +1224,7 @@
                 mDisplayId, mId, {0, nullptr});
 #else
         intError = mDevice.mComposer->setLayerSurfaceDamage(mDisplayId,
-                mId, std::vector<Hwc2::IComposer::Rect>());
+                mId, std::vector<Hwc2::IComposerClient::Rect>());
 #endif
     } else {
         size_t rectCount = 0;
@@ -1230,7 +1233,7 @@
 #ifdef BYPASS_IHWC
         std::vector<hwc_rect_t> hwcRects;
 #else
-        std::vector<Hwc2::IComposer::Rect> hwcRects;
+        std::vector<Hwc2::IComposerClient::Rect> hwcRects;
 #endif
         for (size_t rect = 0; rect < rectCount; ++rect) {
             hwcRects.push_back({rectArray[rect].left, rectArray[rect].top,
@@ -1260,7 +1263,7 @@
     int32_t intError = mDevice.mSetLayerBlendMode(mDevice.mHwcDevice,
             mDisplayId, mId, intMode);
 #else
-    auto intMode = static_cast<Hwc2::IComposer::BlendMode>(mode);
+    auto intMode = static_cast<Hwc2::IComposerClient::BlendMode>(mode);
     auto intError = mDevice.mComposer->setLayerBlendMode(mDisplayId,
             mId, intMode);
 #endif
@@ -1273,7 +1276,7 @@
     int32_t intError = mDevice.mSetLayerColor(mDevice.mHwcDevice, mDisplayId,
             mId, color);
 #else
-    Hwc2::IComposer::Color hwcColor{color.r, color.g, color.b, color.a};
+    Hwc2::IComposerClient::Color hwcColor{color.r, color.g, color.b, color.a};
     auto intError = mDevice.mComposer->setLayerColor(mDisplayId,
             mId, hwcColor);
 #endif
@@ -1287,7 +1290,7 @@
     int32_t intError = mDevice.mSetLayerCompositionType(mDevice.mHwcDevice,
             mDisplayId, mId, intType);
 #else
-    auto intType = static_cast<Hwc2::IComposer::Composition>(type);
+    auto intType = static_cast<Hwc2::IComposerClient::Composition>(type);
     auto intError = mDevice.mComposer->setLayerCompositionType(mDisplayId,
             mId, intType);
 #endif
@@ -1315,7 +1318,7 @@
     int32_t intError = mDevice.mSetLayerDisplayFrame(mDevice.mHwcDevice,
             mDisplayId, mId, hwcRect);
 #else
-    Hwc2::IComposer::Rect hwcRect{frame.left, frame.top,
+    Hwc2::IComposerClient::Rect hwcRect{frame.left, frame.top,
         frame.right, frame.bottom};
     auto intError = mDevice.mComposer->setLayerDisplayFrame(mDisplayId,
             mId, hwcRect);
@@ -1359,7 +1362,7 @@
     int32_t intError = mDevice.mSetLayerSourceCrop(mDevice.mHwcDevice,
             mDisplayId, mId, hwcRect);
 #else
-    Hwc2::IComposer::FRect hwcRect{
+    Hwc2::IComposerClient::FRect hwcRect{
         crop.left, crop.top, crop.right, crop.bottom};
     auto intError = mDevice.mComposer->setLayerSourceCrop(mDisplayId,
             mId, hwcRect);
@@ -1389,7 +1392,7 @@
 #ifdef BYPASS_IHWC
     std::vector<hwc_rect_t> hwcRects;
 #else
-    std::vector<Hwc2::IComposer::Rect> hwcRects;
+    std::vector<Hwc2::IComposerClient::Rect> hwcRects;
 #endif
     for (size_t rect = 0; rect < rectCount; ++rect) {
         hwcRects.push_back({rectArray[rect].left, rectArray[rect].top,