[Intel-gfx] [PATCH 6/6] intel_aubdump: Add --no-exec command option

Jordan Justen jordan.l.justen at intel.com
Thu Sep 14 01:11:00 UTC 2017


In some cases it is preferable to not send exec commands to the
kernel, but to otherwise record the exec command into the AUB file.

For example, when using the --device override option, it might be best
to avoid passing the EXEC ioctls through to the kernel.

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 tools/aubdump.c        | 13 +++++++++++--
 tools/intel_aubdump.in |  7 +++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/tools/aubdump.c b/tools/aubdump.c
index 4392e589..6961cd51 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -58,6 +58,7 @@ static int gen = 0;
 static int verbose = 0;
 static bool device_override;
 static uint32_t device;
+static bool no_exec = false;
 
 #define MAX_BO_COUNT 64 * 1024
 
@@ -567,6 +568,8 @@ maybe_init(void)
 				"intel_aubdump: failed to parse device id '%s'",
 				value);
 			device_override = true;
+		} else if (!strcmp(key, "no_exec")) {
+			no_exec = true;
 		} else if (!strcmp(key, "file")) {
 			filename = strdup(value);
 			files[0] = fopen(filename, "w+");
@@ -645,7 +648,10 @@ ioctl(int fd, unsigned long request, ...)
 					"application uses DRM_IOCTL_I915_GEM_EXECBUFFER, not handled\n");
 				once = true;
 			}
-			return libc_ioctl(fd, request, argp);
+			if (verbose && no_exec)
+				printf("Skipping DRM_IOCTL_I915_GEM_EXECBUFFER "
+				       "ioctl (--no-exec)\n");
+			return no_exec ? 0 : libc_ioctl(fd, request, argp);
 		}
 
 		case DRM_IOCTL_I915_GEM_EXECBUFFER2:
@@ -654,7 +660,10 @@ ioctl(int fd, unsigned long request, ...)
 			if (device_override)
 				return 0;
 
-			return libc_ioctl(fd, request, argp);
+			if (verbose && no_exec)
+				printf("Skipping DRM_IOCTL_I915_GEM_EXECBUFFER2 "
+				       "ioctl (--no-exec)\n");
+			return no_exec ? 0 : libc_ioctl(fd, request, argp);
 		}
 
 		case DRM_IOCTL_I915_GEM_CREATE: {
diff --git a/tools/intel_aubdump.in b/tools/intel_aubdump.in
index 8bc6b19d..ce77c849 100755
--- a/tools/intel_aubdump.in
+++ b/tools/intel_aubdump.in
@@ -15,6 +15,9 @@ contents and execution of the GEM application.
 
       --device=ID    Override PCI ID of the reported device
 
+  -n, --no-exec      Record exec commands in the AUB file, but don't send
+                     them to the kernel
+
   -v                 Enable verbose output
 
       --help         Display this help message and exit
@@ -79,6 +82,10 @@ while true; do
 	      add_arg "device=${1##--device=}"
 	      shift
 	      ;;
+	  -n|--no-exec)
+	      add_arg "no_exec=1"
+	      shift
+	      ;;
 	  --help)
 	      show_help
 	      ;;
-- 
2.14.1



More information about the Intel-gfx mailing list