[PATCH] drm/amd/display: disable CRTC degamma LUT for DCN401

Pillai, Aurabindo Aurabindo.Pillai at amd.com
Wed Jun 25 15:13:33 UTC 2025


[AMD Official Use Only - AMD Internal Distribution Only]

Thanks Melissa! We will add the patch to next week's testing.

--

Regards,
Jay
________________________________
From: Wentland, Harry <Harry.Wentland at amd.com>
Sent: Wednesday, June 25, 2025 10:00 AM
To: Melissa Wen <mwen at igalia.com>; Li, Sun peng (Leo) <Sunpeng.Li at amd.com>; Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>; airlied at gmail.com <airlied at gmail.com>; simona at ffwll.ch <simona at ffwll.ch>
Cc: Pillai, Aurabindo <Aurabindo.Pillai at amd.com>; Michel Daenzer <michel.daenzer at mailbox.org>; Xaver Hugl <xaver.hugl at gmail.com>; amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>; dri-devel at lists.freedesktop.org <dri-devel at lists.freedesktop.org>; kernel-dev at igalia.com <kernel-dev at igalia.com>
Subject: Re: [PATCH] drm/amd/display: disable CRTC degamma LUT for DCN401



On 2025-05-11 17:22, Melissa Wen wrote:
> In DCN401 pre-blending degamma LUT isn't affecting cursor as in previous
> DCN version. As this is not the behavior close to what is expected for
> CRTC degamma LUT, disable CRTC degamma LUT property in this HW.
>
> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/4176
> Signed-off-by: Melissa Wen <mwen at igalia.com>

Sorry, Melissa, for the late response. I though we dealt with
this patch already but it looks like we didn't.

Thanks for the fix and your detailed explanation.

Reviewed-by: Harry Wentland <harry.wentland at amd.com>

Harry

> ---
>
> Hi,
>
> When enabling HDR on KDE, it takes the first CRTC 1D LUT available and
> apply a color transformation (Gamma 2.2 -> PQ). AMD driver usually
> advertises a CRTC degamma LUT as the first CRTC 1D LUT, but it's
> actually applied pre-blending. In previous HW version, it seems to work
> fine because the 1D LUT was applied to cursor too, but DCN401 presents a
> different behavior and the 1D LUT isn't affecting the hardware cursor.
>
> To address the wrong gamma on cursor with HDR (see the link), I came up
> with this patch that disables CRTC degamma LUT in this hw, since it
> presents a different behavior than others. With this KDE sees CRTC
> regamma LUT as the first post-blending 1D LUT available. This is
> actually more consistent with AMD color pipeline. It was tested by the
> reporter, since I don't have the HW available for local testing and
> debugging.
>
> Melissa
>
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c    | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
> index e8bdd7f0c460..db157b38f862 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
> @@ -737,7 +737,16 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
>         * support programmable degamma anywhere.
>         */
>        is_dcn = dm->adev->dm.dc->caps.color.dpp.dcn_arch;
> -     drm_crtc_enable_color_mgmt(&acrtc->base, is_dcn ? MAX_COLOR_LUT_ENTRIES : 0,
> +     /* 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,
>                                   true, MAX_COLOR_LUT_ENTRIES);
>
>        drm_mode_crtc_set_gamma_size(&acrtc->base, MAX_COLOR_LEGACY_LUT_ENTRIES);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20250625/b9359f26/attachment.htm>


More information about the amd-gfx mailing list