Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Disable CRTC degamma when color pipeline is enabled

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

authored by

Alex Hung and committed by
Simon Ser
18a4127e 0c8025e6

+12 -14
+12 -14
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
··· 736 736 { 737 737 struct amdgpu_crtc *acrtc = NULL; 738 738 struct drm_plane *cursor_plane; 739 - bool is_dcn; 739 + bool has_degamma; 740 740 int res = -ENOMEM; 741 741 742 742 cursor_plane = kzalloc(sizeof(*cursor_plane), GFP_KERNEL); ··· 775 775 776 776 dm->adev->mode_info.crtcs[crtc_index] = acrtc; 777 777 778 - /* Don't enable DRM CRTC degamma property for DCE since it doesn't 779 - * support programmable degamma anywhere. 778 + /* Don't enable DRM CRTC degamma property for 779 + * 1. Degamma is replaced by color pipeline. 780 + * 2. DCE since it doesn't support programmable degamma anywhere. 781 + * 3. DCN401 since pre-blending degamma LUT doesn't apply to cursor. 780 782 */ 781 - is_dcn = dm->adev->dm.dc->caps.color.dpp.dcn_arch; 782 - /* Dont't enable DRM CRTC degamma property for DCN401 since the 783 - * pre-blending degamma LUT doesn't apply to cursor, and therefore 784 - * can't work similar to a post-blending degamma LUT as in other hw 785 - * versions. 786 - * TODO: revisit it once KMS plane color API is merged. 787 - */ 788 - drm_crtc_enable_color_mgmt(&acrtc->base, 789 - (is_dcn && 790 - dm->adev->dm.dc->ctx->dce_version != DCN_VERSION_4_01) ? 791 - MAX_COLOR_LUT_ENTRIES : 0, 783 + if (plane->color_pipeline_property) 784 + has_degamma = false; 785 + else 786 + has_degamma = dm->adev->dm.dc->caps.color.dpp.dcn_arch && 787 + dm->adev->dm.dc->ctx->dce_version != DCN_VERSION_4_01; 788 + 789 + drm_crtc_enable_color_mgmt(&acrtc->base, has_degamma ? MAX_COLOR_LUT_ENTRIES : 0, 792 790 true, MAX_COLOR_LUT_ENTRIES); 793 791 794 792 drm_mode_crtc_set_gamma_size(&acrtc->base, MAX_COLOR_LEGACY_LUT_ENTRIES);