Module: Mesa
Branch: staging/23.3
Commit: 9d8e3aac70c44440dfc5b959e96112f9a1d36c15
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d8e3aac70c44440dfc5b959e96112f9a1d36c15

Author: José Roberto de Souza <jose.so...@intel.com>
Date:   Thu Oct 12 13:38:57 2023 -0700

anv: Add missing ANV_BO_ALLOC_EXTERNAL flags when calling anv_device_import_bo()

This flag is required to properly calculate the PAT index of the
imported BO.

Cc: mesa-stable
Signed-off-by: José Roberto de Souza <jose.so...@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwer...@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26099>
(cherry picked from commit 72ba0677f824d46d0f656eef07b99f5b5ab6ebe5)

---

 .pick_status.json                | 2 +-
 src/intel/vulkan/anv_allocator.c | 1 +
 src/intel/vulkan/anv_android.c   | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 4ed98686374..eae46bc0166 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -274,7 +274,7 @@
         "description": "anv: Add missing ANV_BO_ALLOC_EXTERNAL flags when 
calling anv_device_import_bo()",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 56073b42899..f527aa8d036 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -1646,6 +1646,7 @@ anv_device_import_bo(struct anv_device *device,
    assert(!(alloc_flags & (ANV_BO_ALLOC_MAPPED |
                            ANV_BO_ALLOC_SNOOPED |
                            ANV_BO_ALLOC_FIXED_ADDRESS)));
+   assert(alloc_flags & ANV_BO_ALLOC_EXTERNAL);
 
    struct anv_bo_cache *cache = &device->bo_cache;
 
diff --git a/src/intel/vulkan/anv_android.c b/src/intel/vulkan/anv_android.c
index 9dd3114f621..2cea3fc9f36 100644
--- a/src/intel/vulkan/anv_android.c
+++ b/src/intel/vulkan/anv_android.c
@@ -348,6 +348,7 @@ anv_image_init_from_gralloc(struct anv_device *device,
     *
     */
    result = anv_device_import_bo(device, dma_buf,
+                                 ANV_BO_ALLOC_EXTERNAL |
                                  ANV_BO_ALLOC_IMPLICIT_SYNC |
                                  ANV_BO_ALLOC_IMPLICIT_WRITE,
                                  0 /* client_address */,
@@ -431,6 +432,7 @@ anv_image_bind_from_gralloc(struct anv_device *device,
     */
    struct anv_bo *bo = NULL;
    VkResult result = anv_device_import_bo(device, dma_buf,
+                                          ANV_BO_ALLOC_EXTERNAL |
                                           ANV_BO_ALLOC_IMPLICIT_SYNC |
                                           ANV_BO_ALLOC_IMPLICIT_WRITE,
                                           0 /* client_address */,

Reply via email to