radv: optimize calling radv_cmd_buffer_trace_emit()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 10 Nov 2017 08:18:04 +0000 (09:18 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 13 Nov 2017 10:05:38 +0000 (11:05 +0100)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_cmd_buffer.c
src/amd/vulkan/radv_meta_buffer.c
src/amd/vulkan/si_cmd_buffer.c

index 0478b2f196db6ae2172ecd41ce1cd8c7e35776e2..45fe51a2b9bccd789c3538e51a9f7d21751f7474 100644 (file)
@@ -402,9 +402,6 @@ void radv_cmd_buffer_trace_emit(struct radv_cmd_buffer *cmd_buffer)
        struct radeon_winsys_cs *cs = cmd_buffer->cs;
        uint64_t va;
 
-       if (!device->trace_bo)
-               return;
-
        va = radv_buffer_get_va(device->trace_bo);
        if (cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_SECONDARY)
                va += 4;
@@ -435,7 +432,8 @@ radv_cmd_buffer_after_draw(struct radv_cmd_buffer *cmd_buffer)
                                       flags);
        }
 
-       radv_cmd_buffer_trace_emit(cmd_buffer);
+       if (unlikely(cmd_buffer->device->trace_bo))
+               radv_cmd_buffer_trace_emit(cmd_buffer);
 }
 
 static void
@@ -2254,7 +2252,9 @@ VkResult radv_BeginCommandBuffer(
                radv_cmd_buffer_set_subpass(cmd_buffer, subpass, false);
        }
 
-       radv_cmd_buffer_trace_emit(cmd_buffer);
+       if (unlikely(cmd_buffer->device->trace_bo))
+               radv_cmd_buffer_trace_emit(cmd_buffer);
+
        return result;
 }
 
index 41cdc76b95b8f8fe2ad5ac00f829ffb339ab61bd..e6ad235e93b840b96b56992da5d8c449c896ae1e 100644 (file)
@@ -525,7 +525,8 @@ void radv_CmdUpdateBuffer(
                radeon_emit(cmd_buffer->cs, va >> 32);
                radeon_emit_array(cmd_buffer->cs, pData, words);
 
-               radv_cmd_buffer_trace_emit(cmd_buffer);
+               if (unlikely(cmd_buffer->device->trace_bo))
+                       radv_cmd_buffer_trace_emit(cmd_buffer);
        } else {
                uint32_t buf_offset;
                radv_cmd_buffer_upload_data(cmd_buffer, dataSize, 32, pData, &buf_offset);
index 89ee399817db79b1630cc027662ab255833aeb84..e61f5b8fa476a0df35178f37404d17116f0fb264 100644 (file)
@@ -1126,7 +1126,9 @@ si_emit_cache_flush(struct radv_cmd_buffer *cmd_buffer)
                               cmd_buffer->state.flush_bits);
 
 
-       radv_cmd_buffer_trace_emit(cmd_buffer);
+       if (unlikely(cmd_buffer->device->trace_bo))
+               radv_cmd_buffer_trace_emit(cmd_buffer);
+
        cmd_buffer->state.flush_bits = 0;
 }
 
@@ -1250,7 +1252,8 @@ static void si_emit_cp_dma(struct radv_cmd_buffer *cmd_buffer,
                radeon_emit(cs, 0);
        }
 
-       radv_cmd_buffer_trace_emit(cmd_buffer);
+       if (unlikely(cmd_buffer->device->trace_bo))
+               radv_cmd_buffer_trace_emit(cmd_buffer);
 }
 
 void si_cp_dma_prefetch(struct radv_cmd_buffer *cmd_buffer, uint64_t va,