From 7a2868967d1e1e882b91739e7b4fd7fc8cbffd03 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 23 Sep 2021 11:37:40 -0500 Subject: [PATCH] radv: Drop radv_queue::flags/queue_family_index/queue_idx They're now part of vk_queue. Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/layers/radv_sqtt_layer.c | 2 +- src/amd/vulkan/radv_debug.c | 14 +++++------ src/amd/vulkan/radv_device.c | 31 ++++++++++++------------- src/amd/vulkan/radv_private.h | 3 --- src/amd/vulkan/radv_sqtt.c | 4 ++-- src/amd/vulkan/radv_wsi.c | 2 +- 6 files changed, 26 insertions(+), 30 deletions(-) diff --git a/src/amd/vulkan/layers/radv_sqtt_layer.c b/src/amd/vulkan/layers/radv_sqtt_layer.c index 32bec940873..175436703d6 100644 --- a/src/amd/vulkan/layers/radv_sqtt_layer.c +++ b/src/amd/vulkan/layers/radv_sqtt_layer.c @@ -390,7 +390,7 @@ radv_handle_thread_trace(VkQueue _queue) if (frame_trigger || file_trigger || resize_trigger) { /* FIXME: SQTT on compute hangs. */ - if (queue->queue_family_index == RADV_QUEUE_COMPUTE) { + if (queue->vk.queue_family_index == RADV_QUEUE_COMPUTE) { fprintf(stderr, "RADV: Capturing a SQTT trace on the compute " "queue is currently broken and might hang! " "Please, disable presenting on compute if " diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c index 160c5e9de59..b139a5e9b51 100644 --- a/src/amd/vulkan/radv_debug.c +++ b/src/amd/vulkan/radv_debug.c @@ -499,7 +499,7 @@ radv_get_saved_pipeline(struct radv_device *device, enum ring_type ring) static void radv_dump_queue_state(struct radv_queue *queue, const char *dump_dir, FILE *f) { - enum ring_type ring = radv_queue_family_to_ring(queue->queue_family_index); + enum ring_type ring = radv_queue_family_to_ring(queue->vk.queue_family_index); struct radv_pipeline *pipeline; fprintf(f, "RING_%s:\n", ring == RING_GFX ? "GFX" : "COMPUTE"); @@ -609,7 +609,7 @@ radv_dump_device_name(struct radv_device *device, FILE *f) static void radv_dump_umr_ring(struct radv_queue *queue, FILE *f) { - enum ring_type ring = radv_queue_family_to_ring(queue->queue_family_index); + enum ring_type ring = radv_queue_family_to_ring(queue->vk.queue_family_index); struct radv_device *device = queue->device; char cmd[128]; @@ -627,7 +627,7 @@ radv_dump_umr_ring(struct radv_queue *queue, FILE *f) static void radv_dump_umr_waves(struct radv_queue *queue, FILE *f) { - enum ring_type ring = radv_queue_family_to_ring(queue->queue_family_index); + enum ring_type ring = radv_queue_family_to_ring(queue->vk.queue_family_index); struct radv_device *device = queue->device; char cmd[128]; @@ -647,7 +647,7 @@ radv_gpu_hang_occured(struct radv_queue *queue, enum ring_type ring) { struct radeon_winsys *ws = queue->device->ws; - if (!ws->ctx_wait_idle(queue->hw_ctx, ring, queue->queue_idx)) + if (!ws->ctx_wait_idle(queue->hw_ctx, ring, queue->vk.index_in_family)) return true; return false; @@ -660,7 +660,7 @@ radv_check_gpu_hangs(struct radv_queue *queue, struct radeon_cmdbuf *cs) enum ring_type ring; uint64_t addr; - ring = radv_queue_family_to_ring(queue->queue_family_index); + ring = radv_queue_family_to_ring(queue->vk.queue_family_index); bool hang_occurred = radv_gpu_hang_occured(queue, ring); bool vm_fault_occurred = false; @@ -999,12 +999,12 @@ radv_dump_sq_hw_regs(struct radv_device *device) void radv_check_trap_handler(struct radv_queue *queue) { - enum ring_type ring = radv_queue_family_to_ring(queue->queue_family_index); + enum ring_type ring = radv_queue_family_to_ring(queue->vk.queue_family_index); struct radv_device *device = queue->device; struct radeon_winsys *ws = device->ws; /* Wait for the context to be idle in a finite time. */ - ws->ctx_wait_idle(queue->hw_ctx, ring, queue->queue_idx); + ws->ctx_wait_idle(queue->hw_ctx, ring, queue->vk.index_in_family); /* Try to detect if the trap handler has been reached by the hw by * looking at ttmp0 which should be non-zero if a shader exception diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index e3a2b48cdbe..5f9ee138f71 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -2508,10 +2508,7 @@ radv_queue_init(struct radv_device *device, struct radv_queue *queue, const VkDeviceQueueGlobalPriorityCreateInfoEXT *global_priority) { queue->device = device; - queue->queue_family_index = create_info->queueFamilyIndex; - queue->queue_idx = idx; queue->priority = radv_get_queue_global_priority(global_priority); - queue->flags = create_info->flags; queue->hw_ctx = device->hw_ctx[queue->priority]; VkResult result = vk_queue_init(&queue->vk, &device->vk, create_info, idx); @@ -3235,7 +3232,7 @@ radv_GetDeviceQueue2(VkDevice _device, const VkDeviceQueueInfo2 *pQueueInfo, VkQ struct radv_queue *queue; queue = &device->queues[pQueueInfo->queueFamilyIndex][pQueueInfo->queueIndex]; - if (pQueueInfo->flags != queue->flags) { + if (pQueueInfo->flags != queue->vk.flags) { /* From the Vulkan 1.1.70 spec: * * "The queue returned by vkGetDeviceQueue2 must have the same @@ -3523,7 +3520,7 @@ radv_emit_graphics_scratch(struct radv_queue *queue, struct radeon_cmdbuf *cs, uint32_t size_per_wave, uint32_t waves, struct radeon_winsys_bo *scratch_bo) { - if (queue->queue_family_index != RADV_QUEUE_GENERAL) + if (queue->vk.queue_family_index != RADV_QUEUE_GENERAL) return; if (!scratch_bo) @@ -3828,7 +3825,7 @@ radv_get_preamble_cs(struct radv_queue *queue, uint32_t scratch_size_per_wave, enum rgp_flush_bits sqtt_flush_bits = 0; struct radeon_cmdbuf *cs = NULL; cs = queue->device->ws->cs_create(queue->device->ws, - queue->queue_family_index ? RING_COMPUTE : RING_GFX); + queue->vk.queue_family_index ? RING_COMPUTE : RING_GFX); if (!cs) { result = VK_ERROR_OUT_OF_HOST_MEMORY; goto fail; @@ -3840,7 +3837,7 @@ radv_get_preamble_cs(struct radv_queue *queue, uint32_t scratch_size_per_wave, radv_cs_add_buffer(queue->device->ws, cs, scratch_bo); /* Emit initial configuration. */ - switch (queue->queue_family_index) { + switch (queue->vk.queue_family_index) { case RADV_QUEUE_GENERAL: radv_init_graphics_state(cs, queue); break; @@ -3875,9 +3872,9 @@ radv_get_preamble_cs(struct radv_queue *queue, uint32_t scratch_size_per_wave, if (i == 0) { si_cs_emit_cache_flush( cs, queue->device->physical_device->rad_info.chip_class, NULL, 0, - queue->queue_family_index == RING_COMPUTE && + queue->vk.queue_family_index == RING_COMPUTE && queue->device->physical_device->rad_info.chip_class >= GFX7, - (queue->queue_family_index == RADV_QUEUE_COMPUTE + (queue->vk.queue_family_index == RADV_QUEUE_COMPUTE ? RADV_CMD_FLAG_CS_PARTIAL_FLUSH : (RADV_CMD_FLAG_CS_PARTIAL_FLUSH | RADV_CMD_FLAG_PS_PARTIAL_FLUSH)) | RADV_CMD_FLAG_INV_ICACHE | RADV_CMD_FLAG_INV_SCACHE | RADV_CMD_FLAG_INV_VCACHE | @@ -3885,7 +3882,7 @@ radv_get_preamble_cs(struct radv_queue *queue, uint32_t scratch_size_per_wave, &sqtt_flush_bits, 0); } else if (i == 1) { si_cs_emit_cache_flush(cs, queue->device->physical_device->rad_info.chip_class, NULL, 0, - queue->queue_family_index == RING_COMPUTE && + queue->vk.queue_family_index == RING_COMPUTE && queue->device->physical_device->rad_info.chip_class >= GFX7, RADV_CMD_FLAG_INV_ICACHE | RADV_CMD_FLAG_INV_SCACHE | RADV_CMD_FLAG_INV_VCACHE | RADV_CMD_FLAG_INV_L2 | @@ -4610,8 +4607,8 @@ radv_queue_submit_deferred(struct radv_deferred_queue_submission *submission, } if (!submission->cmd_buffer_count) { - result = queue->device->ws->cs_submit(ctx, queue->queue_idx, - &queue->device->empty_cs[queue->queue_family_index], 1, + result = queue->device->ws->cs_submit(ctx, queue->vk.index_in_family, + &queue->device->empty_cs[queue->vk.queue_family_index], 1, NULL, NULL, &sem_info, false); if (result != VK_SUCCESS) goto fail; @@ -4641,7 +4638,7 @@ radv_queue_submit_deferred(struct radv_deferred_queue_submission *submission, sem_info.cs_emit_wait = j == 0; sem_info.cs_emit_signal = j + advance == submission->cmd_buffer_count; - result = queue->device->ws->cs_submit(ctx, queue->queue_idx, cs_array + j, advance, + result = queue->device->ws->cs_submit(ctx, queue->vk.index_in_family, cs_array + j, advance, initial_preamble, continue_preamble_cs, &sem_info, can_patch); if (result != VK_SUCCESS) { @@ -4862,7 +4859,8 @@ radv_queue_internal_submit(struct radv_queue *queue, struct radeon_cmdbuf *cs) return false; result = - queue->device->ws->cs_submit(ctx, queue->queue_idx, &cs, 1, NULL, NULL, &sem_info, false); + queue->device->ws->cs_submit(ctx, queue->vk.index_in_family, &cs, 1, + NULL, NULL, &sem_info, false); radv_free_sem_info(&sem_info); if (result != VK_SUCCESS) return false; @@ -4951,7 +4949,7 @@ radv_QueueSubmit(VkQueue _queue, uint32_t submitCount, const VkSubmitInfo *pSubm static const char * radv_get_queue_family_name(struct radv_queue *queue) { - switch (queue->queue_family_index) { + switch (queue->vk.queue_family_index) { case RADV_QUEUE_GENERAL: return "graphics"; case RADV_QUEUE_COMPUTE: @@ -4978,7 +4976,8 @@ radv_QueueWaitIdle(VkQueue _queue) mtx_unlock(&queue->pending_mutex); if (!queue->device->ws->ctx_wait_idle( - queue->hw_ctx, radv_queue_family_to_ring(queue->queue_family_index), queue->queue_idx)) { + queue->hw_ctx, radv_queue_family_to_ring(queue->vk.queue_family_index), + queue->vk.index_in_family)) { return radv_device_set_lost(queue->device, "Failed to wait for a '%s' queue " "to be idle. GPU hang ?", diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index bd32e21dbf0..27a87ec67b1 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -667,9 +667,6 @@ struct radv_queue { struct radv_device *device; struct radeon_winsys_ctx *hw_ctx; enum radeon_ctx_priority priority; - uint32_t queue_family_index; - int queue_idx; - VkDeviceQueueCreateFlags flags; uint32_t scratch_size_per_wave; uint32_t scratch_waves; diff --git a/src/amd/vulkan/radv_sqtt.c b/src/amd/vulkan/radv_sqtt.c index 91aef6f51c0..71c489910a3 100644 --- a/src/amd/vulkan/radv_sqtt.c +++ b/src/amd/vulkan/radv_sqtt.c @@ -507,7 +507,7 @@ bool radv_begin_thread_trace(struct radv_queue *queue) { struct radv_device *device = queue->device; - int family = queue->queue_family_index; + int family = queue->vk.queue_family_index; struct radeon_winsys *ws = device->ws; struct radeon_cmdbuf *cs; VkResult result; @@ -563,7 +563,7 @@ bool radv_end_thread_trace(struct radv_queue *queue) { struct radv_device *device = queue->device; - int family = queue->queue_family_index; + int family = queue->vk.queue_family_index; struct radeon_winsys *ws = device->ws; struct radeon_cmdbuf *cs; VkResult result; diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c index 8e9d70b56c9..c163a8124ec 100644 --- a/src/amd/vulkan/radv_wsi.c +++ b/src/amd/vulkan/radv_wsi.c @@ -252,7 +252,7 @@ radv_QueuePresentKHR(VkQueue _queue, const VkPresentInfoKHR *pPresentInfo) RADV_FROM_HANDLE(radv_queue, queue, _queue); return wsi_common_queue_present(&queue->device->physical_device->wsi_device, radv_device_to_handle(queue->device), _queue, - queue->queue_family_index, pPresentInfo); + queue->vk.queue_family_index, pPresentInfo); } VkResult