gl-renderer: Add gl_force_import_yuv_fallback test quirk

Forcing the fallback paths for YUV formats. This will allow us
to test these paths on CI now that llvmpipe supports all tested
formats natively.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
This commit is contained in:
Robert Mader 2025-05-12 17:24:36 +02:00 committed by Pekka Paalanen
parent 65e3a7324a
commit d24caf5f32
2 changed files with 12 additions and 1 deletions

View file

@ -205,6 +205,8 @@ struct weston_testsuite_quirks {
bool gl_force_full_upload;
/** Ensure GL shadow fb is used, and always repaint it fully. */
bool gl_force_full_redraw_of_shadow_fb;
/** Force GL-renderer to use the internal YUV->RGB shader */
bool gl_force_import_yuv_fallback;
/** Required enum weston_capability bit mask, otherwise skip run. */
uint32_t required_capabilities;
};

View file

@ -3441,8 +3441,11 @@ import_dmabuf(struct gl_renderer *gr,
{
EGLImageKHR egl_image;
struct gl_buffer_state *gb;
const struct pixel_format_info *info;
const struct weston_testsuite_quirks *quirks;
if (!pixel_format_get_info(dmabuf->attributes.format))
info = pixel_format_get_info(dmabuf->attributes.format);
if (!info)
return NULL;
gb = zalloc(sizeof(*gb));
@ -3453,6 +3456,11 @@ import_dmabuf(struct gl_renderer *gr,
pixman_region32_init(&gb->texture_damage);
wl_list_init(&gb->destroy_listener.link);
quirks = &gr->compositor->test_data.test_quirks;
if (quirks->gl_force_import_yuv_fallback &&
info->color_model == COLOR_MODEL_YUV)
goto import_yuv;
egl_image = import_simple_dmabuf(gr, &dmabuf->attributes);
if (egl_image != EGL_NO_IMAGE_KHR) {
const GLint swizzles[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
@ -3478,6 +3486,7 @@ import_dmabuf(struct gl_renderer *gr,
return gb;
}
import_yuv:
if (!import_yuv_dmabuf(gr, gb, &dmabuf->attributes)) {
destroy_buffer_state(gb);
return NULL;