From: Chaitanya Kumar Borah <chaitanya.kumar.bo...@intel.com>

User can disable the color pipeline entirely, thereby
disabling all the color hardware blocks in the pipeline.

User should set NULL as the blob id and invoke SET_COLOR_PIPELINE
property. Driver will disable all the color hardware blocks by
updating respective blob id's as NULL.

Co-developed-by: Uma Shankar <uma.shan...@intel.com>
Signed-off-by: Uma Shankar <uma.shan...@intel.com>
Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.bo...@intel.com>
---
 drivers/gpu/drm/drm_atomic_uapi.c | 50 +++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c 
b/drivers/gpu/drm/drm_atomic_uapi.c
index 20f9366865ca..259cd4f5f520 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -411,6 +411,53 @@ drm_atomic_replace_property_blob_from_id(struct drm_device 
*dev,
  * available at driver level, the driver should check for
  * the sanity of the userspace data.
  */
+static
+int drm_plane_reset_color_op_blobs(struct drm_plane *plane,
+                                  struct drm_plane_state *state,
+                                  bool *replaced)
+{
+       struct drm_device *dev = plane->dev;
+       int ret;
+       bool blob_replaced = false;
+       bool temp_replaced = false;
+
+       ret = drm_atomic_replace_property_blob_from_id(dev,
+                                                      &state->color.ctm,
+                                                      0, -1, -1,
+                                                      &blob_replaced);
+       temp_replaced |= blob_replaced;
+       if (ret)
+               goto out;
+
+       ret = drm_atomic_replace_property_blob_from_id(dev,
+                                                      
&state->color.pre_csc_lut,
+                                                      0, -1, -1,
+                                                      &blob_replaced);
+       temp_replaced |= blob_replaced;
+
+       if (ret)
+               goto out;
+
+       ret = drm_atomic_replace_property_blob_from_id(dev,
+                                                      
&state->color.post_csc_lut,
+                                                      0, -1, -1,
+                                                      &blob_replaced);
+       temp_replaced |= blob_replaced;
+
+       ret = drm_atomic_replace_property_blob_from_id(dev,
+                                                      
&state->color.private_color_op_data,
+                                                      0, -1, -1,
+                                                      &blob_replaced);
+       temp_replaced |= blob_replaced;
+
+       if (ret)
+               goto out;
+out:
+       if (!ret)
+               *replaced |= temp_replaced;
+       return ret;
+}
+
 static
 int drm_plane_replace_color_op_blobs(struct drm_plane *plane,
                                     struct drm_plane_state *state,
@@ -425,6 +472,9 @@ int drm_plane_replace_color_op_blobs(struct drm_plane 
*plane,
        bool blob_replaced = false;
        bool temp_replaced = false;
 
+       if (!color_pipeline_blob_id)
+               return drm_plane_reset_color_op_blobs(plane, state, replaced);
+
        new_blob = drm_property_lookup_blob(dev, color_pipeline_blob_id);
 
        if (!new_blob) {
-- 
2.38.1

Reply via email to