From bce227611d5e124ab8dc8f0be872e3360414f575 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 1 Jun 2022 10:46:11 +0200 Subject: [PATCH] va/surface: set the correct size in vaExportSurfaceHandle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The size must be the size of the total object, not the size of the resource. For instance, when using a single object for a multi-plane format, the size of each plane should be equal to the size of the underlying object to match libva's documentation: /** Total size of this object (may include regions which are * not part of the surface). */ uint32_t size; Fixes: 13b79266e47 ("frontend/va: Setting the size of VADRMPRIMESurfaceDescriptor") Reviewed-by: Marek Olšák Part-of: --- src/gallium/frontends/va/surface.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/va/surface.c b/src/gallium/frontends/va/surface.c index 741209f8ed4..d928c474c36 100755 --- a/src/gallium/frontends/va/surface.c +++ b/src/gallium/frontends/va/surface.c @@ -1293,7 +1293,10 @@ vlVaExportSurfaceHandle(VADriverContextP ctx, } desc->objects[p].fd = (int)whandle.handle; - desc->objects[p].size = surf->templat.width * surf->templat.height; + /* As per VADRMPRIMESurfaceDescriptor documentation, size must be the + * "Total size of this object (may include regions which are not part + * of the surface)."" */ + desc->objects[p].size = (uint32_t) whandle.size; desc->objects[p].drm_format_modifier = whandle.modifier; if (flags & VA_EXPORT_SURFACE_COMPOSED_LAYERS) {