#1111886 xserver-xorg-core: using modesetting on 32-bit leads to black screen if CTM is availiable

Package:
xserver-xorg-core
Source:
xserver-xorg-core
Description:
Xorg X server - core server
Submitter:
Michael Krylov
Date:
2025-08-23 10:21:03 UTC
Severity:
normal
Tags:
#1111886#5
Date:
2025-08-23 10:18:05 UTC
From:
To:
Package: xserver-xorg-core
Version: 2:21.1.16-1.3
Severity: important
Tags: upstream patch
X-Debbugs-Cc: debian-arm@lists.debian.org
User: debian-qa@lists.debian.org
Usertags: i386
User: debian-arm@lists.debian.org
Usertags: armel

Dear Maintainer,

I've found a bug that appears when Xorg starts with modesetting driver
if the color transformation matrix is enabled in the kernel, but only on
32-bit architectures.

It goes like that: if all the conditions mentioned above met, Xorg
starts with completely black screen, though it works good, the only
problem is that the user is unable to see anything.

Drilling into the Xorg code I've managed to find the error that leads to
the bug: it is in the hw/xfree86/drivers/modesetting/drmmode_display.c:

	static const struct drm_color_ctm ctm_identity
		1UL << 32, 0, 0,
		0, 1UL << 32, 0,
		0, 0, 1UL << 32
	} };

On 32-bit architectures this overflows and instead of the value 2^32 it
becomes 0, so the "identity" matrix that is default transformation
matrix and should not change any colors becomes effectively a zero
matrix, rendering all the colors to black.

This was fixed in the commit
https://gitlab.freedesktop.org/xorg/xserver/-/commit/69beb656539d5f9f82ec501f42245d0f43b709d8
that unfortunately didn't make it to Trixie, so I'm kindly asking you to
add this patch to the current Xorg version in Debian Stable.

For the time being I also want to mention that this problem is
circumventable with a command

  xrandr --output LVDS-1 --set CTM '1,0,0,0,1,0,0,0,1'

if it is added to the xorg startup scripts (you should, of course,
replace LVDS-1 with the output you have; but this is clunky).

Thanks in advance!