[PATCH] drm/amd/display: enable cursor degamma for DCN3+ DRM legacy gamma

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For DRM legacy gamma, AMD display manager applies implicit sRGB degamma
using a pre-defined sRGB transfer function. It works fine for DCN2
family where degamma ROM and custom curves go to the same color block.
But, on DCN3+, degamma is split into two blocks: degamma ROM for
pre-defined TFs and `gamma correction` for user/custom curves and
degamma ROM settings doesn't apply to cursor plane. To get DRM legacy
gamma working as expected, enable cursor degamma ROM for implict sRGB
degamma on HW with this configuration.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2803
Fixes: 96b020e2163f ("drm/amd/display: check attr flag before set cursor degamma on DCN3+")
Signed-off-by: Melissa Wen <mwen@xxxxxxxxxx>
---

Hi,

It seems that the previous color fix for atomic API brought out a
difference in behavior of degamma color blocks between DCN2 and DCN3, as
reported in the link.

AFAIU, settings of the `degamma ROM` block for pre-defined TF doesn't
apply to cursor plane. So, whenever we wants degamma ROM for cursor
plane, we have to explicitly enable it using the attribute flag. This is
the case when we do an implicit sRGB degamma to match DRM legacy gamma
requirements.

Another option would be changing the legacy gamma approach to use the
`gamma correction` block where the pre-defined sRGB curve is calculated
by AMD color module. I think that keeping degamma ROM usage on legacy
gamma is better for performance, this is why I opted for this patch. But
let me know if changing legacy gamma implementation in amdgpu_dm_color
is better for consistence or any other thing to take into account.

Thanks,

Melissa

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
index 8eeca160d434..2aa7efd798e2 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
@@ -1269,6 +1269,13 @@ void amdgpu_dm_plane_handle_cursor_update(struct drm_plane *plane,
 	attributes.rotation_angle    = 0;
 	attributes.attribute_flags.value = 0;
 
+	/* Enable cursor degamma ROM on DCN3+ for implicit sRGB degamma in DRM
+	 * legacy gamma setup.
+	 */
+	if (crtc_state->cm_is_degamma_srgb &&
+	    adev->dm.dc->caps.color.dpp.gamma_corr)
+		attributes.attribute_flags.bits.ENABLE_CURSOR_DEGAMMA = 1;
+
 	attributes.pitch = afb->base.pitches[0] / afb->base.format->cpp[0];
 
 	if (crtc_state->stream) {
-- 
2.40.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux