backend/drm/atomic: Always use BT.709 encoding for YUV

When we overlay/scanout non-RGB planes we were relying on the default
DRM color encoding, which could vary per DRM device.  We want this to be
consistent across devices and with YUV conversion done by renderers, so
change this to always use BT.709 encoding (if the property is
available).  I've chosen BT.709 because it should be correct for HD
video, which is probably most common.
This commit is contained in:
David Turner 2025-05-08 09:53:24 +01:00
parent 2420bfef0b
commit 5234e30578
3 changed files with 22 additions and 0 deletions

View file

@ -63,6 +63,18 @@ struct wlr_drm_plane_props {
uint32_t hotspot_x;
uint32_t hotspot_y;
uint32_t in_fence_fd;
uint32_t color_encoding; // Not guaranteed to exist
};
/*
* The encoding and range enums are defined in the kernel but not
* exposed in public headers.
*/
enum drm_color_encoding {
DRM_COLOR_YCBCR_BT601,
DRM_COLOR_YCBCR_BT709,
DRM_COLOR_YCBCR_BT2020,
};
bool get_drm_connector_props(int fd, uint32_t id,