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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 8 16:15:07 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: 6022ed00791cc1f2285735e62226455fb8e1fb52
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6022ed00791cc1f2285735e62226455fb8e1fb52

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>
(cherry picked from commit bce227611d5e124ab8dc8f0be872e3360414f575)

---

 .pick_status.json                  | 2 +-
 src/gallium/frontends/va/surface.c | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index d41ae3bded1..370a6b94d92 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -616,7 +616,7 @@
         "description": "va/surface: set the correct size in vaExportSurfaceHandle",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "13b79266e47ebd0e36b0c01531c0876c39841b7e"
     },
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