sdm: drm: add interlaced content support

Add interlaced content support for drm

Change-Id: Iee47e866f1284d07649330d7d0c977ca8e4757d5
CRs-fixed: 2018756
diff --git a/libdrmutils/drm_interface.h b/libdrmutils/drm_interface.h
index 399972b..bf46200 100644
--- a/libdrmutils/drm_interface.h
+++ b/libdrmutils/drm_interface.h
@@ -92,6 +92,12 @@
    */
   PLANE_SET_V_DECIMATION,
   /*
+   * Op: Sets source config flags
+   * Arg: uint32_t - Plane ID
+   *      uint32_t - flags to enable or disable a specific op. E.g. deinterlacing
+   */
+  PLANE_SET_SRC_CONFIG,
+  /*
    * Op: Sets frame buffer ID for plane. Set together with CRTC.
    * Arg: uint32_t - Plane ID
    *      uint32_t - Framebuffer ID
@@ -169,6 +175,10 @@
   COVERAGE = 3,
 };
 
+enum struct DRMSrcConfig {
+  DEINTERLACE = 0,
+};
+
 /* Display type to identify a suitable connector */
 enum struct DRMDisplayType {
   PERIPHERAL,
diff --git a/sdm/libs/core/drm/hw_device_drm.cpp b/sdm/libs/core/drm/hw_device_drm.cpp
index 4bbd0f6..3ffc9c0 100644
--- a/sdm/libs/core/drm/hw_device_drm.cpp
+++ b/sdm/libs/core/drm/hw_device_drm.cpp
@@ -73,6 +73,7 @@
 using sde_drm::DRMPPFeatureInfo;
 using sde_drm::DRMRect;
 using sde_drm::DRMBlendType;
+using sde_drm::DRMSrcConfig;
 using sde_drm::DRMOps;
 using sde_drm::DRMTopology;
 
@@ -426,6 +427,9 @@
                                   pipe_info->horizontal_decimation);
         drm_atomic_intf_->Perform(DRMOps::PLANE_SET_V_DECIMATION, pipe_id,
                                   pipe_info->vertical_decimation);
+        uint32_t config = 0;
+        SetSrcConfig(layer.input_buffer, &config);
+        drm_atomic_intf_->Perform(DRMOps::PLANE_SET_SRC_CONFIG, pipe_id, config);;
         drm_atomic_intf_->Perform(DRMOps::PLANE_SET_FB_ID, pipe_id, input_buffer->fb_id);
         drm_atomic_intf_->Perform(DRMOps::PLANE_SET_CRTC, pipe_id, token_.crtc_id);
         if (!validate && input_buffer->acquire_fence_fd >= 0) {
@@ -566,6 +570,13 @@
   }
 }
 
+
+void HWDeviceDRM::SetSrcConfig(const LayerBuffer &input_buffer, uint32_t *config) {
+  if (input_buffer.flags.interlace) {
+    *config |= (0x01 << UINT32(DRMSrcConfig::DEINTERLACE));
+  }
+}
+
 void HWDeviceDRM::SetRect(const LayerRect &source, DRMRect *target) {
   target->left = UINT32(source.left);
   target->top = UINT32(source.top);
diff --git a/sdm/libs/core/drm/hw_device_drm.h b/sdm/libs/core/drm/hw_device_drm.h
index 31b8250..034826c 100644
--- a/sdm/libs/core/drm/hw_device_drm.h
+++ b/sdm/libs/core/drm/hw_device_drm.h
@@ -111,6 +111,7 @@
   void UpdateMixerAttributes();
   void InitializeConfigs();
   void SetBlending(const LayerBlending &source, sde_drm::DRMBlendType *target);
+  void SetSrcConfig(const LayerBuffer &input_buffer, uint32_t *config);
   void SetRect(const LayerRect &source, sde_drm::DRMRect *target);
   DisplayError DefaultCommit(HWLayers *hw_layers);
   DisplayError AtomicCommit(HWLayers *hw_layers);