radv: save all descriptor pointers into the trace BO
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 11 Sep 2017 14:12:15 +0000 (16:12 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 14 Sep 2017 08:37:57 +0000 (10:37 +0200)
To dump them when a hang is detected.

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_debug.c

index 2f72b2bbcea80538f9f795a13fcea06d825cb48c..068247d04d4a25a9caa8475cccd8efcb6223f2f4 100644 (file)
@@ -421,6 +421,35 @@ radv_save_pipeline(struct radv_cmd_buffer *cmd_buffer,
        radv_emit_write_data_packet(cs, va, 2, data);
 }
 
+static void
+radv_save_descriptors(struct radv_cmd_buffer *cmd_buffer)
+{
+       struct radv_device *device = cmd_buffer->device;
+       struct radeon_winsys_cs *cs = cmd_buffer->cs;
+       uint32_t data[MAX_SETS * 2] = {};
+       uint64_t va;
+
+       if (!device->trace_bo)
+               return;
+
+       va = device->ws->buffer_get_va(device->trace_bo) + 24;
+
+       MAYBE_UNUSED unsigned cdw_max = radeon_check_space(device->ws,
+                                                          cmd_buffer->cs, 4 + MAX_SETS * 2);
+
+       for (int i = 0; i < MAX_SETS; i++) {
+               struct radv_descriptor_set *set = cmd_buffer->state.descriptors[i];
+               if (!set)
+                       continue;
+
+               data[i * 2] = (uintptr_t)set;
+               data[i * 2 + 1] = (uintptr_t)set >> 32;
+       }
+
+       device->ws->cs_add_buffer(cs, device->trace_bo, 8);
+       radv_emit_write_data_packet(cs, va, MAX_SETS * 2, data);
+}
+
 static void
 radv_emit_graphics_blend_state(struct radv_cmd_buffer *cmd_buffer,
                               struct radv_pipeline *pipeline)
@@ -1580,6 +1609,9 @@ radv_flush_descriptors(struct radv_cmd_buffer *cmd_buffer,
        }
        cmd_buffer->state.descriptors_dirty = 0;
        cmd_buffer->state.push_descriptors_dirty = false;
+
+       radv_save_descriptors(cmd_buffer);
+
        assert(cmd_buffer->cs->cdw <= cdw_max);
 }
 
index 733374cbb7c21a4c84d8ef86ef994a2dbf3f46a4..397a9ef4214b2aaa9c1e15fb38fd8b5f49226b16 100644 (file)
@@ -48,6 +48,9 @@
  * [1]: secondary trace ID
  * [2-3]: 64-bit GFX pipeline pointer
  * [4-5]: 64-bit COMPUTE pipeline pointer
+ * [6-7]: 64-bit descriptor set #0 pointer
+ * ...
+ * [68-69]: 64-bit descriptor set #31 pointer
  */
 
 bool