radv: init compute queue and avoid initing transfer queues
authorDave Airlie <airlied@redhat.com>
Thu, 1 Dec 2016 00:15:23 +0000 (00:15 +0000)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 18 Dec 2016 19:52:26 +0000 (20:52 +0100)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_cmd_buffer.c
src/amd/vulkan/radv_private.h
src/amd/vulkan/si_cmd_buffer.c

index 798dd6aa17183886bd3063ac157d1d5c3abb1e27..7d7f55a145b02751e33ef643d3a7df65d866a45f 100644 (file)
@@ -1393,17 +1393,33 @@ VkResult radv_BeginCommandBuffer(
 
        /* setup initial configuration into command buffer */
        if (cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY) {
-               /* Flush read caches at the beginning of CS not flushed by the kernel. */
-               cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_INV_ICACHE |
-                       RADV_CMD_FLAG_PS_PARTIAL_FLUSH |
-                       RADV_CMD_FLAG_CS_PARTIAL_FLUSH |
-                       RADV_CMD_FLAG_INV_VMEM_L1 |
-                       RADV_CMD_FLAG_INV_SMEM_L1 |
-                       RADV_CMD_FLUSH_AND_INV_FRAMEBUFFER |
-                       RADV_CMD_FLAG_INV_GLOBAL_L2;
-               si_init_config(&cmd_buffer->device->instance->physicalDevice, cmd_buffer);
-               radv_set_db_count_control(cmd_buffer);
-               si_emit_cache_flush(cmd_buffer);
+               switch (cmd_buffer->queue_family_index) {
+               case RADV_QUEUE_GENERAL:
+                       /* Flush read caches at the beginning of CS not flushed by the kernel. */
+                       cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_INV_ICACHE |
+                               RADV_CMD_FLAG_PS_PARTIAL_FLUSH |
+                               RADV_CMD_FLAG_CS_PARTIAL_FLUSH |
+                               RADV_CMD_FLAG_INV_VMEM_L1 |
+                               RADV_CMD_FLAG_INV_SMEM_L1 |
+                               RADV_CMD_FLUSH_AND_INV_FRAMEBUFFER |
+                               RADV_CMD_FLAG_INV_GLOBAL_L2;
+                       si_init_config(&cmd_buffer->device->instance->physicalDevice, cmd_buffer);
+                       radv_set_db_count_control(cmd_buffer);
+                       si_emit_cache_flush(cmd_buffer);
+                       break;
+               case RADV_QUEUE_COMPUTE:
+                       cmd_buffer->state.flush_bits = RADV_CMD_FLAG_INV_ICACHE |
+                               RADV_CMD_FLAG_CS_PARTIAL_FLUSH |
+                               RADV_CMD_FLAG_INV_VMEM_L1 |
+                               RADV_CMD_FLAG_INV_SMEM_L1 |
+                               RADV_CMD_FLAG_INV_GLOBAL_L2;
+                       si_init_compute(&cmd_buffer->device->instance->physicalDevice, cmd_buffer);
+                       si_emit_cache_flush(cmd_buffer);
+                       break;
+               case RADV_QUEUE_TRANSFER:
+               default:
+                       break;
+               }
        }
 
        if (pBeginInfo->flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) {
@@ -1539,7 +1555,8 @@ VkResult radv_EndCommandBuffer(
 {
        RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
 
-       si_emit_cache_flush(cmd_buffer);
+       if (cmd_buffer->queue_family_index != RADV_QUEUE_TRANSFER)
+               si_emit_cache_flush(cmd_buffer);
        if (!cmd_buffer->device->ws->cs_finalize(cmd_buffer->cs) ||
            cmd_buffer->record_fail)
                return VK_ERROR_OUT_OF_DEVICE_MEMORY;
index 849c54006d4d22bd2a6f0041c97f2c486ba5cfc6..e6f6c29c919be911f5094a4588272e18b61496a0 100644 (file)
@@ -720,6 +720,8 @@ struct radv_image;
 
 bool radv_cmd_buffer_uses_mec(struct radv_cmd_buffer *cmd_buffer);
 
+void si_init_compute(struct radv_physical_device *physical_device,
+                    struct radv_cmd_buffer *cmd_buffer);
 void si_init_config(struct radv_physical_device *physical_device,
                    struct radv_cmd_buffer *cmd_buffer);
 void si_write_viewport(struct radeon_winsys_cs *cs, int first_vp,
index a61a950de682c0008dabea01c586e9f5d62b0513..5ac2a148096841bbf645904244c240f306a487a5 100644 (file)
@@ -170,10 +170,11 @@ si_write_harvested_raster_configs(struct radv_physical_device *physical_device,
                                       S_030800_INSTANCE_BROADCAST_WRITES(1));
 }
 
-static void
+void
 si_init_compute(struct radv_physical_device *physical_device,
-                struct radeon_winsys_cs *cs)
+                struct radv_cmd_buffer *cmd_buffer)
 {
+       struct radeon_winsys_cs *cs = cmd_buffer->cs;
        radeon_set_sh_reg_seq(cs, R_00B810_COMPUTE_START_X, 3);
        radeon_emit(cs, 0);
        radeon_emit(cs, 0);
@@ -419,7 +420,7 @@ void si_init_config(struct radv_physical_device *physical_device,
        if (physical_device->rad_info.family == CHIP_STONEY)
                radeon_set_context_reg(cs, R_028C40_PA_SC_SHADER_CONTROL, 0);
 
-       si_init_compute(physical_device, cs);
+       si_init_compute(physical_device, cmd_buffer);
 }
 
 static void