render/egl: Always use BT.709 hint for YUV

Always set the BT.709 hint in an attempt to get the gles2 renderer to
consistently use this color encoding when converting YUV to RGB.  In
addition to being consistent across drivers, this is consistent with DRM
so should avoid color shifts when enabling/disabling direct scanout.
This commit is contained in:
David Turner 2025-05-08 10:49:02 +01:00
parent ddb4193009
commit ebf24c2bda

View file

@ -745,7 +745,7 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
}
unsigned int atti = 0;
EGLint attribs[50];
EGLint attribs[52];
attribs[atti++] = EGL_WIDTH;
attribs[atti++] = attributes->width;
attribs[atti++] = EGL_HEIGHT;
@ -803,6 +803,13 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
}
}
// Always convert YUV to RGB using BT.709 color encoding. This is to
// attempt to be consistent across GL drivers, and also to be
// consistent with DRM scanout so there's no color-shift when direct
// scanout is enabled/disabled.
attribs[atti++] = EGL_YUV_COLOR_SPACE_HINT_EXT;
attribs[atti++] = EGL_ITU_REC709_EXT;
// Our clients don't expect our usage to trash the buffer contents
attribs[atti++] = EGL_IMAGE_PRESERVED_KHR;
attribs[atti++] = EGL_TRUE;