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>
This commit is contained in:
Lionel Landwerlin 2023-05-11 12:43:00 +03:00 committed by Marge Bot
parent af0f7b3475
commit 7f7b2fc53a
4 changed files with 34 additions and 4 deletions

View file

@ -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);

View file

@ -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);
}

View file

@ -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

View file

@ -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);