anv: allow NULL batch parameter to anv_queue_submit_simple_batch
We can reuse device->trivial_batch_bo Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
f606c12731
commit
89de271bc2
|
@ -2959,19 +2959,11 @@ VkResult anv_DeviceWaitIdle(
|
||||||
VkDevice _device)
|
VkDevice _device)
|
||||||
{
|
{
|
||||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||||
|
|
||||||
if (anv_device_is_lost(device))
|
if (anv_device_is_lost(device))
|
||||||
return VK_ERROR_DEVICE_LOST;
|
return VK_ERROR_DEVICE_LOST;
|
||||||
|
|
||||||
struct anv_batch batch;
|
return anv_device_submit_simple_batch(device, NULL);
|
||||||
|
|
||||||
uint32_t cmds[8];
|
|
||||||
batch.start = batch.next = cmds;
|
|
||||||
batch.end = (void *) cmds + sizeof(cmds);
|
|
||||||
|
|
||||||
anv_batch_emit(&batch, GEN7_MI_BATCH_BUFFER_END, bbe);
|
|
||||||
anv_batch_emit(&batch, GEN7_MI_NOOP, noop);
|
|
||||||
|
|
||||||
return anv_device_submit_simple_batch(device, &batch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -123,15 +123,20 @@ anv_device_submit_simple_batch(struct anv_device *device,
|
||||||
VkResult result = VK_SUCCESS;
|
VkResult result = VK_SUCCESS;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
|
||||||
/* Kernel driver requires 8 byte aligned batch length */
|
if (batch) {
|
||||||
size = align_u32(batch->next - batch->start, 8);
|
/* Kernel driver requires 8 byte aligned batch length */
|
||||||
result = anv_bo_pool_alloc(&device->batch_bo_pool, size, &bo);
|
size = align_u32(batch->next - batch->start, 8);
|
||||||
if (result != VK_SUCCESS)
|
result = anv_bo_pool_alloc(&device->batch_bo_pool, size, &bo);
|
||||||
return result;
|
if (result != VK_SUCCESS)
|
||||||
|
return result;
|
||||||
|
|
||||||
memcpy(bo->map, batch->start, size);
|
memcpy(bo->map, batch->start, size);
|
||||||
if (!device->info.has_llc)
|
if (!device->info.has_llc)
|
||||||
gen_flush_range(bo->map, size);
|
gen_flush_range(bo->map, size);
|
||||||
|
} else {
|
||||||
|
size = device->trivial_batch_bo->size;
|
||||||
|
bo = device->trivial_batch_bo;
|
||||||
|
}
|
||||||
|
|
||||||
exec2_objects[0].handle = bo->gem_handle;
|
exec2_objects[0].handle = bo->gem_handle;
|
||||||
exec2_objects[0].relocation_count = 0;
|
exec2_objects[0].relocation_count = 0;
|
||||||
|
@ -168,7 +173,8 @@ anv_device_submit_simple_batch(struct anv_device *device,
|
||||||
result = anv_device_wait(device, bo, INT64_MAX);
|
result = anv_device_wait(device, bo, INT64_MAX);
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
anv_bo_pool_free(&device->batch_bo_pool, bo);
|
if (batch)
|
||||||
|
anv_bo_pool_free(&device->batch_bo_pool, bo);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue