drm/amd/display: disable CRTC degamma LUT for DCN401
Subsystems (3)
PATCH 1/1 drm/amd/display: disable CRTC degamma LUT for DCN401
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.
---
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(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +10 -1
@@ -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 );
Signature · 1 line
2.47.2
Quoted 6 lines · Melissa Wen
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.
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.
Harry
Quoted 46 lines
---
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(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +10
-1@@ -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 );
Pillai, Aurabindo
Reviewed-by Harry Wentland[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 <[email protected]>
Sent: Wednesday, June 25, 2025 10:00 AM
To: Melissa Wen <[email protected]>; Li, Sun peng (Leo) <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Cc: Pillai, Aurabindo <[email protected]>; Michel Daenzer <[email protected]>; Xaver Hugl <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH] drm/amd/display: disable CRTC degamma LUT for DCN401
Quoted 6 lines · Melissa Wen
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.
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.
Harry
Quoted 46 lines
---
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(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +10
-1@@ -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 );