Commit 62ffca7d authored by Dave Airlie's avatar Dave Airlie
Browse files

Add sparse image binding

parent 41a121fc
Pipeline #739381 waiting for manual action with stages
......@@ -5,6 +5,7 @@
#include "nvk_cmd_pool.h"
#include "nvk_device.h"
#include "nvk_buffer.h"
#include "nvk_image.h"
#include "nvk_device_memory.h"
#include "nvk_physical_device.h"
......@@ -168,6 +169,27 @@ push_add_buffer_bind(struct push_builder *pb,
#endif
}
static void
push_add_image_opaque_bind(struct push_builder *pb,
VkSparseImageOpaqueMemoryBindInfo *bind_info)
{
#if NVK_NEW_UAPI == 1
VK_FROM_HANDLE(nvk_image, image, bind_info->image);
for (unsigned i = 0; i < bind_info->bindCount; i++) {
const VkSparseMemoryBind *bind = &bind_info->pBinds[i];
VK_FROM_HANDLE(nvk_device_memory, mem, bind->memory);
pb->bind_ops[pb->vmbind.op_count++] = (struct drm_nouveau_vm_bind_op) {
.op = DRM_NOUVEAU_VM_BIND_OP_MAP,
.handle = mem->bo->handle,
.addr = image->addr + bind->resourceOffset,
.bo_offset = bind->memoryOffset,
.range = bind->size,
.flags = image->nil.pte_kind,
};
}
#endif
}
static void
push_add_push(struct push_builder *pb, struct nouveau_ws_bo *bo,
uint32_t dw_offset, uint32_t dw_count)
......@@ -320,7 +342,7 @@ nvk_queue_submit_drm_nouveau(struct nvk_queue *queue,
struct nvk_device *dev = nvk_queue_device(queue);
struct push_builder pb;
VkResult result;
bool is_vmbind = submit->buffer_bind_count > 0;
bool is_vmbind = submit->buffer_bind_count > 0 || submit->image_opaque_bind_count > 0;
if (is_vmbind)
assert(submit->command_buffer_count == 0);
......@@ -339,6 +361,10 @@ nvk_queue_submit_drm_nouveau(struct nvk_queue *queue,
push_add_buffer_bind(&pb, &submit->buffer_binds[i]);
}
for (uint32_t i = 0; i < submit->image_opaque_bind_count; i++) {
push_add_image_opaque_bind(&pb, &submit->image_opaque_binds[i]);
}
if (submit->command_buffer_count == 0) {
push_add_push(&pb, queue->empty_push, 0, queue->empty_push_dw_count);
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment