Mesa (main): va/surface: set the correct size in vaExportSurfaceHandle

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 8 08:12:05 UTC 2022


Module: Mesa
Branch: main
Commit: bce227611d5e124ab8dc8f0be872e3360414f575
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bce227611d5e124ab8dc8f0be872e3360414f575

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Wed Jun  1 10:46:11 2022 +0200

va/surface: set the correct size in vaExportSurfaceHandle

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 <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16813>

---

 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) {



More information about the mesa-commit mailing list