llvmpipe: Enable support for multiplanar formats

Stop supporting formats that would cause us to use
lp_build_fetch_subsampled_rgba_aos() for YCbCr->RGB conversion
and always go through the slower emulated paths using
mulitple sampler views.

This not only allows dmabuf imports with EXT_image_dma_buf_import
to succeed for common YCbCr formats, but also ensures hints like
EGL_YUV_COLOR_SPACE_HINT_EXT and EGL_SAMPLE_RANGE_HINT_EXT are
honored.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34775>
This commit is contained in:
Robert Mader 2025-05-01 15:55:18 +02:00 committed by Marge Bot
parent bf126d08ae
commit 7b68e1da91
2 changed files with 10 additions and 10 deletions

View file

@ -678,17 +678,21 @@ llvmpipe_is_format_supported(struct pipe_screen *_screen,
target == PIPE_BUFFER)
return false;
if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_YUV) {
if (format == PIPE_FORMAT_NV12)
return true;
if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_YUV)
return false;
}
/* Prevent PIPE_FORMAT_YUYV and variants from using incomplete fast paths */
/* Prevent YUV formats from taking incomplete fast paths in
* st_get_sampler_view_format.
*/
if (format == PIPE_FORMAT_R8G8_R8B8_UNORM ||
format == PIPE_FORMAT_R8B8_R8G8_UNORM ||
format == PIPE_FORMAT_G8R8_B8R8_UNORM ||
format == PIPE_FORMAT_B8R8_G8R8_UNORM)
format == PIPE_FORMAT_B8R8_G8R8_UNORM ||
format == PIPE_FORMAT_R8_G8B8_420_UNORM ||
format == PIPE_FORMAT_R8_B8G8_420_UNORM ||
format == PIPE_FORMAT_R8_G8B8_422_UNORM ||
format == PIPE_FORMAT_R8_G8_B8_420_UNORM ||
format == PIPE_FORMAT_R8_B8_G8_420_UNORM)
return false;
/*

View file

@ -715,10 +715,6 @@ llvmpipe_resource_from_handle(struct pipe_screen *_screen,
/* no miplevels */
assert(template->last_level == 0);
/* Multiplanar surfaces are not supported */
if (whandle->plane > 0)
return NULL;
lpr = CALLOC_STRUCT(llvmpipe_resource);
if (!lpr) {
goto no_lpr;