Module: Mesa
Branch: staging/22.2
Commit: 30511c9e059fbba5e80df1245a6bdc7e78a8dad4
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=30511c9e059fbba5e80df1245a6bdc7e78a8dad4

Author: Sil Vilerino <[email protected]>
Date:   Mon Aug 29 12:42:41 2022 -0400

gallium/va: vaDeriveImage to check PIPE_VIDEO_SUPPORTS_CONTIGUOUS_PLANES_MAP

vaDeriveImage should check if the underlying gallium driver can map contiguous 
planes
before skipping with disallowlist.

Fixes: a585d95803ca38d42b893603a85bf6442a54838a ("radeonsi/vcn: WA 10bit 
encoding crash in vaapi")

Reviewed-by: Ruijing Dong <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18300>
(cherry picked from commit 81ae033b949953ef0c43edef3d0eb12e4741ee2e)

Conflicts:
        src/gallium/include/pipe/p_video_enums.h

---

 .pick_status.json                        | 2 +-
 src/gallium/frontends/va/image.c         | 9 ++++++---
 src/gallium/include/pipe/p_video_enums.h | 4 ++++
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 8d3b8069f3b..98e80381463 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -22567,7 +22567,7 @@
         "description": "gallium/va: vaDeriveImage to check 
PIPE_VIDEO_SUPPORTS_CONTIGUOUS_PLANES_MAP",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "a585d95803ca38d42b893603a85bf6442a54838a"
     },
diff --git a/src/gallium/frontends/va/image.c b/src/gallium/frontends/va/image.c
index 19d0f69121a..0255cf59ced 100644
--- a/src/gallium/frontends/va/image.c
+++ b/src/gallium/frontends/va/image.c
@@ -256,9 +256,12 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, 
VAImage *image)
                                    PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE))
          return VA_STATUS_ERROR_OPERATION_FAILED;
    } else {
-      for (i = 0; i < ARRAY_SIZE(derive_progressive_disallowlist); i++)
-         if ((strcmp(derive_progressive_disallowlist[i], proc) == 0))
-            return VA_STATUS_ERROR_OPERATION_FAILED;
+         if(!screen->get_video_param(screen, PIPE_VIDEO_PROFILE_UNKNOWN,
+                                   PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
+                                   PIPE_VIDEO_SUPPORTS_CONTIGUOUS_PLANES_MAP))
+            for (i = 0; i < ARRAY_SIZE(derive_progressive_disallowlist); i++)
+               if ((strcmp(derive_progressive_disallowlist[i], proc) == 0))
+                  return VA_STATUS_ERROR_OPERATION_FAILED;
    }
 
    surfaces = surf->buffer->get_surfaces(surf->buffer);
diff --git a/src/gallium/include/pipe/p_video_enums.h 
b/src/gallium/include/pipe/p_video_enums.h
index 7d157364479..c195a70b0c2 100644
--- a/src/gallium/include/pipe/p_video_enums.h
+++ b/src/gallium/include/pipe/p_video_enums.h
@@ -105,6 +105,10 @@ enum pipe_video_cap
    PIPE_VIDEO_CAP_VPP_MAX_OUTPUT_HEIGHT = 23,
    PIPE_VIDEO_CAP_VPP_MIN_OUTPUT_WIDTH = 24,
    PIPE_VIDEO_CAP_VPP_MIN_OUTPUT_HEIGHT = 25,
+   /* If true, when mapping planar textures like NV12 or P016 the mapped 
buffer contains
+   all the planes contiguously. This allows for use with some frontends 
functions that
+   require this like vaDeriveImage */
+   PIPE_VIDEO_SUPPORTS_CONTIGUOUS_PLANES_MAP = 27,
 };
 
 /* To be used with PIPE_VIDEO_CAP_VPP_ORIENTATION_MODES and for VPP state*/

Reply via email to