diff options
author | Leo Li (Sunpeng) <sunpeng.li@amd.com> | 2018-06-15 17:05:52 -0400 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2018-06-26 17:35:56 +0200 |
commit | 606075b852d8e1d40ed0a56b5a928abdd7012f95 (patch) | |
tree | 5dc5de8a7de208bf94b40e686dde94c9f131e69a | |
parent | e0a4c0e2155a5fcfad747ea5bddcf5b4b551f151 (diff) |
Also compose LUT when setting legacy gamma
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 Kernel has no support support for non-
legacy color. In which case, we fall back to legacy gamma.
v2: Remove per-CRTC check for color management support.
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
-rw-r--r-- | src/drmmode_display.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 2623273..fa0c05b 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -1245,9 +1245,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 no support for non-legacy gamma */ + if (!drmmode_cm_enabled(drmmode_crtc->drmmode)) { + 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 |