modesetting: Only use GAMMA_LUT if its size is 1024

GAMMA_LUT sizes other than 1024 cause a crash during startup if the memcpy()
calls in xf86RandR12CrtcSetGamma() read past the end of the legacy X11 /
XVidMode gamma ramp.

This is a problem on Intel ICL / GEN11 platforms because they report a GAMMA_LUT
size of 262145. Since it's not clear that the modesetting driver will generate a
proper gamma ramp at that size even if xf86RandR12CrtcSetGamma() is fixed, just
disable use of GAMMA_LUT for sizes other than 1024 for now. This will cause the
modesetting driver to disable the CTM property and fall back to the legacy gamma

Signed-off-by: Aaron Plattner <>
Fixes: xorg/xserver#1193
Tested-by: Mark Herbert
5 jobs for gamma-lut-1024 in 4 minutes and 22 seconds (queued for 9 seconds)