gallium/vl: Return YUV plane order for single plane formats
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

The order only matters for multi plane formats, but we still need to
return valid value for single plane formats.

Fixes crash reported here: https://github.com/mpv-player/mpv/issues/15992

Cc: mesa-stable
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33938>
This commit is contained in:
David Rosca 2025-03-07 14:54:08 +01:00 committed by Marge Bot
parent b346d8acfc
commit 6f35d3768d

View file

@ -71,6 +71,9 @@ vl_get_video_buffer_formats(struct pipe_screen *screen, enum pipe_format format,
const unsigned *
vl_video_buffer_plane_order(enum pipe_format format)
{
if (util_format_get_num_planes(format) == 1)
return const_resource_plane_order_YUV;
switch(format) {
case PIPE_FORMAT_YV12:
return const_resource_plane_order_YVU;
@ -79,20 +82,9 @@ vl_video_buffer_plane_order(enum pipe_format format)
case PIPE_FORMAT_NV21:
case PIPE_FORMAT_Y8_U8_V8_444_UNORM:
case PIPE_FORMAT_Y8_U8_V8_440_UNORM:
case PIPE_FORMAT_R8G8B8A8_UNORM:
case PIPE_FORMAT_R8G8B8X8_UNORM:
case PIPE_FORMAT_B8G8R8A8_UNORM:
case PIPE_FORMAT_B8G8R8X8_UNORM:
case PIPE_FORMAT_R10G10B10A2_UNORM:
case PIPE_FORMAT_R10G10B10X2_UNORM:
case PIPE_FORMAT_B10G10R10A2_UNORM:
case PIPE_FORMAT_B10G10R10X2_UNORM:
case PIPE_FORMAT_YUYV:
case PIPE_FORMAT_UYVY:
case PIPE_FORMAT_P010:
case PIPE_FORMAT_P012:
case PIPE_FORMAT_P016:
case PIPE_FORMAT_Y8_400_UNORM:
case PIPE_FORMAT_IYUV:
return const_resource_plane_order_YUV;