freedreno: add fd_rd_output facilities for gzip-compressed RD dumps

Provide fd_rd_output facilities which enable constructing RD dumps that are
stored into gzip-compressed output. This matches the default behavior of
libwrap. Enabling and adjusting the behavior of functionality is done
through the FD_RD_DUMP environment variable.

Integration into Turnip's MSM backend is covered, replacing the previous
RD dump that was enabled through TU_DEBUG=rd. That debug option still
works and is the same as using FD_RD_DUMP=enable.

By default the dumps are created for each submission, using the provided
submit index. FD_RD_DUMP=combine enables gathering dumps for submissions
for the given logical device into a single file.

In the Turnip integration, FD_RD_DUMP=full will force dumping contents of
any buffer object. Additionally, with that option enabled any previous
submit will be waited on.

Specifying FD_RD_DUMP=trigger sets up a trigger file that can be used to
activate dumping manually. Writing zero or some non-integer value to the
file will disable dumping. Writing a positive integer value to it will
enable dumps for that many future submissions. Writing -1 to it will enable
dumps until disabled.

Signed-off-by: Zan Dobersek <zdobersek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27230>
This commit is contained in:
Zan Dobersek
2024-01-24 07:55:56 +01:00
parent 0a97d1ebfa
commit f9c4e25483
8 changed files with 416 additions and 33 deletions
+24 -3
View File
@@ -369,9 +369,8 @@ Command Stream Capture
^^^^^^^^^^^^^^^^^^^^^^
During Mesa development, it's often useful to look at the command streams we
send to the kernel. Mesa itself doesn't implement a way to stream them out
(though it maybe should!). Instead, we have an interface for the kernel to
capture all submitted command streams:
send to the kernel. We have an interface for the kernel to capture all
submitted command streams:
.. code-block:: sh
@@ -391,6 +390,28 @@ probably want to cause a crash in the GPU during a frame of interest so that a
single GPU core dump is generated. Emitting ``0xdeadbeef`` in the CS should be
enough to cause a fault.
``fd_rd_output`` facilities provide support for generating the command stream
capture from inside Mesa. Different ``FD_RD_DUMP`` options are available:
- ``enable`` simply enables dumping the command stream on each submit for a
given logical device. When a more advanced option is specified, ``enable`` is
implied as specified.
- ``combine`` will combine all dumps into a single file instead of writing the
dump for each submit into a standalone file.
- ``full`` will dump every buffer object, which is necessary for replays of
command streams (see below).
- ``trigger`` will establish a trigger file through which dumps can be better
controlled. Writing a positive integer value into the file will enable dumping
of that many subsequent submits. Writing -1 will enable dumping of submits
until disabled. Writing 0 (or any other value) will disable dumps.
Output dump files and trigger file (when enabled) are hard-coded to be placed
under ``/tmp``, or ``/data/local/tmp`` under Android.
Functionality is generic to any Freedreno-based backend, but is currently only
integrated in the MSM backend of Turnip. Using the existing ``TU_DEBUG=rd``
option will translate to ``FD_RD_DUMP=enable``.
Capturing Hang RD
+++++++++++++++++