backend/drm: default COLOR_RANGE to full instead of limited

When color_range is WLR_COLOR_RANGE_NONE (unspecified by the
compositor), default to full range instead of limited. NVIDIA's
DRM driver defaults to limited range (16-235) when COLOR_RANGE is
not explicitly set, causing a washed-out desktop on Wayland.

This is a no-op on Intel and AMD (which ignore COLOR_RANGE for
RGB per the DRM spec) but fixes NVIDIA's washed-out output.

An equivalent fix has been submitted to KWin:
https://invent.kde.org/plasma/kwin/-/merge_requests/9075

See https://github.com/NVIDIA/open-gpu-kernel-modules/discussions/1105
This commit is contained in:
Diego Gomez 2026-04-11 09:47:54 -04:00
parent 35c35530a3
commit 80e0c28588

View file

@ -511,10 +511,13 @@ static void set_color_encoding_and_range(struct atomic *atom,
uint32_t color_range;
switch (range) {
case WLR_COLOR_RANGE_NONE:
case WLR_COLOR_RANGE_LIMITED:
color_range = WLR_DRM_COLOR_YCBCR_LIMITED_RANGE;
break;
case WLR_COLOR_RANGE_NONE:
// Workaround for the proprietary NVIDIA driver, which defaults to
// limited range when COLOR_RANGE is not set, even for RGB content.
// See https://github.com/NVIDIA/open-gpu-kernel-modules/discussions/1105
case WLR_COLOR_RANGE_FULL:
color_range = WLR_DRM_COLOR_YCBCR_FULL_RANGE;
break;