Module: Mesa Branch: main Commit: 052335a180bfc07f18cdf4dd5b56936f3e5bd279 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=052335a180bfc07f18cdf4dd5b56936f3e5bd279
Author: Leo Liu <leo....@amd.com> Date: Sun May 9 11:58:55 2021 -0400 frontends/va: fix multi planes for external memeory type For the multi planes case, only the first plane is required with the template buffer formats, and shouldn't fail for other planes. Signed-off-by: Leo Liu <leo....@amd.com> Reviewed-by: James Zhu <james....@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10751> --- src/gallium/frontends/va/surface.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/va/surface.c b/src/gallium/frontends/va/surface.c index 574299dc166..ecfae5a6bf6 100644 --- a/src/gallium/frontends/va/surface.c +++ b/src/gallium/frontends/va/surface.c @@ -615,10 +615,16 @@ surface_from_external_memory(VADriverContextP ctx, vlVaSurface *surface, // Create a resource for each plane. memset(resources, 0, sizeof resources); for (i = 0; i < memory_attribute->num_planes; i++) { + unsigned num_planes = util_format_get_num_planes(templat->buffer_format); + res_templ.format = resource_formats[i]; if (res_templ.format == PIPE_FORMAT_NONE) { - result = VA_STATUS_ERROR_INVALID_PARAMETER; - goto fail; + if (i < num_planes) { + result = VA_STATUS_ERROR_INVALID_PARAMETER; + goto fail; + } else { + continue; + } } res_templ.width0 = util_format_get_plane_width(templat->buffer_format, i, _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit