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.liu@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10751>
This commit is contained in:
Leo Liu
2021-05-09 11:58:55 -04:00
committed by Marge Bot
parent 57c8164389
commit 052335a180

View File

@@ -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,