mesa/src/intel/vulkan/anv_queue.c

63 lines
2.0 KiB
C
Raw Normal View History

/*
* Copyright © 2015 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
/**
* This file implements VkQueue
*/
#include "anv_private.h"
VkResult
anv_queue_init(struct anv_device *device, struct anv_queue *queue,
uint32_t exec_flags,
const VkDeviceQueueCreateInfo *pCreateInfo,
uint32_t index_in_family)
{
struct anv_physical_device *pdevice = device->physical;
anv: implement shareable timeline semaphores This implements timeline semaphores using a new type of dma-fence stored into drm-syncobjs. We use a thread to implement delayed submissions. v2: Drop cloning of temporary semaphores and just transfer their ownership (Jason) Drain queue when dealing with binary semaphore Ensure we don't submit to the thread as long as we don't need to v3: Use __u64 not uintptr_t for kernel pointers Fix commented code for INTEL_DEBUG=bat Set DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES in timeline fence execbuf extension Add new anv_queue_set_lost() Drop multi queue stuff meant for the fake multi queue patch Rework temporary syncobj handling Don't use syncobj when not available (DeviceWaitIdle/CreateDevice) Use ANV_MULTIALLOC And a few more tweaks... v4: Drop drained condition helper (Lionel) Fix missing EXEC_OBJECT_WRITE on BOs we want to wait on (Jason) v5: Add missing device->lost_reported in _anv_device_report_lost (Lionel) Fix missing free on submit->simple_bo (Lionel) Don't drop setting the device in lost state on QueueSubmit error (Jason) Store submit->fence_bos as an array of uintptr_t (Jason) v6: condition device->has_thread_submit to i915 & core DRM support (Jason) v7: Fix submit->in_fence leakage on error (Jason) Keep dummy semaphore with no thread submission (Jason) v8: Move ownership of submit->out_fence to submit (Jason) v9: Don't forget to read the VkFence's syncobj binary payload (Lionel) v10: Take the mutex lock on anv_gem_close() (Jason/Lionel) v11: Fix void* -> u64 cast on 32bit (Lionel) v12: Rebase after BO backed timeline semaphore (Lionel) v13: Fix missing snippets lost after rebase (Lionel) v14: Drop update_binary usage (Lionel) v15: Use ANV_MULTIALLOC (Lionel) v16: Fix some realloc issues (Ivan) Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v8) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2901>
2019-08-28 11:22:30 +01:00
VkResult result;
result = vk_queue_init(&queue->vk, &device->vk, pCreateInfo,
index_in_family);
if (result != VK_SUCCESS)
return result;
queue->vk.driver_submit = anv_queue_submit;
queue->device = device;
assert(queue->vk.queue_family_index < pdevice->queue.family_count);
queue->family = &pdevice->queue.families[queue->vk.queue_family_index];
queue->index_in_family = index_in_family;
queue->exec_flags = exec_flags;
anv: implement shareable timeline semaphores This implements timeline semaphores using a new type of dma-fence stored into drm-syncobjs. We use a thread to implement delayed submissions. v2: Drop cloning of temporary semaphores and just transfer their ownership (Jason) Drain queue when dealing with binary semaphore Ensure we don't submit to the thread as long as we don't need to v3: Use __u64 not uintptr_t for kernel pointers Fix commented code for INTEL_DEBUG=bat Set DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES in timeline fence execbuf extension Add new anv_queue_set_lost() Drop multi queue stuff meant for the fake multi queue patch Rework temporary syncobj handling Don't use syncobj when not available (DeviceWaitIdle/CreateDevice) Use ANV_MULTIALLOC And a few more tweaks... v4: Drop drained condition helper (Lionel) Fix missing EXEC_OBJECT_WRITE on BOs we want to wait on (Jason) v5: Add missing device->lost_reported in _anv_device_report_lost (Lionel) Fix missing free on submit->simple_bo (Lionel) Don't drop setting the device in lost state on QueueSubmit error (Jason) Store submit->fence_bos as an array of uintptr_t (Jason) v6: condition device->has_thread_submit to i915 & core DRM support (Jason) v7: Fix submit->in_fence leakage on error (Jason) Keep dummy semaphore with no thread submission (Jason) v8: Move ownership of submit->out_fence to submit (Jason) v9: Don't forget to read the VkFence's syncobj binary payload (Lionel) v10: Take the mutex lock on anv_gem_close() (Jason/Lionel) v11: Fix void* -> u64 cast on 32bit (Lionel) v12: Rebase after BO backed timeline semaphore (Lionel) v13: Fix missing snippets lost after rebase (Lionel) v14: Drop update_binary usage (Lionel) v15: Use ANV_MULTIALLOC (Lionel) v16: Fix some realloc issues (Ivan) Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v8) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2901>
2019-08-28 11:22:30 +01:00
return VK_SUCCESS;
}
void
anv_queue_finish(struct anv_queue *queue)
{
vk_queue_finish(&queue->vk);
}