Mesa (master): frontends/va: Use correct size for secondary planes.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Feb 28 18:41:10 UTC 2021
Module: Mesa
Branch: master
Commit: f96a8c781968d7d5b869b5cb47470b4d91576edd
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f96a8c781968d7d5b869b5cb47470b4d91576edd
Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date: Wed Feb 24 00:00:58 2021 +0100
frontends/va: Use correct size for secondary planes.
And initialize the whandle format while at it.
Fixes: f7a4051b836 ("radeonsi: Check pitch and offset for validity.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4126
Reviewed-by: Simon Ser <contact at emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9236>
---
src/gallium/frontends/va/surface.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/gallium/frontends/va/surface.c b/src/gallium/frontends/va/surface.c
index d5703cd6671..978af2366a1 100644
--- a/src/gallium/frontends/va/surface.c
+++ b/src/gallium/frontends/va/surface.c
@@ -593,8 +593,6 @@ surface_from_external_memory(VADriverContextP ctx, vlVaSurface *surface,
res_templ.last_level = 0;
res_templ.depth0 = 1;
res_templ.array_size = 1;
- res_templ.width0 = memory_attribute->width;
- res_templ.height0 = memory_attribute->height;
res_templ.bind = PIPE_BIND_SAMPLER_VIEW;
res_templ.usage = PIPE_USAGE_DEFAULT;
@@ -602,6 +600,7 @@ surface_from_external_memory(VADriverContextP ctx, vlVaSurface *surface,
whandle.type = WINSYS_HANDLE_TYPE_FD;
whandle.handle = memory_attribute->buffers[index];
whandle.modifier = DRM_FORMAT_MOD_INVALID;
+ whandle.format = templat->buffer_format;
// Create a resource for each plane.
memset(resources, 0, sizeof resources);
@@ -612,6 +611,11 @@ surface_from_external_memory(VADriverContextP ctx, vlVaSurface *surface,
goto fail;
}
+ res_templ.width0 = util_format_get_plane_width(templat->buffer_format, i,
+ memory_attribute->width);
+ res_templ.height0 = util_format_get_plane_height(templat->buffer_format, i,
+ memory_attribute->height);
+
whandle.stride = memory_attribute->pitches[i];
whandle.offset = memory_attribute->offsets[i];
resources[i] = pscreen->resource_from_handle(pscreen, &res_templ, &whandle,
More information about the mesa-commit
mailing list