mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 05:08:08 +02:00
anv/sparse: add an extra step before anv_sparse_bind_resource_memory()
I need to add some sparse-related checks that require having the anv_buffer and anv_image, and putting them directly inside anv_queue_submit_sparse_bind_locked() doesn't feel like the right thing to do. Here we change the interface so now we have anv_sparse_bind_buffer() and anv_sparse_bind_image_opaque() as the main interface into anv_sparse.c, so they both can call the lower level anv_sparse_bind_resource_memory() function. In the next patch we'll be adding changing the code of the functions we just created, justifying their addition. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26410>
This commit is contained in:
parent
c3aa7e42ba
commit
a501a840a3
3 changed files with 39 additions and 15 deletions
|
|
@ -1420,10 +1420,9 @@ anv_queue_submit_sparse_bind_locked(struct anv_queue *queue,
|
|||
assert(anv_buffer_is_sparse(buffer));
|
||||
|
||||
for (uint32_t j = 0; j < bind_info->bindCount; j++) {
|
||||
result = anv_sparse_bind_resource_memory(device,
|
||||
&buffer->sparse_data,
|
||||
&bind_info->pBinds[j],
|
||||
&sparse_submit);
|
||||
result = anv_sparse_bind_buffer(device, buffer,
|
||||
&bind_info->pBinds[j],
|
||||
&sparse_submit);
|
||||
if (result != VK_SUCCESS)
|
||||
goto out_free_submit;
|
||||
}
|
||||
|
|
@ -1451,14 +1450,11 @@ anv_queue_submit_sparse_bind_locked(struct anv_queue *queue,
|
|||
ANV_FROM_HANDLE(anv_image, image, bind_info->image);
|
||||
|
||||
assert(anv_image_is_sparse(image));
|
||||
assert(!image->disjoint);
|
||||
struct anv_sparse_binding_data *sparse_data =
|
||||
&image->bindings[ANV_IMAGE_MEMORY_BINDING_MAIN].sparse_data;
|
||||
|
||||
for (uint32_t j = 0; j < bind_info->bindCount; j++) {
|
||||
result = anv_sparse_bind_resource_memory(device, sparse_data,
|
||||
&bind_info->pBinds[j],
|
||||
&sparse_submit);
|
||||
result = anv_sparse_bind_image_opaque(device, image,
|
||||
&bind_info->pBinds[j],
|
||||
&sparse_submit);
|
||||
if (result != VK_SUCCESS)
|
||||
goto out_free_submit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2949,10 +2949,14 @@ VkResult anv_init_sparse_bindings(struct anv_device *device,
|
|||
struct anv_address *out_address);
|
||||
VkResult anv_free_sparse_bindings(struct anv_device *device,
|
||||
struct anv_sparse_binding_data *sparse);
|
||||
VkResult anv_sparse_bind_resource_memory(struct anv_device *device,
|
||||
struct anv_sparse_binding_data *data,
|
||||
const VkSparseMemoryBind *bind_,
|
||||
struct anv_sparse_submission *submit);
|
||||
VkResult anv_sparse_bind_buffer(struct anv_device *device,
|
||||
struct anv_buffer *buffer,
|
||||
const VkSparseMemoryBind *vk_bind,
|
||||
struct anv_sparse_submission *submit);
|
||||
VkResult anv_sparse_bind_image_opaque(struct anv_device *device,
|
||||
struct anv_image *image,
|
||||
const VkSparseMemoryBind *vk_bind,
|
||||
struct anv_sparse_submission *submit);
|
||||
VkResult anv_sparse_bind_image_memory(struct anv_queue *queue,
|
||||
struct anv_image *image,
|
||||
const VkSparseImageMemoryBind *bind,
|
||||
|
|
|
|||
|
|
@ -991,7 +991,7 @@ vk_bind_to_anv_vm_bind(struct anv_sparse_binding_data *sparse,
|
|||
return anv_bind;
|
||||
}
|
||||
|
||||
VkResult
|
||||
static VkResult
|
||||
anv_sparse_bind_resource_memory(struct anv_device *device,
|
||||
struct anv_sparse_binding_data *sparse,
|
||||
const VkSparseMemoryBind *vk_bind,
|
||||
|
|
@ -1005,6 +1005,30 @@ anv_sparse_bind_resource_memory(struct anv_device *device,
|
|||
return anv_sparse_submission_add(device, submit, &bind);
|
||||
}
|
||||
|
||||
VkResult
|
||||
anv_sparse_bind_buffer(struct anv_device *device,
|
||||
struct anv_buffer *buffer,
|
||||
const VkSparseMemoryBind *vk_bind,
|
||||
struct anv_sparse_submission *submit)
|
||||
{
|
||||
return anv_sparse_bind_resource_memory(device, &buffer->sparse_data,
|
||||
vk_bind, submit);
|
||||
}
|
||||
|
||||
VkResult
|
||||
anv_sparse_bind_image_opaque(struct anv_device *device,
|
||||
struct anv_image *image,
|
||||
const VkSparseMemoryBind *vk_bind,
|
||||
struct anv_sparse_submission *submit)
|
||||
{
|
||||
struct anv_sparse_binding_data *sparse_data =
|
||||
&image->bindings[ANV_IMAGE_MEMORY_BINDING_MAIN].sparse_data;
|
||||
assert(!image->disjoint);
|
||||
|
||||
return anv_sparse_bind_resource_memory(device, sparse_data,
|
||||
vk_bind, submit);
|
||||
}
|
||||
|
||||
VkResult
|
||||
anv_sparse_bind_image_memory(struct anv_queue *queue,
|
||||
struct anv_image *image,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue