dal: Allow aspect ratio mismatch for destination scaler.

H/W supports different scale factor in X & Y directions.

CRs-Fixed: 3384928
Change-Id: I4b520dcd056168b184e4cbc48e22d13f3b31bf76
diff --git a/include/display_properties.h b/include/display_properties.h
index 0b91bc5..64d3266 100644
--- a/include/display_properties.h
+++ b/include/display_properties.h
@@ -106,6 +106,7 @@
 #define DROP_SKEWED_VSYNC                    DISPLAY_PROP("drop_skewed_vsync")
 #define DISABLE_FAST_PATH                    DISPLAY_PROP("disable_fast_path")
 #define DISABLE_SYSTEM_LOAD_CHECK            DISPLAY_PROP("disable_system_load_check")
+#define ASPECT_RATIO_THRESHOLD               DISPLAY_PROP("aspect_ratio_threshold")
 // Disable microidle condition
 #define DISABLE_SINGLE_LM_SPLIT_PROP         DISPLAY_PROP("disable_single_lm_split")
 // Enable posted start dynamic
diff --git a/sdm/libs/dal/hw_device_drm.cpp b/sdm/libs/dal/hw_device_drm.cpp
index dd14528..5f04967 100644
--- a/sdm/libs/dal/hw_device_drm.cpp
+++ b/sdm/libs/dal/hw_device_drm.cpp
@@ -564,6 +564,12 @@
   std::unique_ptr<HWColorManagerDrm> hw_color_mgr(new HWColorManagerDrm());
   hw_color_mgr_ = std::move(hw_color_mgr);
 
+  int value = 0;
+  if (Debug::GetProperty(ASPECT_RATIO_THRESHOLD, &value) == kErrorNone) {
+    aspect_ratio_threshold_ = 1 + (FLOAT(value) / 100);
+    DLOGI("aspect_ratio_threshold_: %f", aspect_ratio_threshold_);
+  }
+
   return kErrorNone;
 }
 
@@ -2350,7 +2356,9 @@
   float display_aspect_ratio =
       FLOAT(display_attributes_[index].x_pixels) / FLOAT(display_attributes_[index].y_pixels);
 
-  if (display_aspect_ratio != mixer_aspect_ratio) {
+  float display_to_mixer_aspect_ratio = std::max(display_aspect_ratio, mixer_aspect_ratio) /
+                                        std::min(display_aspect_ratio, mixer_aspect_ratio);
+  if (display_to_mixer_aspect_ratio > aspect_ratio_threshold_) {
     DLOGW("Aspect ratio mismatch! input: res %dx%d display: res %dx%d", mixer_attributes.width,
           mixer_attributes.height, display_attributes_[index].x_pixels,
           display_attributes_[index].y_pixels);
diff --git a/sdm/libs/dal/hw_device_drm.h b/sdm/libs/dal/hw_device_drm.h
index ce94611..18506f3 100644
--- a/sdm/libs/dal/hw_device_drm.h
+++ b/sdm/libs/dal/hw_device_drm.h
@@ -344,6 +344,7 @@
   bool autorefresh_ = false;
   std::unique_ptr<HWColorManagerDrm> hw_color_mgr_ = {};
   bool seamless_mode_switch_ = false;
+  float aspect_ratio_threshold_ = 1.0;
 };
 
 }  // namespace sdm