Skip to content

Commit a4fa235

Browse files
Alex Hungalexdeucher
authored andcommitted
drm/amd/display: Enable DEGAMMA and reject COLOR_PIPELINE+DEGAMMA_LUT
[WHAT] Create DEGAMMA properties even if color pipeline is enabled, and enforce the mutual exclusion in atomic check by rejecting any commit that attempts to enable both COLOR_PIPELINE on the plane and DEGAMMA_LUT on the CRTC simultaneously. Fixes: 18a4127 ("drm/amd/display: Disable CRTC degamma when color pipeline is enabled") Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4963 Reviewed-by: Melissa Wen <mwen@igalia.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 196a6aa)
1 parent c28b3ec commit a4fa235

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -765,15 +765,15 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
765765
dm->adev->mode_info.crtcs[crtc_index] = acrtc;
766766

767767
/* Don't enable DRM CRTC degamma property for
768-
* 1. Degamma is replaced by color pipeline.
769-
* 2. DCE since it doesn't support programmable degamma anywhere.
770-
* 3. DCN401 since pre-blending degamma LUT doesn't apply to cursor.
768+
* 1. DCE since it doesn't support programmable degamma anywhere.
769+
* 2. DCN401 since pre-blending degamma LUT doesn't apply to cursor.
770+
* Note: DEGAMMA properties are created even if the primary plane has the
771+
* COLOR_PIPELINE property. User space can use either the DEGAMMA properties
772+
* or the COLOR_PIPELINE property. An atomic commit which attempts to enable
773+
* both is rejected.
771774
*/
772-
if (plane->color_pipeline_property)
773-
has_degamma = false;
774-
else
775-
has_degamma = dm->adev->dm.dc->caps.color.dpp.dcn_arch &&
776-
dm->adev->dm.dc->ctx->dce_version != DCN_VERSION_4_01;
775+
has_degamma = dm->adev->dm.dc->caps.color.dpp.dcn_arch &&
776+
dm->adev->dm.dc->ctx->dce_version != DCN_VERSION_4_01;
777777

778778
drm_crtc_enable_color_mgmt(&acrtc->base, has_degamma ? MAX_COLOR_LUT_ENTRIES : 0,
779779
true, MAX_COLOR_LUT_ENTRIES);

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,14 @@ static int amdgpu_dm_plane_atomic_check(struct drm_plane *plane,
12561256
if (ret)
12571257
return ret;
12581258

1259+
/* Reject commits that attempt to use both COLOR_PIPELINE and CRTC DEGAMMA_LUT */
1260+
if (new_plane_state->color_pipeline && new_crtc_state->degamma_lut) {
1261+
drm_dbg_atomic(plane->dev,
1262+
"[PLANE:%d:%s] COLOR_PIPELINE and CRTC DEGAMMA_LUT cannot be enabled simultaneously\n",
1263+
plane->base.id, plane->name);
1264+
return -EINVAL;
1265+
}
1266+
12591267
ret = amdgpu_dm_plane_fill_dc_scaling_info(adev, new_plane_state, &scaling_info);
12601268
if (ret)
12611269
return ret;

0 commit comments

Comments
 (0)