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 <Boyuan.Zhang@amd.com>
Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20242>
(cherry picked from commit a73e86e0a5)
This commit is contained in:
Ruijing Dong 2022-12-08 16:10:14 -05:00 committed by Eric Engestrom
parent e17740493f
commit 6922882d8f
2 changed files with 16 additions and 15 deletions

View file

@ -1849,7 +1849,7 @@
"description": "frontends/va: fix gst videotestsrc h264 enc fail issue.",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -495,20 +495,6 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config_id,
attribs[i].value.value.i = VA_FOURCC_NV12;
i++;
}
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->rt_format & VA_RT_FORMAT_YUV400) {
attribs[i].type = VASurfaceAttribPixelFormat;
@ -534,6 +520,21 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config_id,
i++;
}
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;