panfrost: Replace pantrace with direct decoding
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 11 Jun 2019 19:25:35 +0000 (12:25 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 12 Jun 2019 21:07:09 +0000 (14:07 -0700)
commitfc7bcee865c5b42b7575f2e69ecf61b80521d47e
tree62572a55ff62f337788f86a0fca0479099a5eae1
parent845ec8576a600ea54f80a2639e0466041f145ffa
panfrost: Replace pantrace with direct decoding

History lesson! In the early days of a Panfrost, we had a library
independent of the driver called `panwrap` which would be LD_PRELOAD'ed
into a driver to decode its cmdstream in real-time. When upstreaming
Panfrost, we realized that we would much rather have this decode
functionality maintained in-tree to avoid divergence, but that we could
not upstream panwrap because of its use with the legacy API. So we
instead dumped GPU memory to the filesystem with an out-of-tree panwrap,
and decoded that with the in-tree pandecode module. When we migrated to
the new kernel, we just added support for doing this memory dump
directly from the driver (via a module "pantrace").

This works, but dumping memory every frame is sloooooooooooooow and
error-prone. I figured if we have pandecode in-tree, we might as well
link to it directly in the driver, allowing us to decode Panfrost's
command streams without dumping memory to the filesystem first. This
cleans up the code *substantially* and improves dumping performance by a
HUGE margin. I'm talking "several seconds per frame" to "dumping in
real-time" kind of jump.

Note to users: this removes the environmental option "PANTRACE_BASE".
Instead, for equivalent functionality set "PAN_MESA_DEBUG=trace" and
redirect stdout to the file of your choosing.

This should be debugging Panfrost much more pleasant.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/meson.build
src/gallium/drivers/panfrost/pan_drm.c
src/gallium/drivers/panfrost/pan_screen.c
src/gallium/drivers/panfrost/pan_screen.h
src/gallium/drivers/panfrost/pan_trace.c [deleted file]
src/gallium/drivers/panfrost/pan_trace.h [deleted file]
src/gallium/drivers/panfrost/pan_util.h
src/gallium/drivers/panfrost/pandecode/cmdline.c
src/gallium/drivers/panfrost/pandecode/common.c [new file with mode: 0644]
src/gallium/drivers/panfrost/pandecode/decode.c
src/gallium/drivers/panfrost/pandecode/decode.h [moved from src/gallium/drivers/panfrost/pandecode/mmap.h with 91% similarity]