[Mesa-dev] [PATCH 11/16] intel/tools/BatchbufferLogger: install i965_batchbuffer non-driver interface headers

kevin.rogovin at intel.com kevin.rogovin at intel.com
Tue Dec 12 07:44:12 UTC 2017


From: Kevin Rogovin <kevin.rogovin at intel.com>

Signed-off-by: Kevin Rogovin <kevin.rogovin at intel.com>
---
 src/intel/Makefile.tools.am                   |  12 +++
 src/intel/tools/.gitignore                    |   1 +
 src/intel/tools/i965_batchbuffer_logger_sh.in | 108 ++++++++++++++++++++++++++
 3 files changed, 121 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 270463589d..f5eda31a5c 100644
--- a/src/intel/Makefile.tools.am
+++ b/src/intel/Makefile.tools.am
@@ -19,7 +19,9 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
+intelbindir = $(bindir)
 intellibdir = $(libdir)
+intelincludedir = $(includedir)
 
 noinst_PROGRAMS += \
 	tools/aubinator \
@@ -28,6 +30,12 @@ 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
+
 tools_aubinator_SOURCES = \
 	tools/aubinator.c \
 	tools/disasm.c \
@@ -86,3 +94,7 @@ tools_libi965_batchbuffer_logger_la_CXXFLAGS = \
 
 tools_libi965_batchbuffer_logger_la_LDFLAGS = \
 	-no-undefined -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.15.0



More information about the mesa-dev mailing list