<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">No worries, I should have removed it
when I included the tool.<br>
<br>
Sending a v2.<br>
<br>
On 18/07/18 17:13, Jason Ekstrand wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAOFGe97EQaKY9s+W1C52A54iKR14ycfQWdwuDAegKvs4p7fzKg@mail.gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr">I'm happy for us to do this and it would have made
my life easier when refactoring the aub_write code.
Unfortunately, since I just landed that, this will need some
rebasing. Sorry, I didn't realize how you'd intended things to
be ordered before I landed my refactors. :-(<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Wed, Jul 18, 2018 at 7:20 AM Lionel Landwerlin
<<a href="mailto:lionel.g.landwerlin@intel.com"
moz-do-not-send="true">lionel.g.landwerlin@intel.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">In commit
86cb05a6d35a52 ("intel: aubinator: remove standard input<br>
processing option") we removed the ability to process aub as
an input<br>
stream because we're now rely on mmapping the aub file to back
the<br>
buffer aubinator is parsing.<br>
<br>
intel_aubdump was the provider of the standard input data and
since<br>
we've copied/reworked intel_aubdump into intel_dump_gpu within
Mesa,<br>
we don't that code anymore.<br>
<br>
Signed-off-by: Lionel Landwerlin <<a
href="mailto:lionel.g.landwerlin@intel.com" target="_blank"
moz-do-not-send="true">lionel.g.landwerlin@intel.com</a>><br>
---<br>
src/intel/tools/intel_dump_gpu.c | 73
++++---------------------------<br>
src/intel/tools/<a href="http://intel_dump_gpu.in"
rel="noreferrer" target="_blank" moz-do-not-send="true">intel_dump_gpu.in</a>
| 27 +-----------<br>
2 files changed, 10 insertions(+), 90 deletions(-)<br>
<br>
diff --git a/src/intel/tools/intel_dump_gpu.c
b/src/intel/tools/intel_dump_gpu.c<br>
index 766ba662d91..6758cab13c4 100644<br>
--- a/src/intel/tools/intel_dump_gpu.c<br>
+++ b/src/intel/tools/intel_dump_gpu.c<br>
@@ -254,7 +254,7 @@ static int (*libc_ioctl)(int fd, unsigned
long request, ...) = ioctl_init_helper<br>
<br>
static int drm_fd = -1;<br>
static char *filename = NULL;<br>
-static FILE *files[2] = { NULL, NULL };<br>
+static FILE *aub_file = NULL;<br>
static struct gen_device_info devinfo = {0};<br>
static int verbose = 0;<br>
static bool device_override;<br>
@@ -320,13 +320,8 @@ align_u32(uint32_t v, uint32_t a)<br>
static void<br>
dword_out(uint32_t data)<br>
{<br>
- for (int i = 0; i < ARRAY_SIZE (files); i++) {<br>
- if (files[i] == NULL)<br>
- continue;<br>
-<br>
- fail_if(fwrite(&data, 1, 4, files[i]) == 0,<br>
- "Writing to output failed\n");<br>
- }<br>
+ fail_if(fwrite(&data, 1, 4, aub_file) == 0,<br>
+ "Writing to output failed\n");<br>
}<br>
<br>
static void<br>
@@ -335,13 +330,8 @@ data_out(const void *data, size_t size)<br>
if (size == 0)<br>
return;<br>
<br>
- for (int i = 0; i < ARRAY_SIZE (files); i++) {<br>
- if (files[i] == NULL)<br>
- continue;<br>
-<br>
- fail_if(fwrite(data, 1, size, files[i]) == 0,<br>
- "Writing to output failed\n");<br>
- }<br>
+ fail_if(fwrite(data, 1, size, aub_file) == 0,<br>
+ "Writing to output failed\n");<br>
}<br>
<br>
static uint32_t<br>
@@ -990,10 +980,7 @@ dump_execbuffer2(int fd, struct
drm_i915_gem_execbuffer2 *execbuffer2)<br>
ring_flag);<br>
}<br>
<br>
- for (int i = 0; i < ARRAY_SIZE(files); i++) {<br>
- if (files[i] != NULL)<br>
- fflush(files[i]);<br>
- }<br>
+ fflush(aub_file);<br>
<br>
if (device_override &&<br>
(execbuffer2->flags & I915_EXEC_FENCE_ARRAY) !=
0) {<br>
@@ -1044,40 +1031,6 @@ close(int fd)<br>
return libc_close(fd);<br>
}<br>
<br>
-static FILE *<br>
-launch_command(char *command)<br>
-{<br>
- int i = 0, fds[2];<br>
- char **args = calloc(strlen(command), sizeof(char *));<br>
- char *iter = command;<br>
-<br>
- args[i++] = iter = command;<br>
-<br>
- while ((iter = strstr(iter, ",")) != NULL) {<br>
- *iter = '\0';<br>
- iter += 1;<br>
- args[i++] = iter;<br>
- }<br>
-<br>
- if (pipe(fds) == -1)<br>
- return NULL;<br>
-<br>
- switch (fork()) {<br>
- case 0:<br>
- dup2(fds[0], 0);<br>
- fail_if(execvp(args[0], args) == -1,<br>
- "intel_aubdump: failed to launch child
command\n");<br>
- return NULL;<br>
-<br>
- default:<br>
- free(args);<br>
- return fdopen(fds[1], "w");<br>
-<br>
- case -1:<br>
- return NULL;<br>
- }<br>
-}<br>
-<br>
static void<br>
maybe_init(void)<br>
{<br>
@@ -1105,15 +1058,10 @@ maybe_init(void)<br>
device_override = true;<br>
} else if (!strcmp(key, "file")) {<br>
filename = strdup(value);<br>
- files[0] = fopen(filename, "w+");<br>
- fail_if(files[0] == NULL,<br>
+ aub_file = fopen(filename, "w+");<br>
+ fail_if(aub_file == NULL,<br>
"intel_aubdump: failed to open file '%s'\n",<br>
filename);<br>
- } else if (!strcmp(key, "command")) {<br>
- files[1] = launch_command(value);<br>
- fail_if(files[1] == NULL,<br>
- "intel_aubdump: failed to launch command
'%s'\n",<br>
- value);<br>
} else {<br>
fprintf(stderr, "intel_aubdump: unknown option
'%s'\n", key);<br>
}<br>
@@ -1285,9 +1233,6 @@ static void __attribute__ ((destructor))<br>
fini(void)<br>
{<br>
free(filename);<br>
- for (int i = 0; i < ARRAY_SIZE(files); i++) {<br>
- if (files[i] != NULL)<br>
- fclose(files[i]);<br>
- }<br>
+ fclose(aub_file);<br>
free(bos);<br>
}<br>
diff --git a/src/intel/tools/<a
href="http://intel_dump_gpu.in" rel="noreferrer"
target="_blank" moz-do-not-send="true">intel_dump_gpu.in</a>
b/src/intel/tools/<a href="http://intel_dump_gpu.in"
rel="noreferrer" target="_blank" moz-do-not-send="true">intel_dump_gpu.in</a><br>
index b9887f0ed2e..9eea37189db 100755<br>
--- a/src/intel/tools/<a href="http://intel_dump_gpu.in"
rel="noreferrer" target="_blank" moz-do-not-send="true">intel_dump_gpu.in</a><br>
+++ b/src/intel/tools/<a href="http://intel_dump_gpu.in"
rel="noreferrer" target="_blank" moz-do-not-send="true">intel_dump_gpu.in</a><br>
@@ -10,9 +10,6 @@ contents and execution of the GEM
application.<br>
<br>
-o, --output=FILE Name of AUB file. Defaults to
COMMAND.aub<br>
<br>
- -c, --command=CMD Execute CMD and write the AUB file's
content to its<br>
- standard input<br>
-<br>
--device=ID Override PCI ID of the reported device<br>
<br>
-v Enable verbose output<br>
@@ -27,7 +24,6 @@ EOF<br>
}<br>
<br>
args=""<br>
-command=""<br>
file=""<br>
<br>
function add_arg() {<br>
@@ -35,17 +31,6 @@ function add_arg() {<br>
args="$args$arg\n"<br>
}<br>
<br>
-function build_command () {<br>
- command=""<br>
- for i in $1; do<br>
- if [ -z $command ]; then<br>
- command=$i<br>
- else<br>
- command="$command,$i"<br>
- fi;<br>
- done<br>
-}<br>
-<br>
while true; do<br>
case "$1" in<br>
-o)<br>
@@ -71,16 +56,6 @@ while true; do<br>
add_arg "file=${<a class="moz-txt-link-freetext" href="file:-$(basename">file:-$(basename</a> ${file}).aub}"<br>
shift<br>
;;<br>
- -c)<br>
- build_command "$2"<br>
- add_arg "command=$command"<br>
- shift 2<br>
- ;;<br>
- --command=*)<br>
- build_command "${1##--command=}"<br>
- add_arg "command=$command"<br>
- shift<br>
- ;;<br>
--device=*)<br>
add_arg "device=${1##--device=}"<br>
shift<br>
@@ -105,7 +80,7 @@ done<br>
<br>
[ -z $1 ] && show_help<br>
<br>
-[ -z $file ] && [ -z $command ] && add_arg
"file=intel.aub"<br>
+[ -z $file ] && add_arg "file=intel.aub"<br>
<br>
LD_PRELOAD=<a class="moz-txt-link-rfc2396E" href="mailto:@install_libexecdir@/libintel_dump_gpu.so${LD_PPRELOAD:+:$LD_PRELOAD}">"@install_libexecdir@/libintel_dump_gpu.so${LD_PPRELOAD:+:$LD_PRELOAD}"</a>
\<br>
exec -- "$@" 3<<EOF<br>
-- <br>
2.18.0<br>
<br>
</blockquote>
</div>
</blockquote>
<p><br>
</p>
</body>
</html>