Merge "sdm: Align system properties with customer documentation"
diff --git a/sdm/include/utils/debug.h b/sdm/include/utils/debug.h
index 2a9cc72..5b08129 100644
--- a/sdm/include/utils/debug.h
+++ b/sdm/include/utils/debug.h
@@ -33,6 +33,7 @@
 #include <stdint.h>
 #include <core/sdm_types.h>
 #include <core/debug_interface.h>
+#include <core/display_interface.h>
 
 #define DLOG(tag, method, format, ...) Debug::Get()->method(tag, __CLASS__ "::%s: " format, \
                                                             __FUNCTION__, ##__VA_ARGS__)
@@ -65,7 +66,8 @@
   static bool IsRotatorDownScaleDisabled();
   static bool IsDecimationDisabled();
   static bool IsPartialUpdateEnabled();
-  static int GetMaxPipesPerMixer();
+  static int GetMaxPipesPerMixer(DisplayType display_type);
+  static bool IsVideoModeEnabled();
 
  private:
   Debug();
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 73b26f5..fcc69bb 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -93,7 +93,7 @@
     HWResourceInfo hw_resource_info = HWResourceInfo();
     hw_info_intf_->GetHWResourceInfo(&hw_resource_info);
     int max_mixer_stages = hw_resource_info.num_blending_stages;
-    int property_value = Debug::GetMaxPipesPerMixer();
+    int property_value = Debug::GetMaxPipesPerMixer(display_type_);
     if (property_value >= 0) {
       max_mixer_stages = MIN(UINT32(property_value), hw_resource_info.num_blending_stages);
     }
diff --git a/sdm/libs/core/display_primary.cpp b/sdm/libs/core/display_primary.cpp
index 4c4a1dd..1b0a552 100644
--- a/sdm/libs/core/display_primary.cpp
+++ b/sdm/libs/core/display_primary.cpp
@@ -65,6 +65,14 @@
     hw_primary_intf_->SetIdleTimeoutMs(Debug::GetIdleTimeoutMs());
   }
 
+  if (hw_panel_info_.mode == kModeCommand && Debug::IsVideoModeEnabled()) {
+    error = hw_primary_intf_->SetDisplayMode(kModeVideo);
+    if (error != kErrorNone) {
+      DLOGW("Retaining current display mode. Current = %d, Requested = %d", hw_panel_info_.mode,
+            kModeVideo);
+    }
+  }
+
   return error;
 }
 
@@ -198,7 +206,7 @@
   HWDisplayMode hw_display_mode = kModeDefault;
 
   if (state_ != kStateOn) {
-    DLOGW("Invalid display state (%d). Panel must be on.", state_);
+    DLOGW("Invalid display state = %d. Panel must be on.", state_);
     return kErrorNotSupported;
   }
 
@@ -210,19 +218,19 @@
     hw_display_mode = kModeCommand;
     break;
   default:
-    DLOGW("Invalid panel mode parameters. Requested (%d)", mode);
+    DLOGW("Invalid panel mode parameters. Requested = %d", mode);
     return kErrorParameters;
   }
 
   if (hw_display_mode == hw_panel_info_.mode) {
-    DLOGW("Same display mode requested. Current (%d) Requested (%d)", hw_panel_info_.mode,
+    DLOGW("Same display mode requested. Current = %d, Requested = %d", hw_panel_info_.mode,
           hw_display_mode);
     return kErrorNone;
   }
 
   error = hw_primary_intf_->SetDisplayMode(hw_display_mode);
   if (error != kErrorNone) {
-    DLOGW("Retaining current display mode. Current (%d), Requested (%d)", hw_panel_info_.mode,
+    DLOGW("Retaining current display mode. Current = %d, Requested = %d", hw_panel_info_.mode,
           hw_display_mode);
     return error;
   }
diff --git a/sdm/libs/hwc/hwc_display.cpp b/sdm/libs/hwc/hwc_display.cpp
index 8dce4c4..348d54d 100644
--- a/sdm/libs/hwc/hwc_display.cpp
+++ b/sdm/libs/hwc/hwc_display.cpp
@@ -58,9 +58,9 @@
     return -EINVAL;
   }
 
-  char property[PROPERTY_VALUE_MAX];
-  if (property_get("debug.egl.swapinterval", property, "1") > 0) {
-    if (atoi(property) == 0) {
+  int property_swap_interval = 1;
+  if (HWCDebugHandler::Get()->GetProperty("debug.egl.swapinterval", &property_swap_interval)) {
+    if (property_swap_interval == 0) {
       swap_interval_zero_ = true;
     }
   }
diff --git a/sdm/libs/hwc/hwc_display_external.cpp b/sdm/libs/hwc/hwc_display_external.cpp
index 4987def..c3a07e7 100644
--- a/sdm/libs/hwc/hwc_display_external.cpp
+++ b/sdm/libs/hwc/hwc_display_external.cpp
@@ -59,8 +59,9 @@
 
   hwc_display_external->GetPanelResolution(&external_width, &external_height);
 
-  if (property_get("sys.hwc.mdp_downscale_enabled", property, "false") &&
-      !strcmp(property, "true")) {
+  int downscale_enabled = 0;
+  HWCDebugHandler::Get()->GetProperty("sdm.debug.sde_downscale_enabled", &downscale_enabled);
+  if (downscale_enabled == 1) {
     uint32_t primary_area = primary_width * primary_height;
     uint32_t external_area = external_width * external_height;
 
@@ -150,11 +151,11 @@
   }
 
   // Read user defined width and height ratio
-  char property[PROPERTY_VALUE_MAX];
-  property_get("persist.sys.actionsafe.width", property, "0");
-  float width_ratio = FLOAT(atoi(property)) / 100.0f;
-  property_get("persist.sys.actionsafe.height", property, "0");
-  float height_ratio = FLOAT(atoi(property)) / 100.0f;
+  int width = 0, height = 0;
+  HWCDebugHandler::Get()->GetProperty("sdm.external_action_safe_width", &width);
+  float width_ratio = FLOAT(width) / 100.0f;
+  HWCDebugHandler::Get()->GetProperty("sdm.external_action_safe_height", &height);
+  float height_ratio = FLOAT(height) / 100.0f;
 
   if (width_ratio == 0.0f ||  height_ratio == 0.0f) {
     return;
diff --git a/sdm/libs/hwc/hwc_display_primary.cpp b/sdm/libs/hwc/hwc_display_primary.cpp
index 2ea7681..60505b0 100644
--- a/sdm/libs/hwc/hwc_display_primary.cpp
+++ b/sdm/libs/hwc/hwc_display_primary.cpp
@@ -59,10 +59,12 @@
   }
 
   hwc_display_primary->GetPanelResolution(&primary_width, &primary_height);
-  if (property_get("debug.hwc.fbsize", property, NULL) > 0) {
-    char *yptr = strcasestr(property, "x");
-    primary_width = atoi(property);
-    primary_height = atoi(yptr + 1);
+  int width = 0, height = 0;
+  HWCDebugHandler::Get()->GetProperty("sdm.fb_size_width", &width);
+  HWCDebugHandler::Get()->GetProperty("sdm.fb_size_height", &height);
+  if (width > 0 && height > 0) {
+    primary_width = width;
+    primary_height = height;
   }
 
   status = hwc_display_primary->SetFrameBufferResolution(primary_width, primary_height);
diff --git a/sdm/libs/utils/debug.cpp b/sdm/libs/utils/debug.cpp
index abcfac1..cd7533b 100644
--- a/sdm/libs/utils/debug.cpp
+++ b/sdm/libs/utils/debug.cpp
@@ -40,7 +40,7 @@
 
 uint32_t Debug::GetSimulationFlag() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("debug.hwc.simulate", &value);
+  debug_.debug_handler_->GetProperty("sdm.composition_simulation", &value);
 
   return value;
 }
@@ -54,14 +54,14 @@
 
 uint32_t Debug::GetIdleTimeoutMs() {
   int value = IDLE_TIMEOUT_DEFAULT_MS;
-  debug_.debug_handler_->GetProperty("debug.mdpcomp.idletime", &value);
+  debug_.debug_handler_->GetProperty("sdm.idle_time", &value);
 
   return value;
 }
 
 bool Debug::IsRotatorDownScaleDisabled() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.disable_rotator_downscaling", &value);
+  debug_.debug_handler_->GetProperty("sdm.debug.rotator_downscale", &value);
 
   return (value == 1);
 }
@@ -75,17 +75,36 @@
 
 bool Debug::IsPartialUpdateEnabled() {
   int value = 0;
-  debug_.debug_handler_->GetProperty("sdm.hwc.partial_update", &value);
+  debug_.debug_handler_->GetProperty("sdm.partial_update", &value);
 
   return (value == 1);
 }
 
-int Debug::GetMaxPipesPerMixer() {
+int Debug::GetMaxPipesPerMixer(DisplayType display_type) {
   int value = -1;
-  debug_.debug_handler_->GetProperty("persist.hwc.mdpcomp.maxpermixer", &value);
+  switch (display_type) {
+  case kPrimary:
+    debug_.debug_handler_->GetProperty("sdm.primary.mixer_stages", &value);
+    break;
+  case kHDMI:
+    debug_.debug_handler_->GetProperty("sdm.external.mixer_stages", &value);
+    break;
+  case kVirtual:
+    debug_.debug_handler_->GetProperty("sdm.virtual.mixer_stages", &value);
+    break;
+  default:
+    break;
+  }
 
   return value;
 }
 
+bool Debug::IsVideoModeEnabled() {
+  int value = 0;
+  debug_.debug_handler_->GetProperty("sdm.video_mode_panel", &value);
+
+  return (value == 1);
+}
+
 }  // namespace sdm