radv: add support for VK_AMD_buffer_marker
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 21 Jun 2019 14:17:22 +0000 (16:17 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 24 Jun 2019 08:50:54 +0000 (10:50 +0200)
This simple extension might be useful for debugging purposes.
GAPID has support for it.

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_extensions.py

index 9b4d4528028902aa71c0100f19ee7eaec5227d2b..215ccced1449a15af382d05ab1081f6e335f430d 100644 (file)
@@ -5716,3 +5716,38 @@ void radv_CmdDrawIndirectByteCountEXT(
 
        radv_draw(cmd_buffer, &info);
 }
+
+/* VK_AMD_buffer_marker */
+void radv_CmdWriteBufferMarkerAMD(
+    VkCommandBuffer                             commandBuffer,
+    VkPipelineStageFlagBits                     pipelineStage,
+    VkBuffer                                    dstBuffer,
+    VkDeviceSize                                dstOffset,
+    uint32_t                                    marker)
+{
+       RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
+       RADV_FROM_HANDLE(radv_buffer, buffer, dstBuffer);
+       struct radeon_cmdbuf *cs = cmd_buffer->cs;
+       uint64_t va = radv_buffer_get_va(buffer->bo) + dstOffset;
+
+       si_emit_cache_flush(cmd_buffer);
+
+       if (!(pipelineStage & ~VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT)) {
+               radeon_emit(cs, PKT3(PKT3_COPY_DATA, 4, 0));
+               radeon_emit(cs, COPY_DATA_SRC_SEL(COPY_DATA_IMM) |
+                               COPY_DATA_DST_SEL(COPY_DATA_DST_MEM) |
+                               COPY_DATA_WR_CONFIRM);
+               radeon_emit(cs, marker);
+               radeon_emit(cs, 0);
+               radeon_emit(cs, va);
+               radeon_emit(cs, va >> 32);
+       } else {
+               si_cs_emit_write_event_eop(cs,
+                                          cmd_buffer->device->physical_device->rad_info.chip_class,
+                                          radv_cmd_buffer_uses_mec(cmd_buffer),
+                                          V_028A90_BOTTOM_OF_PIPE_TS, 0,
+                                          EOP_DATA_SEL_VALUE_32BIT,
+                                          va, marker,
+                                          cmd_buffer->gfx9_eop_bug_va);
+       }
+}
index b676cb8b8e2de5791659347d606ae2eadf7440e9..1708173817b265a68bcb4ae96779d3249785f9a8 100644 (file)
@@ -130,6 +130,7 @@ EXTENSIONS = [
     Extension('VK_EXT_transform_feedback',                1, True),
     Extension('VK_EXT_vertex_attribute_divisor',          3, True),
     Extension('VK_EXT_ycbcr_image_arrays',                1, True),
+    Extension('VK_AMD_buffer_marker',                     1, True),
     Extension('VK_AMD_draw_indirect_count',               1, True),
     Extension('VK_AMD_gcn_shader',                        1, True),
     Extension('VK_AMD_gpu_shader_half_float',             1, 'device->rad_info.chip_class >= GFX8 && HAVE_LLVM >= 0x0800'),