@@ -736,7 +736,7 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
736736{
737737 struct amdgpu_crtc * acrtc = NULL ;
738738 struct drm_plane * cursor_plane ;
739- bool is_dcn ;
739+ bool has_degamma ;
740740 int res = - ENOMEM ;
741741
742742 cursor_plane = kzalloc (sizeof (* cursor_plane ), GFP_KERNEL );
@@ -775,20 +775,18 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
775775
776776 dm -> adev -> mode_info .crtcs [crtc_index ] = acrtc ;
777777
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.
780782 */
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 ,
792790 true, MAX_COLOR_LUT_ENTRIES );
793791
794792 drm_mode_crtc_set_gamma_size (& acrtc -> base , MAX_COLOR_LEGACY_LUT_ENTRIES );
0 commit comments