<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Calibri;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - AMD Internal Distribution Only]<br>
</p>
<br>
<div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks Melissa! We will add the patch to next week's testing.</div>
<div id="Signature">
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
--</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Jay<br>
</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Wentland, Harry <Harry.Wentland@amd.com><br>
<b>Sent:</b> Wednesday, June 25, 2025 10:00 AM<br>
<b>To:</b> Melissa Wen <mwen@igalia.com>; Li, Sun peng (Leo) <Sunpeng.Li@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; airlied@gmail.com <airlied@gmail.com>; simona@ffwll.ch <simona@ffwll.ch><br>
<b>Cc:</b> Pillai, Aurabindo <Aurabindo.Pillai@amd.com>; Michel Daenzer <michel.daenzer@mailbox.org>; Xaver Hugl <xaver.hugl@gmail.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; dri-devel@lists.freedesktop.org <dri-devel@lists.freedesktop.org>;
 kernel-dev@igalia.com <kernel-dev@igalia.com><br>
<b>Subject:</b> Re: [PATCH] drm/amd/display: disable CRTC degamma LUT for DCN401</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText"><br>
<br>
On 2025-05-11 17:22, Melissa Wen wrote:<br>
> In DCN401 pre-blending degamma LUT isn't affecting cursor as in previous<br>
> DCN version. As this is not the behavior close to what is expected for<br>
> CRTC degamma LUT, disable CRTC degamma LUT property in this HW.<br>
> <br>
> Link: <a href="https://gitlab.freedesktop.org/drm/amd/-/issues/4176">https://gitlab.freedesktop.org/drm/amd/-/issues/4176</a><br>
> Signed-off-by: Melissa Wen <mwen@igalia.com><br>
<br>
Sorry, Melissa, for the late response. I though we dealt with<br>
this patch already but it looks like we didn't.<br>
<br>
Thanks for the fix and your detailed explanation.<br>
<br>
Reviewed-by: Harry Wentland <harry.wentland@amd.com><br>
<br>
Harry<br>
<br>
> ---<br>
> <br>
> Hi,<br>
> <br>
> When enabling HDR on KDE, it takes the first CRTC 1D LUT available and<br>
> apply a color transformation (Gamma 2.2 -> PQ). AMD driver usually<br>
> advertises a CRTC degamma LUT as the first CRTC 1D LUT, but it's<br>
> actually applied pre-blending. In previous HW version, it seems to work<br>
> fine because the 1D LUT was applied to cursor too, but DCN401 presents a<br>
> different behavior and the 1D LUT isn't affecting the hardware cursor.<br>
> <br>
> To address the wrong gamma on cursor with HDR (see the link), I came up<br>
> with this patch that disables CRTC degamma LUT in this hw, since it<br>
> presents a different behavior than others. With this KDE sees CRTC<br>
> regamma LUT as the first post-blending 1D LUT available. This is<br>
> actually more consistent with AMD color pipeline. It was tested by the<br>
> reporter, since I don't have the HW available for local testing and<br>
> debugging.<br>
> <br>
> Melissa<br>
> <br>
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c    | 11 ++++++++++-<br>
>  1 file changed, 10 insertions(+), 1 deletion(-)<br>
> <br>
> 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<br>
> index e8bdd7f0c460..db157b38f862 100644<br>
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c<br>
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c<br>
> @@ -737,7 +737,16 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,<br>
>         * support programmable degamma anywhere.<br>
>         */<br>
>        is_dcn = dm->adev->dm.dc->caps.color.dpp.dcn_arch;<br>
> -     drm_crtc_enable_color_mgmt(&acrtc->base, is_dcn ? MAX_COLOR_LUT_ENTRIES : 0,<br>
> +     /* Dont't enable DRM CRTC degamma property for DCN401 since the<br>
> +      * pre-blending degamma LUT doesn't apply to cursor, and therefore<br>
> +      * can't work similar to a post-blending degamma LUT as in other hw<br>
> +      * versions.<br>
> +      * TODO: revisit it once KMS plane color API is merged.<br>
> +      */<br>
> +     drm_crtc_enable_color_mgmt(&acrtc->base,<br>
> +                                (is_dcn &&<br>
> +                                 dm->adev->dm.dc->ctx->dce_version != DCN_VERSION_4_01) ?<br>
> +                                  MAX_COLOR_LUT_ENTRIES : 0,<br>
>                                   true, MAX_COLOR_LUT_ENTRIES);<br>
>  <br>
>        drm_mode_crtc_set_gamma_size(&acrtc->base, MAX_COLOR_LEGACY_LUT_ENTRIES);<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>