From 9bd11f65238ce101bf846f5528f9088630e983f7 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Wed, 16 Nov 2022 09:50:14 -0500 Subject: [PATCH] frontends/va: Use YUV400 YUY2 444P for JPEG only Since these formats are only for JPEG, and not all the backend driver supports these format. Eg radeonsi does, virgl doesn't, they should be used only for JPEG profile. Fixes d2c0ff1caf (frontends/va: add support for yuv400 and yuv444) Signed-off-by: Leo Liu Part-of: --- src/gallium/frontends/va/surface.c | 44 +++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/gallium/frontends/va/surface.c b/src/gallium/frontends/va/surface.c index 5679f39..0ed1353 100644 --- a/src/gallium/frontends/va/surface.c +++ b/src/gallium/frontends/va/surface.c @@ -522,27 +522,31 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config_id, attribs[i].value.value.i = VA_FOURCC_NV12; i++; } - if (config->rt_format & VA_RT_FORMAT_YUV400) { - attribs[i].type = VASurfaceAttribPixelFormat; - attribs[i].value.type = VAGenericValueTypeInteger; - attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; - attribs[i].value.value.i = VA_FOURCC_Y800; - i++; - } - if (config->rt_format & VA_RT_FORMAT_YUV422) { - attribs[i].type = VASurfaceAttribPixelFormat; - attribs[i].value.type = VAGenericValueTypeInteger; - attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; - attribs[i].value.value.i = VA_FOURCC_YUY2; - i++; - } - if (config->rt_format & VA_RT_FORMAT_YUV444) { - attribs[i].type = VASurfaceAttribPixelFormat; - attribs[i].value.type = VAGenericValueTypeInteger; - attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; - attribs[i].value.value.i = VA_FOURCC_444P; - i++; + if (config->profile == PIPE_VIDEO_PROFILE_JPEG_BASELINE) { + if (config->rt_format & VA_RT_FORMAT_YUV400) { + attribs[i].type = VASurfaceAttribPixelFormat; + attribs[i].value.type = VAGenericValueTypeInteger; + attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; + attribs[i].value.value.i = VA_FOURCC_Y800; + i++; + } + + if (config->rt_format & VA_RT_FORMAT_YUV422) { + attribs[i].type = VASurfaceAttribPixelFormat; + attribs[i].value.type = VAGenericValueTypeInteger; + attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; + attribs[i].value.value.i = VA_FOURCC_YUY2; + i++; + } + + if (config->rt_format & VA_RT_FORMAT_YUV444) { + attribs[i].type = VASurfaceAttribPixelFormat; + attribs[i].value.type = VAGenericValueTypeInteger; + attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE; + attribs[i].value.value.i = VA_FOURCC_444P; + i++; + } } } -- 2.7.4