From: Kevin Rogovin <kevin.rogo...@intel.com> Signed-off-by: Kevin Rogovin <kevin.rogo...@intel.com> --- src/intel/Makefile.tools.am | 8 ++ src/intel/tools/.gitignore | 1 + src/intel/tools/i965_batchbuffer_logger_sh.in | 108 ++++++++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 src/intel/tools/i965_batchbuffer_logger_sh.in
diff --git a/src/intel/Makefile.tools.am b/src/intel/Makefile.tools.am index c308b816f9..062c225c89 100644 --- a/src/intel/Makefile.tools.am +++ b/src/intel/Makefile.tools.am @@ -19,6 +19,7 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. +intelbindir = $(bindir) intellibdir = $(libdir) intelincludedir = $(includedir) @@ -29,6 +30,9 @@ noinst_PROGRAMS += \ intellib_LTLIBRARIES = \ tools/libi965_batchbuffer_logger.la +intelbin_SCRIPTS = tools/i965_batchbuffer_logger_sh +CLEANFILES += $(intelbin_SCRIPTS) + intelinclude_HEADERS = tools/i965_batchbuffer_logger_app.h \ tools/i965_batchbuffer_logger_output.h @@ -90,3 +94,7 @@ tools_libi965_batchbuffer_logger_la_CXXFLAGS = \ tools_libi965_batchbuffer_logger_la_LDFLAGS = \ -no-undefined -module -avoid-version -shared -shrext .so + +intel_sed_prefix_vars = sed -e 's,[@]libdir[@],$(intellibdir),g' +tools/i965_batchbuffer_logger_sh: tools/i965_batchbuffer_logger_sh.in + $(intel_sed_prefix_vars) < tools/i965_batchbuffer_logger_sh.in > tools/i965_batchbuffer_logger_sh diff --git a/src/intel/tools/.gitignore b/src/intel/tools/.gitignore index 27437f9eef..fa9bf70808 100644 --- a/src/intel/tools/.gitignore +++ b/src/intel/tools/.gitignore @@ -1,2 +1,3 @@ /aubinator /aubinator_error_decode +/i965_batchbuffer_logger_sh diff --git a/src/intel/tools/i965_batchbuffer_logger_sh.in b/src/intel/tools/i965_batchbuffer_logger_sh.in new file mode 100644 index 0000000000..0746173417 --- /dev/null +++ b/src/intel/tools/i965_batchbuffer_logger_sh.in @@ -0,0 +1,108 @@ +#!/bin/bash +# -*- mode: sh -*- + +function show_help() { + cat <<EOF +Usage: i965_batchbuffer_logger [OPTION]... [--] COMMAND ARGUMENTS + +Run COMMAND with ARGUMENTS where COMMAND is an application using +the i965_batchbuffer_logger_app interface to provide API calling +information to hook into a batchbuffer log. + + -d level Select batchbuffer decode level, where level is one of + the following. + no_decode : do not decode batchbuffer contents + instruction_decode : only decode the name of each GPU + command + instruction_details_decode: decode the name and contents + of each GPU command + + -before-ioctl Emit batchbuffer log data BEFORE sending execbuffer2 ioctl + commands to the kernel + + -send-object-capture For those execbuffer2 ioctl commands with I915_EXEC_BATCH_FIRST + set, add an EXEC_OBJECT_CAPTURE exec_object2 whose contents + is a string indicating the execbuffer2 ioctl ID + + -emit-total-stats filename Emit -total- counts of GPU commands sent to + GPU to named file + + -shader-file instead of placing the assembly of the shaders directly + in the log, save the assembly of each shader -binary- + to a file + + -r level Select the level to record in the log the relocation data, + where level is one of the following. + print_reloc_gem_gpu_updates : log reloc information + print_reloc_nothing : do not log reloc information + + -pciid pciid Give a hexadecimal value of the PCI ID value for + the GPU the BatchbufferLogger to decode for; this + value is used if and only if the driver fails to + tell the BatchbufferLogger a valid PCI ID value to + use + + --help Display this help message and exit + +EOF + + exit 0 +} + +function set_var() { + export $1=$2 +} + +while true; do + case "$1" in + -d) + set_var "I965_DECODE_LEVEL" "$2" + shift 2 + ;; + -before-ioctl) + set_var "I965_DECODE_BEFORE_IOCTL" "1" + shift 1 + ;; + -send-object-capture) + set_var "I965_DECODE_BEFORE_IOCTL" "1" + set_var "I965_EMIT_CAPTURE_EXECOBJ_BATCHBUFFER_IDENTIFIER" "1" + shift 1 + ;; + -emit-total-stats) + set_var "I965_EMIT_TOTAL_STATS" "$2" + shift 2 + ;; + -r) + set_var "I965_PRINT_RELOC_LEVEL" "$2" + shift 2 + ;; + -pciid) + set_var "I965_PCI_ID" "$2" + shift 2 + ;; + -shader-file) + set_var "I965_DECODE_SHADERS" "0" + shift 1 + ;; + -h) + show_help + ;; + --help) + show_help + ;; + --) + shift + break + ;; + *) + break + ;; + esac +done + +[ -z $1 ] && show_help + +libdir=@libdir@ + +export LD_PRELOAD=${libdir}/libi965_batchbuffer_logger.so:$LD_PRELOAD +exec -- "$@" -- 2.14.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev