modesetting: Enable GAMMA_LUT for lut's with up to 4096 slots.

A lut size of 4096 slots has been verified to work correctly,
as tested with amdgpu-kms. Intel Tigerlake Gen12 hw has a very
large GAMMA_LUT size of 262145 slots, but also issues with its
current GAMMA_LUT implementation, as of Linux 5.14.

Therefore we keep GAMMA_LUT off for large lut's. This currently
excludes Intel Icelake, Tigerlake and later.

This can be overriden via the "UseGammaLUT" boolean xorg.conf option
to force use of GAMMA_LUT on or off.

See following link for the Tigerlake situation:
https://gitlab.freedesktop.org/drm/intel/-/issues/3916#note_1085315

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
(cherry picked from commit 66e5a5bb12)
This commit is contained in:
Mario Kleiner 2021-10-01 07:42:01 +02:00 committed by Povilas Kanapickas
parent bc1327e6de
commit 0d0986bf3b
2 changed files with 19 additions and 6 deletions

View File

@ -2404,10 +2404,23 @@ drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_res
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, MS_LOGLEVEL_DEBUG, xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, MS_LOGLEVEL_DEBUG,
"Allocated crtc nr. %d to this screen.\n", num); "Allocated crtc nr. %d to this screen.\n", num);
drmmode_crtc->use_gamma_lut = if (drmmode_crtc->props[DRMMODE_CRTC_GAMMA_LUT_SIZE].prop_id &&
drmmode_crtc->props[DRMMODE_CRTC_GAMMA_LUT_SIZE].prop_id && drmmode_crtc->props[DRMMODE_CRTC_GAMMA_LUT_SIZE].value) {
drmmode_crtc->props[DRMMODE_CRTC_GAMMA_LUT_SIZE].value && /*
xf86ReturnOptValBool(drmmode->Options, OPTION_USE_GAMMA_LUT, TRUE); * GAMMA_LUT property supported, and so far tested to be safe to use by
* default for lut sizes up to 4096 slots. Intel Tigerlake+ has some
* issues, and a large GAMMA_LUT with 262145 slots, so keep GAMMA_LUT
* off for large lut sizes by default for now.
*/
drmmode_crtc->use_gamma_lut = drmmode_crtc->props[DRMMODE_CRTC_GAMMA_LUT_SIZE].value <= 4096;
/* Allow config override. */
drmmode_crtc->use_gamma_lut = xf86ReturnOptValBool(drmmode->Options,
OPTION_USE_GAMMA_LUT,
drmmode_crtc->use_gamma_lut);
} else {
drmmode_crtc->use_gamma_lut = FALSE;
}
if (drmmode_crtc->use_gamma_lut && if (drmmode_crtc->use_gamma_lut &&
drmmode_crtc->props[DRMMODE_CRTC_CTM].prop_id) { drmmode_crtc->props[DRMMODE_CRTC_CTM].prop_id) {

View File

@ -99,8 +99,8 @@ will assign xrandr outputs LVDS and VGA-0 to this instance of the driver.
.BI "Option \*qUseGammaLUT\*q \*q" boolean \*q .BI "Option \*qUseGammaLUT\*q \*q" boolean \*q
Enable or disable use of the GAMMA_LUT property, when available. Enable or disable use of the GAMMA_LUT property, when available.
When enabled, this option allows the driver to use gamma ramps with more When enabled, this option allows the driver to use gamma ramps with more
entries, if supported by the kernel. entries, if supported by the kernel. By default, GAMMA_LUT will be used for
Default: on. kms drivers which are known to be safe for use of GAMMA_LUT.
.TP .TP
.SH "SEE ALSO" .SH "SEE ALSO"
@xservername@(@appmansuffix@), @xconfigfile@(@filemansuffix@), Xserver(@appmansuffix@), @xservername@(@appmansuffix@), @xconfigfile@(@filemansuffix@), Xserver(@appmansuffix@),