sdm: Add support for Smart DMA 2.5

Add support for Smart DMA 2.5 featuring improved multi-rect fetch
widths.

CRs-Fixed: 2189991
Change-Id: Ie278d6d1ee455f5a77a0776faf19f66a702ff67b
diff --git a/libdrmutils/drm_interface.h b/libdrmutils/drm_interface.h
index 0839a9d..979736f 100644
--- a/libdrmutils/drm_interface.h
+++ b/libdrmutils/drm_interface.h
@@ -389,6 +389,7 @@
 enum struct SmartDMARevision {
   V1,
   V2,
+  V2p5
 };
 
 /* Per CRTC Resource Info*/
@@ -440,6 +441,7 @@
   // FourCC format enum and modifier
   std::vector<std::pair<uint32_t, uint64_t>> formats_supported;
   uint32_t max_linewidth;
+  uint32_t max_scaler_linewidth;
   uint32_t max_upscale;
   uint32_t max_downscale;
   uint32_t max_horizontal_deci;
diff --git a/sdm/include/private/hw_info_types.h b/sdm/include/private/hw_info_types.h
index bf8a9a9..ab68986 100644
--- a/sdm/include/private/hw_info_types.h
+++ b/sdm/include/private/hw_info_types.h
@@ -176,6 +176,7 @@
 enum SmartDMARevision {
   V1,
   V2,
+  V2p5
 };
 
 struct HWResourceInfo {
@@ -198,6 +199,7 @@
   uint64_t max_bandwidth_high = 0;
   uint32_t max_mixer_width = 2048;
   uint32_t max_pipe_width = 2048;
+  uint32_t max_scaler_pipe_width = 2560;
   uint32_t max_cursor_size = 0;
   uint64_t max_pipe_bw =  0;
   uint32_t max_sde_clk = 0;
diff --git a/sdm/libs/core/drm/hw_info_drm.cpp b/sdm/libs/core/drm/hw_info_drm.cpp
index e9abcd2..d176f66 100644
--- a/sdm/libs/core/drm/hw_info_drm.cpp
+++ b/sdm/libs/core/drm/hw_info_drm.cpp
@@ -283,8 +283,9 @@
   hw_resource->has_qseed3 = (info.qseed_version == sde_drm::QSEEDVersion::V3);
   hw_resource->num_blending_stages = info.max_blend_stages;
   hw_resource->num_solidfill_stages = info.max_solidfill_stages;
-  hw_resource->smart_dma_rev = (info.smart_dma_rev == sde_drm::SmartDMARevision::V2) ?
-    SmartDMARevision::V2 : SmartDMARevision::V1;
+  hw_resource->smart_dma_rev = (info.smart_dma_rev == sde_drm::SmartDMARevision::V2p5) ?
+    SmartDMARevision::V2p5 : ((info.smart_dma_rev == sde_drm::SmartDMARevision::V2) ?
+    SmartDMARevision::V2 : SmartDMARevision::V1);
   hw_resource->ib_fudge_factor = info.ib_fudge_factor;
   hw_resource->hw_dest_scalar_info.prefill_lines = info.dest_scale_prefill_lines;
   hw_resource->undersized_prefill_lines = info.undersized_prefill_lines;
@@ -409,6 +410,7 @@
 void HWInfoDRM::PopulatePipeCaps(const sde_drm::DRMPlaneTypeInfo &info,
                                     HWResourceInfo *hw_resource) {
   hw_resource->max_pipe_width = info.max_linewidth;
+  hw_resource->max_scaler_pipe_width = info.max_scaler_linewidth;
   hw_resource->max_scale_down = info.max_downscale;
   hw_resource->max_scale_up = info.max_upscale;
   hw_resource->has_decimation = info.max_horizontal_deci > 1 && info.max_vertical_deci > 1;
diff --git a/sdm/libs/core/resource_default.cpp b/sdm/libs/core/resource_default.cpp
index f8909f4..cce2cec 100644
--- a/sdm/libs/core/resource_default.cpp
+++ b/sdm/libs/core/resource_default.cpp
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014-2016, 2018, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted
 * provided that the following conditions are met:
@@ -465,11 +465,16 @@
                                         HWLayerConfig *layer_config) {
   HWPipeInfo *left_pipe = &layer_config->left_pipe;
   HWPipeInfo *right_pipe = &layer_config->right_pipe;
-  float src_width = src_rect.right - src_rect.left;
-  float dst_width = dst_rect.right - dst_rect.left;
+  uint32_t max_pipe_width = hw_res_info_.max_pipe_width;
+  uint32_t src_width = (uint32_t)(src_rect.right - src_rect.left);
+  uint32_t dst_width = (uint32_t)(dst_rect.right - dst_rect.left);
+
+  if (src_width != dst_width) {
+    max_pipe_width =  hw_res_info_.max_scaler_pipe_width;
+  }
 
   // Layer cannot qualify for SrcSplit if source or destination width exceeds max pipe width.
-  if ((src_width > hw_res_info_.max_pipe_width) || (dst_width > hw_res_info_.max_pipe_width)) {
+  if ((src_width > max_pipe_width) || (dst_width > max_pipe_width)) {
     SplitRect(src_rect, dst_rect, &left_pipe->src_roi, &left_pipe->dst_roi, &right_pipe->src_roi,
               &right_pipe->dst_roi);
     left_pipe->valid = true;