From: Harry Wentland <[email protected]>

DRM core builds the curve_1d_type enum property with only the supported
TF values, so any curve_1d_type that reaches atomic_commit is already
guaranteed to be in the supported set.  The per-colorop type field is
immutable — it cannot change between the loop that finds colorop_state
and the if block that uses it, so re-checking colorop->type there is
dead code.

Remove the redundant checks:
- colorop->type == DRM_COLOROP_1D_CURVE in the shaper TF if block
- colorop->type == DRM_COLOROP_1D_LUT in the shaper LUT if block
- colorop->type == DRM_COLOROP_1D_CURVE in the blend TF if block
- colorop->type == DRM_COLOROP_1D_LUT in the blend LUT if block
- BIT(colorop_state->curve_1d_type) & supported_blnd_tfs in the blend
  TF if block (already guaranteed by the loop filter)
- BIT(colorop_state->curve_1d_type) & supported_blnd_tfs in the blend
  LUT if block (nonsensical: a 1D_LUT colorop has no curve_1d_type)

No functional change.

Assisted-by: Copilot:claude-opus-4.8

Reviewed-by: Alex Hung <[email protected]>
Signed-off-by: Harry Wentland <[email protected]>
Signed-off-by: George Zhang <[email protected]>
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c    | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
index a9a741c21663..724b7729f342 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
@@ -1660,7 +1660,7 @@ __set_dm_plane_colorop_shaper(struct drm_plane_state 
*plane_state,
                }
        }

-       if (colorop_state && !colorop_state->bypass && colorop->type == 
DRM_COLOROP_1D_CURVE) {
+       if (colorop_state && !colorop_state->bypass) {
                drm_dbg(dev, "Shaper TF colorop with ID: %d\n", 
colorop->base.id);
                tf->type = TF_TYPE_DISTRIBUTED_POINTS;
                tf->tf = default_tf = 
amdgpu_colorop_tf_to_dc_tf(colorop_state->curve_1d_type);
@@ -1687,7 +1687,7 @@ __set_dm_plane_colorop_shaper(struct drm_plane_state 
*plane_state,
                }
        }

-       if (colorop_state && !colorop_state->bypass && colorop->type == 
DRM_COLOROP_1D_LUT) {
+       if (colorop_state && !colorop_state->bypass) {
                drm_dbg(dev, "Shaper LUT colorop with ID: %d\n", 
colorop->base.id);
                tf->type = TF_TYPE_DISTRIBUTED_POINTS;
                tf->tf = default_tf;
@@ -1833,8 +1833,7 @@ __set_dm_plane_colorop_blend(struct drm_plane_state 
*plane_state,
                }
        }

-       if (colorop_state && !colorop_state->bypass && colorop->type == 
DRM_COLOROP_1D_CURVE &&
-           (BIT(colorop_state->curve_1d_type) & amdgpu_dm_supported_blnd_tfs)) 
{
+       if (colorop_state && !colorop_state->bypass) {
                drm_dbg(dev, "Blend TF colorop with ID: %d\n", 
colorop->base.id);
                tf->type = TF_TYPE_DISTRIBUTED_POINTS;
                tf->tf = default_tf = 
amdgpu_colorop_tf_to_dc_tf(colorop_state->curve_1d_type);
@@ -1859,8 +1858,7 @@ __set_dm_plane_colorop_blend(struct drm_plane_state 
*plane_state,
                }
        }

-       if (colorop_state && !colorop_state->bypass && colorop->type == 
DRM_COLOROP_1D_LUT &&
-           (BIT(colorop_state->curve_1d_type) & amdgpu_dm_supported_blnd_tfs)) 
{
+       if (colorop_state && !colorop_state->bypass) {
                drm_dbg(dev, "Blend LUT colorop with ID: %d\n", 
colorop->base.id);
                tf->type = TF_TYPE_DISTRIBUTED_POINTS;
                tf->tf = default_tf;
--
2.54.0

Reply via email to