Merge "sdm/hwc: add display indices property for client id init"
diff --git a/include/display_properties.h b/include/display_properties.h
index 7448784..8f5b7df 100644
--- a/include/display_properties.h
+++ b/include/display_properties.h
@@ -115,6 +115,9 @@
 #define PREFER_MULTIRECT_PROP                DISPLAY_PROP("prefer_multirect")
 #define DROP_SKEWED_VSYNC                    DISPLAY_PROP("drop_skewed_vsync")
 #define DISABLE_FAST_PATH                    DISPLAY_PROP("disable_fast_path")
+#define BUILTIN_BASEID_AND_SIZE_PROP         DISPLAY_PROP("builtin_baseid_and_size")
+#define PLUGGABLE_BASEID_AND_SIZE_PROP       DISPLAY_PROP("pluggable_baseid_and_size")
+#define VIRTUAL_BASEID_AND_SIZE_PROP         DISPLAY_PROP("virtual_baseid_and_size")
 
 #define ZERO_SWAP_INTERVAL                   "vendor.debug.egl.swapinterval"
 
diff --git a/sdm/libs/hwc2/Android.mk b/sdm/libs/hwc2/Android.mk
index a9052e0..9e11411 100644
--- a/sdm/libs/hwc2/Android.mk
+++ b/sdm/libs/hwc2/Android.mk
@@ -80,6 +80,10 @@
 LOCAL_SHARED_LIBRARIES        += vendor.display.config@1.8
 endif
 
+ifeq ($(TARGET_BOARD_AUTO), true)
+LOCAL_CFLAGS                  += -DCONFIG_BASEID_FROM_PROP
+endif
+
 LOCAL_SRC_FILES               := hwc_session.cpp \
                                  hwc_session_services.cpp \
                                  hwc_display.cpp \
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index a02a1fd..8529a47 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -169,6 +169,29 @@
 
   InitDisplaySlots();
 
+#if defined(DISPLAY_CONFIG_1_2) && defined(CONFIG_BASEID_FROM_PROP)
+  char indices[kPropertyMax];
+  uint32_t index_start, index_size;
+  if (Debug::Get()->GetProperty(BUILTIN_BASEID_AND_SIZE_PROP, indices) == kErrorNone) {
+    if (std::sscanf(indices, "%d,%d", &index_start, &index_size) == 2) {
+      setDisplayIndex(IDisplayConfig::DisplayTypeExt::DISPLAY_BUILTIN,
+               index_start, index_size);
+    }
+  }
+  if (Debug::Get()->GetProperty(PLUGGABLE_BASEID_AND_SIZE_PROP, indices) == kErrorNone) {
+    if (std::sscanf(indices, "%d,%d", &index_start, &index_size) == 2) {
+      setDisplayIndex(IDisplayConfig::DisplayTypeExt::DISPLAY_PLUGGABLE,
+               index_start, index_size);
+    }
+  }
+  if (Debug::Get()->GetProperty(VIRTUAL_BASEID_AND_SIZE_PROP, indices) == kErrorNone) {
+    if (std::sscanf(indices, "%d,%d", &index_start, &index_size) == 2) {
+      setDisplayIndex(IDisplayConfig::DisplayTypeExt::DISPLAY_VIRTUAL,
+               index_start, index_size);
+    }
+  }
+#endif
+
   // Start QService and connect to it.
   qService::QService::init();
   android::sp<qService::IQService> iqservice = android::interface_cast<qService::IQService>(