Commit 6e23dae7 authored by Mario Kleiner's avatar Mario Kleiner
Browse files

Revert "modesetting: Only use GAMMA_LUT if its size is 1024"

This reverts commit 617f591f

.

The problem described in that commit exists, but the two
preceeding commits with improvements to the servers RandR
code should avoid the mentioned problems while allowing the
use of GAMMA_LUT's instead of legacy gamma lut.

Use of legacy gamma lut's is not a good fix, because it will reduce
color output precision of gpu's with more than 1024 GAMMA_LUT
slots, e.g., AMD, ARM MALI and KOMEDA with 4096 slot luts,
and some Mediathek parts with 512 slot luts. On KOMEDA, legacy
lut's are completely unsupported by the kms driver, so gamma
correction gets disabled.

The situation is especially bad on Intel Icelake and later:
Use of legacy gamma tables will cause the kms driver to switch
to hardware legacy lut's with 256 slots, 8 bit wide, without
interpolation. This way color output precision is restricted to
8 bpc and any deep color / HDR output (10 bpc, fp16, fixed point 16)
becomes impossible. The latest Intel gen gpu's would have worse
color precision than parts which are more than 10 years old.
Signed-off-by: Mario Kleiner's avatarMario Kleiner <mario.kleiner.de@gmail.com>
parent 9124ef09
Pipeline #405321 passed with stages
in 6 minutes and 13 seconds
......@@ -2406,21 +2406,7 @@ drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_res
drmmode_crtc->use_gamma_lut =
drmmode_crtc->props[DRMMODE_CRTC_GAMMA_LUT_SIZE].prop_id &&
/* Only use GAMMA_LUT if the size is 1024.
*
* Currently, the modesetting driver always passes a sigRGBbits value of
* 10 to xf86HandleColormaps. This causes it to create a RRCrtc gamma
* ramp of 1024 elements. If DRMMODE_CRTC_GAMMA_LUT_SIZE is larger than
* 1024 (for example on Intel GEN11, where it has a value of 262145)
* then xf86RandR12CrtcSetGamma will read past the end of the RRCrtc's
* gamma ramp when trying to copy it into the larger xf86Crtc gamma
* ramp.
*
* Since the larger GEN11 gamma ramp size hasn't been tested, just
* disable it for now. This will cause the modesetting driver to disable
* the CTM property and use the legacy DRM gamma ramp rather than the
* GAMMA_LUT property. */
drmmode_crtc->props[DRMMODE_CRTC_GAMMA_LUT_SIZE].value == 1024 &&
drmmode_crtc->props[DRMMODE_CRTC_GAMMA_LUT_SIZE].value &&
xf86ReturnOptValBool(drmmode->Options, OPTION_USE_GAMMA_LUT, TRUE);
if (drmmode_crtc->use_gamma_lut &&
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment