radv: move queue object to a common base object
This is needed to use the new dispatch layer code. While we're here, we
clean up the context on the error path.
Fixes: 9b1138e3f0 "radv: implement VK_EXT_private_data"
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
This commit is contained in:
@@ -2439,24 +2439,28 @@ radv_queue_init(struct radv_device *device, struct radv_queue *queue,
|
||||
VkDeviceQueueCreateFlags flags,
|
||||
const VkDeviceQueueGlobalPriorityCreateInfoEXT *global_priority)
|
||||
{
|
||||
queue->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
||||
queue->device = device;
|
||||
queue->queue_family_index = queue_family_index;
|
||||
queue->queue_idx = idx;
|
||||
queue->priority = radv_get_queue_global_priority(global_priority);
|
||||
queue->flags = flags;
|
||||
|
||||
vk_object_base_init(&device->vk, &queue->base, VK_OBJECT_TYPE_QUEUE);
|
||||
|
||||
VkResult result = device->ws->ctx_create(device->ws, queue->priority, &queue->hw_ctx);
|
||||
if (result != VK_SUCCESS)
|
||||
if (result != VK_SUCCESS) {
|
||||
vk_object_base_finish(&queue->base);
|
||||
return vk_error(device->instance, result);
|
||||
}
|
||||
|
||||
list_inithead(&queue->pending_submissions);
|
||||
mtx_init(&queue->pending_mutex, mtx_plain);
|
||||
|
||||
mtx_init(&queue->thread_mutex, mtx_plain);
|
||||
if (u_cnd_monotonic_init(&queue->thread_cond)) {
|
||||
result = VK_ERROR_INITIALIZATION_FAILED;
|
||||
return vk_error(device->instance, result);
|
||||
device->ws->ctx_destroy(queue->hw_ctx);
|
||||
vk_object_base_finish(&queue->base);
|
||||
return vk_error(device->instance, VK_ERROR_INITIALIZATION_FAILED);
|
||||
}
|
||||
queue->cond_created = true;
|
||||
|
||||
@@ -2505,6 +2509,8 @@ radv_queue_finish(struct radv_queue *queue)
|
||||
queue->device->ws->buffer_destroy(queue->gds_oa_bo);
|
||||
if (queue->compute_scratch_bo)
|
||||
queue->device->ws->buffer_destroy(queue->compute_scratch_bo);
|
||||
|
||||
vk_object_base_finish(&queue->base);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -696,7 +696,7 @@ struct radv_deferred_queue_submission;
|
||||
enum ring_type radv_queue_family_to_ring(int f);
|
||||
|
||||
struct radv_queue {
|
||||
VK_LOADER_DATA _loader_data;
|
||||
struct vk_object_base base;
|
||||
struct radv_device * device;
|
||||
struct radeon_winsys_ctx *hw_ctx;
|
||||
enum radeon_ctx_priority priority;
|
||||
|
||||
Reference in New Issue
Block a user