From 22b512ea5b11c3b02f488d7143556eb0ef8c1303 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 4 Oct 2019 00:55:43 +0300 Subject: [PATCH] intel/dump_gpu: add an only-capture option This option allows for smaller aub files to be generated by only storing the BOs flagged with EXEC_OBJECT_CAPTURE. Signed-off-by: Lionel Landwerlin Reviewed-by: Kenneth Graunke Part-of: --- src/intel/tools/intel_dump_gpu.c | 7 ++++++- src/intel/tools/intel_dump_gpu.in | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/intel/tools/intel_dump_gpu.c b/src/intel/tools/intel_dump_gpu.c index ba4d2b8a084..050ec78e3b8 100644 --- a/src/intel/tools/intel_dump_gpu.c +++ b/src/intel/tools/intel_dump_gpu.c @@ -59,6 +59,7 @@ static char *output_filename = NULL; static FILE *output_file = NULL; static int verbose = 0; static bool device_override = false; +static bool capture_only = false; #define MAX_FD_COUNT 64 #define MAX_BO_COUNT 64 * 1024 @@ -293,7 +294,9 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2) else data = bo->map; - if (bo->dirty) { + bool write = !capture_only || (obj->flags & EXEC_OBJECT_CAPTURE); + + if (write && bo->dirty) { if (bo == batch_bo) { aub_write_trace_block(&aub_file, AUB_TRACE_TYPE_BATCH, GET_PTR(data), bo->size, bo->offset); @@ -420,6 +423,8 @@ maybe_init(int fd) fail_if(output_file == NULL, "failed to open file '%s'\n", output_filename); + } else if (!strcmp(key, "capture_only")) { + capture_only = atoi(value); } else { fprintf(stderr, "unknown option '%s'\n", key); } diff --git a/src/intel/tools/intel_dump_gpu.in b/src/intel/tools/intel_dump_gpu.in index 060c21c592b..3efa0d4c76e 100755 --- a/src/intel/tools/intel_dump_gpu.in +++ b/src/intel/tools/intel_dump_gpu.in @@ -16,6 +16,10 @@ contents and execution of the GEM application. -p, --platform=NAME Override PCI ID using a platform name + -c, --only-capture Only write objects flagged with EXEC_OBJECT_CAPTURE into + the output aub file. This helps reducing output file + size greatly but won't produce a file replayable + -v Enable verbose output -vv Enable extra verbosity - dumps gtt mappings @@ -31,6 +35,7 @@ ld_preload="@install_libexecdir@/libintel_dump_gpu.so${LD_PRELOAD:+:$LD_PRELOAD} args="" file="" gdb="" +capture_only="" function add_arg() { arg=$1 @@ -89,6 +94,14 @@ while true; do gdb=1 shift ;; + -c) + add_arg "capture_only=1" + shift + ;; + --only-capture) + add_arg "capture_only=1" + shift + ;; --help) show_help ;; -- 2.30.2