X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fintel%2Fvulkan%2Fanv_queue.c;h=2c10e9d2f69604c24e68d57fea2af4e0cd4d5463;hb=b9400b7ecde42bd4a437829f338a3f349338a16b;hp=f6ff41f84b29dee0e0a003daca40d9461769c52f;hpb=65aa89e75fb8056db05d4d0634e7e9a792560a41;p=mesa.git diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c index f6ff41f84b2..2c10e9d2f69 100644 --- a/src/intel/vulkan/anv_queue.c +++ b/src/intel/vulkan/anv_queue.c @@ -25,8 +25,12 @@ * This file implements VkQueue, VkFence, and VkSemaphore */ +#include +#include +#include + #include "anv_private.h" -#include "util/vk_util.h" +#include "vk_util.h" #include "genxml/gen7_pack.h" @@ -68,7 +72,7 @@ anv_device_submit_simple_batch(struct anv_device *device, memcpy(bo.map, batch->start, size); if (!device->info.has_llc) - anv_flush_range(bo.map, size); + gen_flush_range(bo.map, size); exec_bos[0] = &bo; exec2_objects[0].handle = bo.gem_handle; @@ -161,7 +165,23 @@ VkResult anv_QueueSubmit( assert(cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY); assert(!anv_batch_has_error(&cmd_buffer->batch)); - result = anv_cmd_buffer_execbuf(device, cmd_buffer); + const VkSemaphore *in_semaphores = NULL, *out_semaphores = NULL; + uint32_t num_in_semaphores = 0, num_out_semaphores = 0; + if (j == 0) { + /* Only the first batch gets the in semaphores */ + in_semaphores = pSubmits[i].pWaitSemaphores; + num_in_semaphores = pSubmits[i].waitSemaphoreCount; + } + + if (j == pSubmits[i].commandBufferCount - 1) { + /* Only the last batch gets the out semaphores */ + out_semaphores = pSubmits[i].pSignalSemaphores; + num_out_semaphores = pSubmits[i].signalSemaphoreCount; + } + + result = anv_cmd_buffer_execbuf(device, cmd_buffer, + in_semaphores, num_in_semaphores, + out_semaphores, num_out_semaphores); if (result != VK_SUCCESS) goto out; } @@ -193,7 +213,7 @@ out: * VK_ERROR_DEVICE_LOST to ensure that clients do not attempt to * submit the same job again to this device. */ - result = VK_ERROR_DEVICE_LOST; + result = vk_errorf(VK_ERROR_DEVICE_LOST, "vkQueueSubmit() failed"); device->lost = true; /* If we return VK_ERROR_DEVICE LOST here, we need to ensure that @@ -508,9 +528,9 @@ VkResult anv_CreateSemaphore( if (semaphore == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - /* The DRM execbuffer ioctl always execute in-oder, even between - * different rings. As such, a dummy no-op semaphore is a perfectly - * valid implementation. + /* The DRM execbuffer ioctl always execute in-oder so long as you stay + * on the same ring. Since we don't expose the blit engine as a DMA + * queue, a dummy no-op semaphore is a perfectly valid implementation. */ semaphore->permanent.type = ANV_SEMAPHORE_TYPE_DUMMY; semaphore->temporary.type = ANV_SEMAPHORE_TYPE_NONE; @@ -520,6 +540,24 @@ VkResult anv_CreateSemaphore( return VK_SUCCESS; } +static void +anv_semaphore_impl_cleanup(struct anv_device *device, + struct anv_semaphore_impl *impl) +{ + switch (impl->type) { + case ANV_SEMAPHORE_TYPE_NONE: + case ANV_SEMAPHORE_TYPE_DUMMY: + /* Dummy. Nothing to do */ + return; + + case ANV_SEMAPHORE_TYPE_BO: + anv_bo_cache_release(device, &device->bo_cache, impl->bo); + return; + } + + unreachable("Invalid semaphore type"); +} + void anv_DestroySemaphore( VkDevice _device, VkSemaphore _semaphore, @@ -531,5 +569,8 @@ void anv_DestroySemaphore( if (semaphore == NULL) return; + anv_semaphore_impl_cleanup(device, &semaphore->temporary); + anv_semaphore_impl_cleanup(device, &semaphore->permanent); + vk_free2(&device->alloc, pAllocator, semaphore); }