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

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>

---

 src/intel/vulkan/anv_allocator.c | 1 +
 src/intel/vulkan/anv_android.c   | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index a4727a38cf0..0a01190b296 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -1666,6 +1666,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