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>
(cherry picked from commit f695957421)
This commit is contained in:
Dave Airlie 2021-01-25 11:23:58 +10:00 committed by Dylan Baker
parent 6753936d0e
commit 3dd7df6c24
3 changed files with 12 additions and 6 deletions

View file

@ -1210,7 +1210,7 @@
"description": "radv: move queue object to a common base object",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "9b1138e3f0e960119a46dc08794132719c93173e"
},

View file

@ -2414,24 +2414,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;
@ -2480,6 +2484,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

View file

@ -699,7 +699,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;