panfrost: Add pandecode (command stream debugger)

Graphics / Mesa 3D Graphics Library / Mesa - Alyssa Rosenzweig [] - 21 February 2019 07:01 EST

The `panwrap` utility can be LD_PRELOAD'd into a GLES app, intercepting communication between the driver and the kernel. Modern panwrap versions do no processing of their own; instead, they create a trace directory. This directory contains the following files:

- control.log: a line-by-line plain text file, denoting important syscalls (mmaps and job submits) along with their arguments

- memory_*.bin, shader_*.bin: binary dumps of mapped memory

Together, these files contain enough information to reconstruct the command stream and shaders of (at minimum) a single frame.

The `pandecode` utility takes this directory structure as input, reconstructing the mapped memory and using the job submit command as an entrypoint. It then walks the descriptors as the hardware would, parsing and pretty-printing. Its final output is the pretty-printed command stream interleaved with the disassembled shaders, suitable for driver debugging. For instance, the behaviour of two driver versions (one working, one broken) can be compared by diff'ing their decoded logs.

pandecode/decode.c was originally a part of `panwrap`; it is the oldest living code in the project. Its history is generally not worth preserving.

panwrap itself will continue to live downstream for the foreseeable future, as it is specifically written for the vendor kernel. It is possible, however, to produce equivalent traces directly from Panfrost, bypassing the intermediate wrapping layer for well-behaved drivers.

f611782045b panfrost: Add pandecode (command stream debugger)
src/gallium/drivers/panfrost/ | 22 +
src/gallium/drivers/panfrost/pan_pretty_print.c | 4 +-
src/gallium/drivers/panfrost/pan_pretty_print.h | 2 +-
src/gallium/drivers/panfrost/pandecode/cmdline.c | 189 ++
src/gallium/drivers/panfrost/pandecode/decode.c | 1996 ++++++++++++++++++++++
src/gallium/drivers/panfrost/pandecode/mmap.h | 79 +
6 files changed, 2289 insertions(+), 3 deletions(-)


  • Share