[Mesa-dev] [PATCH 18/22] inte/tools/BatchbufferLogger : add shell script for batchbuffer logger

kevin.rogovin at intel.com kevin.rogovin at intel.com
Mon Sep 25 10:34:18 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                   |   8 ++
 src/intel/tools/.gitignore                    |   1 +
 src/intel/tools/i965_batchbuffer_logger_sh.in | 107 ++++++++++++++++++++++++++
 3 files changed, 116 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 7845a57..f4a6af6 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
 
@@ -94,3 +98,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 27437f9..fa9bf708 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 0000000..478ae0f
--- /dev/null
+++ b/src/intel/tools/i965_batchbuffer_logger_sh.in
@@ -0,0 +1,107 @@
+#!/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
+ -vs-file  instead of placing the assembly of the vertex shaders directly
+           in the log, save the assembly of each vertex shader -binary-
+           to a file
+
+ -hs-file  instead of placing the assembly of the hull shaders directly
+           in the log, save the assembly of each vertex shader -binary-
+           to a file
+
+ -ds-file  instead of placing the assembly of the domain shaders directly
+           in the log, save the assembly of each vertex shader -binary-
+           to a file
+
+ -gs-file  instead of placing the assembly of the geometry shaders directly
+           in the log, save the assembly of each vertex shader -binary-
+           to a file
+
+ -ps-file  instead of placing the assembly of the pixel shaders directly
+           in the log, save the assembly of each vertex shader -binary-
+           to a file
+
+ -cs-file  instead of placing the assembly of the compute/media shaders
+           directly in the log, save the assembly of each vertex 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
+
+ --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
+            ;;
+        -r)
+            set_var "I965_PRINT_RELOC_LEVEL" "$2"
+            shift 2
+            ;;
+        -vs-file)
+            set_var "I965_DECODE_VS" "0"
+            shift 1
+            ;;
+        -hs-file)
+            set_var "I965_DECODE_HS" "0"
+            shift 1
+            ;;
+        -ds-file)
+            set_var "I965_DECODE_DS" "0"
+            shift 1
+            ;;
+        -gs-file)
+            set_var "I965_DECODE_GS" "0"
+            shift 1
+            ;;
+        -ps-file)
+            set_var "I965_DECODE_PS" "0"
+            shift 1
+            ;;
+        -cs-file)
+            set_var "I965_DECODE_CS" "0"
+            shift 1
+            ;;
+        --)
+            shift
+            break
+            ;;
+        *)
+            break
+            ;;
+      esac
+done
+
+
+libdir=@libdir@
+
+export LD_PRELOAD=${libdir}/libi965_batchbuffer_logger.so:$LD_PRELOAD
+exec -- "$@"
-- 
2.7.4



More information about the mesa-dev mailing list