radv: move RADV_TRACE_FILE functions to radv_debug.c

At the moment, debugging radv is not really easy because the
driver doesn't report enough information when it hangs. This
new file will be the main location for all debug tools.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
Samuel Pitoiset
2017-08-30 15:12:20 +02:00
parent f1f2f00f6a
commit ad42e2abb8
9 changed files with 80 additions and 23 deletions

View File

@@ -29,6 +29,7 @@
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include "radv_debug.h"
#include "radv_private.h"
#include "radv_cs.h"
#include "util/disk_cache.h"
@@ -1214,13 +1215,7 @@ VkResult radv_CreateDevice(
}
if (getenv("RADV_TRACE_FILE")) {
device->trace_bo = device->ws->buffer_create(device->ws, 4096, 8,
RADEON_DOMAIN_VRAM, RADEON_FLAG_CPU_ACCESS);
if (!device->trace_bo)
goto fail;
device->trace_id_ptr = device->ws->buffer_map(device->trace_bo);
if (!device->trace_id_ptr)
if (!radv_init_trace(device))
goto fail;
}
@@ -1378,21 +1373,6 @@ void radv_GetDeviceQueue(
*pQueue = radv_queue_to_handle(&device->queues[queueFamilyIndex][queueIndex]);
}
static void radv_dump_trace(struct radv_device *device,
struct radeon_winsys_cs *cs)
{
const char *filename = getenv("RADV_TRACE_FILE");
FILE *f = fopen(filename, "w");
if (!f) {
fprintf(stderr, "Failed to write trace dump to %s\n", filename);
return;
}
fprintf(f, "Trace ID: %x\n", *device->trace_id_ptr);
device->ws->cs_dump(cs, f, (const int*)device->trace_id_ptr, 2);
fclose(f);
}
static void
fill_geom_tess_rings(struct radv_queue *queue,
uint32_t *map,