intel: tools: import intel_aubdump

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Rafael Antognolli <rafael.antognolli@intel.com>
This commit is contained in:
Lionel Landwerlin 2018-06-16 17:42:13 +01:00
parent fa00b9c1c9
commit 6e37b949d5
4 changed files with 1440 additions and 0 deletions

View File

@ -71,6 +71,8 @@ EXTRA_DIST = \
isl/meson.build \
tools/intel_sanitize_gpu.c \
tools/intel_sanitize_gpu.in \
tools/intel_dump_gpu.c \
tools/intel_dump_gpu.in \
tools/meson.build \
vulkan/meson.build \
meson.build

File diff suppressed because it is too large Load Diff

107
src/intel/tools/intel_dump_gpu.in Executable file
View File

@ -0,0 +1,107 @@
#!/bin/bash
# -*- mode: sh -*-
function show_help() {
cat <<EOF
Usage: intel_dump_gpu [OPTION]... [--] COMMAND ARGUMENTS
Run COMMAND with ARGUMENTS and dump an AUB file that captures buffer
contents and execution of the GEM application.
-o, --output=FILE Name of AUB file. Defaults to COMMAND.aub
-c, --command=CMD Execute CMD and write the AUB file's content to its
standard input
--device=ID Override PCI ID of the reported device
-v Enable verbose output
--help Display this help message and exit
EOF
exit 0
}
args=""
command=""
file=""
function add_arg() {
arg=$1
args="$args$arg\n"
}
function build_command () {
command=""
for i in $1; do
if [ -z $command ]; then
command=$i
else
command="$command,$i"
fi;
done
}
while true; do
case "$1" in
-o)
file=$2
add_arg "file=${file:-$(basename ${file}).aub}"
shift 2
;;
-v)
add_arg "verbose=1"
shift 1
;;
-o*)
file=${1##-o}
add_arg "file=${file:-$(basename ${file}).aub}"
shift
;;
--output=*)
file=${1##--output=}
add_arg "file=${file:-$(basename ${file}).aub}"
shift
;;
-c)
build_command "$2"
add_arg "command=$command"
shift 2
;;
--command=*)
build_command "${1##--command=}"
add_arg "command=$command"
shift
;;
--device=*)
add_arg "device=${1##--device=}"
shift
;;
--help)
show_help
;;
--)
shift
break
;;
-*)
echo "intel_aubdump: invalid option: $1"
echo
show_help
;;
*)
break
;;
esac
done
[ -z $1 ] && show_help
[ -z $file ] && [ -z $command ] && add_arg "file=intel.aub"
LD_PRELOAD="@install_libexecdir@/libintel_dump_gpu.so${LD_PPRELOAD:+:$LD_PRELOAD}" \
exec -- "$@" 3<<EOF
`echo -e $args`
EOF

View File

@ -63,4 +63,22 @@ if with_tools.contains('intel')
install_dir: get_option('libexecdir'),
install: true,
)
configure_file(
input : 'intel_dump_gpu.in',
output : '@BASENAME@',
install_dir: get_option('bindir'),
configuration: sanitize_data,
)
libintel_dump_gpu = shared_library(
'intel_dump_gpu',
files('intel_dump_gpu.c'),
dependencies : dep_dl,
include_directories : [inc_common, inc_intel, inc_drm_uapi],
link_with : libintel_dev,
c_args : [c_vis_args, no_override_init_args],
install_dir: get_option('libexecdir'),
install : true
)
endif