From a73e86e0a5eb58e2f25f7b7419a78c122cc5ab1a Mon Sep 17 00:00:00 2001 From: Ruijing Dong Date: Thu, 8 Dec 2022 16:10:14 -0500 Subject: [PATCH] frontends/va: fix gst videotestsrc h264 enc fail issue. problem: when doing "gst-launch-1.0 -v videotestsrc num-buffer=10 ! vaapih264enc ! fakeink" The command will fail due to gst will fetch the first available supported format in the list, it becomes P010_LE due to the commit in [0b02db3007] frontends/va: fixed av1 decoding 10bit ffmpeg output YUV issue fix: move the P010_LE code block to the end of the function, the sequence of the supported formats restored to its original. cc: mesa-stable Reviewed-by: Boyuan Zhang Signed-off-by: Ruijing Dong Part-of: --- src/gallium/frontends/va/surface.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/gallium/frontends/va/surface.c b/src/gallium/frontends/va/surface.c index 0ed135306bb..a4adf13246f 100644 --- a/src/gallium/frontends/va/surface.c +++ b/src/gallium/frontends/va/surface.c @@ -488,20 +488,6 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config_id, } } } - if (config->rt_format & VA_RT_FORMAT_YUV420_10 || - (config->rt_format & VA_RT_FORMAT_YUV420 && - config->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE)) { - 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_P010; - i++; - 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_P016; - i++; - } if (config->profile == PIPE_VIDEO_PROFILE_AV1_MAIN && config->entrypoint == PIPE_VIDEO_ENTRYPOINT_BITSTREAM) { attribs[i].type = VASurfaceAttribPixelFormat; @@ -550,6 +536,21 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config_id, } } + if (config->rt_format & VA_RT_FORMAT_YUV420_10 || + (config->rt_format & VA_RT_FORMAT_YUV420 && + config->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE)) { + 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_P010; + i++; + 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_P016; + i++; + } + attribs[i].type = VASurfaceAttribMemoryType; attribs[i].value.type = VAGenericValueTypeInteger; attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;