]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display: Disable CRTC degamma when color pipeline is enabled
authorAlex Hung <alex.hung@amd.com>
Sat, 15 Nov 2025 00:02:14 +0000 (17:02 -0700)
committerSimon Ser <contact@emersion.fr>
Wed, 26 Nov 2025 22:09:44 +0000 (23:09 +0100)
The degamma is to be handled by Color pipeline API.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Simon Ser <contact@emersion.fr>
Link: https://patch.msgid.link/20251115000237.3561250-50-alex.hung@amd.com
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c

index 38f9ea313dcbb52423c30fb531652d2f80bbb94f..697e232acebfb4e848551f626b8680f09e3df43a 100644 (file)
@@ -736,7 +736,7 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
 {
        struct amdgpu_crtc *acrtc = NULL;
        struct drm_plane *cursor_plane;
-       bool is_dcn;
+       bool has_degamma;
        int res = -ENOMEM;
 
        cursor_plane = kzalloc(sizeof(*cursor_plane), GFP_KERNEL);
@@ -775,20 +775,18 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
 
        dm->adev->mode_info.crtcs[crtc_index] = acrtc;
 
-       /* Don't enable DRM CRTC degamma property for DCE since it doesn't
-        * support programmable degamma anywhere.
+       /* Don't enable DRM CRTC degamma property for
+        * 1. Degamma is replaced by color pipeline.
+        * 2. DCE since it doesn't support programmable degamma anywhere.
+        * 3. DCN401 since pre-blending degamma LUT doesn't apply to cursor.
         */
-       is_dcn = dm->adev->dm.dc->caps.color.dpp.dcn_arch;
-       /* Dont't enable DRM CRTC degamma property for DCN401 since the
-        * pre-blending degamma LUT doesn't apply to cursor, and therefore
-        * can't work similar to a post-blending degamma LUT as in other hw
-        * versions.
-        * TODO: revisit it once KMS plane color API is merged.
-        */
-       drm_crtc_enable_color_mgmt(&acrtc->base,
-                                  (is_dcn &&
-                                   dm->adev->dm.dc->ctx->dce_version != DCN_VERSION_4_01) ?
-                                    MAX_COLOR_LUT_ENTRIES : 0,
+       if (plane->color_pipeline_property)
+               has_degamma = false;
+       else
+               has_degamma = dm->adev->dm.dc->caps.color.dpp.dcn_arch &&
+                             dm->adev->dm.dc->ctx->dce_version != DCN_VERSION_4_01;
+
+       drm_crtc_enable_color_mgmt(&acrtc->base, has_degamma ? MAX_COLOR_LUT_ENTRIES : 0,
                                   true, MAX_COLOR_LUT_ENTRIES);
 
        drm_mode_crtc_set_gamma_size(&acrtc->base, MAX_COLOR_LEGACY_LUT_ENTRIES);