[PATCH xf86-video-amdgpu 7/7] Also compose LUT when setting legacy gamma
sunpeng.li at amd.com
sunpeng.li at amd.com
Fri Jun 1 16:03:37 UTC 2018
From: "Leo (Sunpeng) Li" <sunpeng.li at amd.com>
We compose the two LUTs when pushing non-legacy gamma changes, and the
same needs to be done when setting legacy gamma.
To do so, we just call push_cm_prop() on the gamma LUT. It will compose
the LUTs for us, and fall back to using legacy LUT (upscaled to non-
legacy size) if non-legacy is unavailable.
It's also possible that the CRTC has no support support for non-legacy
color. In which case, we fall back to legacy gamma.
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li at amd.com>
---
src/drmmode_display.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index b4e1d57..d31f975 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1240,9 +1240,21 @@ drmmode_crtc_gamma_do_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green,
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(crtc->scrn);
+ int ret;
+
+ /* Use legacy if the CRTC does not support non-legacy gamma */
+ if (!drmmode_crtc_cm_enabled(drmmode_crtc)) {
+ drmModeCrtcSetGamma(pAMDGPUEnt->fd,
+ drmmode_crtc->mode_crtc->crtc_id,
+ size, red, green, blue);
+ return;
+ }
- drmModeCrtcSetGamma(pAMDGPUEnt->fd, drmmode_crtc->mode_crtc->crtc_id,
- size, red, green, blue);
+ ret = drmmode_crtc_push_cm_prop(crtc, CM_GAMMA_LUT);
+ if (ret)
+ xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
+ "Setting Gamma LUT failed with errno %d\n",
+ ret);
}
Bool
--
2.7.4
More information about the amd-gfx
mailing list