summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2023-05-11 12:43:00 +0300
committerMarge Bot <emma+marge@anholt.net>2023-05-17 14:59:14 +0000
commit7f7b2fc53ab430a05fa284b209ab71c57b21c548 (patch)
tree7ad2e7ef97623f378f9e0782cf4783a06637f03a
parentaf0f7b347513c8fdb325d45640c1d36a14fe9b3a (diff)
downloadmesa-7f7b2fc53ab430a05fa284b209ab71c57b21c548.tar.gz
anv: put private binding BOs into execlists
Not doing so all the reads/writes go to the scratch page on i915. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Fixes: f9fa09ec92 ("anv/image: Add ANV_IMAGE_MEMORY_BINDING_PRIVATE") Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22957>
-rw-r--r--src/intel/vulkan/anv_device.c1
-rw-r--r--src/intel/vulkan/anv_image.c19
-rw-r--r--src/intel/vulkan/anv_private.h6
-rw-r--r--src/intel/vulkan/i915/anv_batch_chain.c12
4 files changed, 34 insertions, 4 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 1b1dce0c55c..1c3b9c08c57 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -3089,6 +3089,7 @@ VkResult anv_CreateDevice(
device->physical->va.high_heap.size);
list_inithead(&device->memory_objects);
+ list_inithead(&device->image_private_objects);
if (pthread_mutex_init(&device->mutex, NULL) != 0) {
result = vk_error(device, VK_ERROR_INITIALIZATION_FAILED);
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 66a6d58bdfa..6c8d2c76aee 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -1312,9 +1312,16 @@ alloc_private_binding(struct anv_device *device,
return VK_SUCCESS;
}
- return anv_device_alloc_bo(device, "image-binding-private",
- binding->memory_range.size, 0, 0,
- &binding->address.bo);
+ VkResult result = anv_device_alloc_bo(device, "image-binding-private",
+ binding->memory_range.size, 0, 0,
+ &binding->address.bo);
+ if (result == VK_SUCCESS) {
+ pthread_mutex_lock(&device->mutex);
+ list_addtail(&image->link, &device->image_private_objects);
+ pthread_mutex_unlock(&device->mutex);
+ }
+
+ return result;
}
VkResult
@@ -1453,8 +1460,12 @@ anv_image_finish(struct anv_image *image)
}
struct anv_bo *private_bo = image->bindings[ANV_IMAGE_MEMORY_BINDING_PRIVATE].address.bo;
- if (private_bo)
+ if (private_bo) {
+ pthread_mutex_lock(&device->mutex);
+ list_del(&image->link);
+ pthread_mutex_unlock(&device->mutex);
anv_device_release_bo(device, private_bo);
+ }
vk_image_finish(&image->vk);
}
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 35302913d5d..e4a29bd9a5b 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1097,6 +1097,9 @@ struct anv_device {
/** List of all anv_device_memory objects */
struct list_head memory_objects;
+ /** List of anv_image objects with a private binding for implicit CCS */
+ struct list_head image_private_objects;
+
struct anv_bo_pool batch_bo_pool;
struct anv_bo_pool utrace_bo_pool;
@@ -3747,6 +3750,9 @@ struct anv_image {
} planes[3];
struct anv_image_memory_range vid_dmv_top_surface;
+
+ /* Link in the anv_device.image_private_objects list */
+ struct list_head link;
};
static inline bool
diff --git a/src/intel/vulkan/i915/anv_batch_chain.c b/src/intel/vulkan/i915/anv_batch_chain.c
index ab3497b2053..ff6e7d1ae94 100644
--- a/src/intel/vulkan/i915/anv_batch_chain.c
+++ b/src/intel/vulkan/i915/anv_batch_chain.c
@@ -378,6 +378,18 @@ setup_execbuf_for_cmd_buffers(struct anv_execbuf *execbuf,
return result;
}
+ /* Add all the private BOs from images because we can't track after binding
+ * updates of VK_EXT_descriptor_indexing.
+ */
+ list_for_each_entry(struct anv_image, image,
+ &device->image_private_objects, link) {
+ struct anv_bo *private_bo =
+ image->bindings[ANV_IMAGE_MEMORY_BINDING_PRIVATE].address.bo;
+ result = anv_execbuf_add_bo(device, execbuf, private_bo, NULL, 0);
+ if (result != VK_SUCCESS)
+ return result;
+ }
+
struct anv_batch_bo *first_batch_bo =
list_first_entry(&cmd_buffers[0]->batch_bos, struct anv_batch_bo, link);