mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
vulkan: add support for VK_KHR_internally_synchronized_queues
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39489>
This commit is contained in:
parent
8a4a369795
commit
d8ef386f98
4 changed files with 70 additions and 10 deletions
|
|
@ -433,13 +433,10 @@ vk_common_CmdInsertDebugUtilsLabelEXT(
|
|||
command_buffer->region_begin = false;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
vk_common_QueueBeginDebugUtilsLabelEXT(
|
||||
VkQueue _queue,
|
||||
const VkDebugUtilsLabelEXT *pLabelInfo)
|
||||
void
|
||||
vk_queue_begin_debug_utils_label(struct vk_queue *queue,
|
||||
const VkDebugUtilsLabelEXT *pLabelInfo)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_queue, queue, _queue);
|
||||
|
||||
/* If the latest label was submitted by QueueInsertDebugUtilsLabelEXT, we
|
||||
* should remove it first.
|
||||
*/
|
||||
|
|
@ -453,10 +450,20 @@ vk_common_QueueBeginDebugUtilsLabelEXT(
|
|||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
vk_common_QueueEndDebugUtilsLabelEXT(VkQueue _queue)
|
||||
vk_common_QueueBeginDebugUtilsLabelEXT(
|
||||
VkQueue _queue,
|
||||
const VkDebugUtilsLabelEXT *pLabelInfo)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_queue, queue, _queue);
|
||||
|
||||
vk_queue_lock(queue);
|
||||
vk_queue_begin_debug_utils_label(queue, pLabelInfo);
|
||||
vk_queue_unlock(queue);
|
||||
}
|
||||
|
||||
void
|
||||
vk_queue_end_debug_utils_label(struct vk_queue *queue)
|
||||
{
|
||||
/* If the latest label was submitted by QueueInsertDebugUtilsLabelEXT, we
|
||||
* should remove it first.
|
||||
*/
|
||||
|
|
@ -468,12 +475,19 @@ vk_common_QueueEndDebugUtilsLabelEXT(VkQueue _queue)
|
|||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
vk_common_QueueInsertDebugUtilsLabelEXT(
|
||||
VkQueue _queue,
|
||||
const VkDebugUtilsLabelEXT *pLabelInfo)
|
||||
vk_common_QueueEndDebugUtilsLabelEXT(VkQueue _queue)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_queue, queue, _queue);
|
||||
|
||||
vk_queue_lock(queue);
|
||||
vk_queue_end_debug_utils_label(queue);
|
||||
vk_queue_unlock(queue);
|
||||
}
|
||||
|
||||
static void
|
||||
vk_queue_insert_debug_utils_label(struct vk_queue *queue,
|
||||
const VkDebugUtilsLabelEXT *pLabelInfo)
|
||||
{
|
||||
/* If the latest label was submitted by QueueInsertDebugUtilsLabelEXT, we
|
||||
* should remove it first.
|
||||
*/
|
||||
|
|
@ -486,6 +500,18 @@ vk_common_QueueInsertDebugUtilsLabelEXT(
|
|||
queue->region_begin = false;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
vk_common_QueueInsertDebugUtilsLabelEXT(
|
||||
VkQueue _queue,
|
||||
const VkDebugUtilsLabelEXT *pLabelInfo)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_queue, queue, _queue);
|
||||
|
||||
vk_queue_lock(queue);
|
||||
vk_queue_insert_debug_utils_label(queue, pLabelInfo);
|
||||
vk_queue_unlock(queue);
|
||||
}
|
||||
|
||||
VkResult
|
||||
vk_check_printf_status(struct vk_device *dev, struct u_printf_ctx *ctx)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct vk_queue;
|
||||
|
||||
struct vk_debug_utils_messenger {
|
||||
struct vk_object_base base;
|
||||
VkAllocationCallbacks alloc;
|
||||
|
|
@ -77,6 +79,14 @@ vk_emit_device_memory_report(struct vk_device* device,
|
|||
uint64_t obj_handle,
|
||||
uint32_t heap_index);
|
||||
|
||||
void
|
||||
vk_queue_begin_debug_utils_label(struct vk_queue *queue,
|
||||
const VkDebugUtilsLabelEXT *pLabelInfo);
|
||||
|
||||
void
|
||||
vk_queue_end_debug_utils_label(struct vk_queue *queue);
|
||||
|
||||
|
||||
struct u_printf_ctx;
|
||||
|
||||
VkResult
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ vk_queue_init(struct vk_queue *queue, struct vk_device *device,
|
|||
memset(queue, 0, sizeof(*queue));
|
||||
vk_object_base_init(device, &queue->base, VK_OBJECT_TYPE_QUEUE);
|
||||
|
||||
simple_mtx_init(&queue->lock, mtx_plain);
|
||||
|
||||
list_addtail(&queue->link, &device->queues);
|
||||
|
||||
queue->flags = pCreateInfo->flags;
|
||||
|
|
@ -624,7 +626,10 @@ vk_queue_submit_final(struct vk_queue *queue,
|
|||
result = vk_queue_set_lost(queue, "Failed to unwrap sync signal");
|
||||
}
|
||||
|
||||
vk_queue_lock(queue);
|
||||
result = queue->driver_submit(queue, submit);
|
||||
vk_queue_unlock(queue);
|
||||
|
||||
if (unlikely(result != VK_SUCCESS))
|
||||
return result;
|
||||
|
||||
|
|
@ -1224,6 +1229,8 @@ vk_queue_finish(struct vk_queue *queue)
|
|||
vk_free(&queue->base.device->alloc, (void *)label->pLabelName);
|
||||
util_dynarray_fini(&queue->labels);
|
||||
list_del(&queue->link);
|
||||
|
||||
simple_mtx_destroy(&queue->lock);
|
||||
vk_object_base_finish(&queue->base);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -163,6 +163,9 @@ struct vk_queue {
|
|||
*/
|
||||
VkSemaphore anb_semaphore;
|
||||
#endif
|
||||
|
||||
/* VK_KHR_internally_synchronized_queues */
|
||||
simple_mtx_t lock;
|
||||
};
|
||||
|
||||
VK_DEFINE_HANDLE_CASTS(vk_queue, base, VkQueue, VK_OBJECT_TYPE_QUEUE)
|
||||
|
|
@ -181,6 +184,20 @@ vk_queue_is_empty(struct vk_queue *queue)
|
|||
return list_is_empty(&queue->submit.submits);
|
||||
}
|
||||
|
||||
static inline void
|
||||
vk_queue_lock(struct vk_queue *queue)
|
||||
{
|
||||
if (queue->flags & VK_DEVICE_QUEUE_CREATE_INTERNALLY_SYNCHRONIZED_BIT_KHR)
|
||||
simple_mtx_lock(&queue->lock);
|
||||
}
|
||||
|
||||
static inline void
|
||||
vk_queue_unlock(struct vk_queue *queue)
|
||||
{
|
||||
if (queue->flags & VK_DEVICE_QUEUE_CREATE_INTERNALLY_SYNCHRONIZED_BIT_KHR)
|
||||
simple_mtx_unlock(&queue->lock);
|
||||
}
|
||||
|
||||
/** Enables threaded submit on this queue
|
||||
*
|
||||
* This should be called by the driver if it wants to be able to block inside
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue