summaryrefslogtreecommitdiff
path: root/docs/gpuvis.rst
blob: 0d240c784b87b53368d19b9f52fb400ed5be5da7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Gpuvis Tracing Annotations
==========================

`Gpuvis <https://github.com/mikesart/gpuvis>`__ is a tool to visualize ftrace
traces, with support for most GPU drivers to show GPU activity.

Mesa can emit trace markers to be displayed in Gpuvis, which is useful for
figuring out why e.g. stalls are happening.

Run on Linux
------------

Any traces can be made with trace-cmd. The Gpuvis repository contains
`scripts <https://github.com/mikesart/gpuvis/tree/master/sample>`__ for
configuring the markers needed for GPU events. To start tracing:

.. code-block:: console

   sh trace-cmd-setup.sh && sh trace-cmd-start-tracing.sh
   # Start your game etc. Then to capture a trace
   sh trace-cmd-capture.sh
   # and to finally stop
   sh trace-cmd-stop-tracing.sh

The resulting trace file can be opened with Gpuvis.

Run on Steamos
--------------

Steamos includes a script (`gpu-trace <https://github.com/lostgoat/gpu-trace>`__)
to capture traces.

.. code-block:: console

   sudo gpu-trace
   # Press Ctrl+C to stop capture and open report in gpuvis

Note that on Steamos gpuvis is actually not installed by default, but the
script does write a gpu-trace.zip file in the current working directory. To
open it you'll want to do the following on your development machine:

.. code-block:: console

   scp sd-host:gpu-trace.zip ./
   unzip gpu-trace.zip
   ./trace-cmd convert -i *.dat -o converted.dat --compression none --file-version 6
   gpuvis *.json converted.dat

The main advantage of the gpu-trace script is that it has an integration with
perf, so Gpuvis can also visualize perf samples in the timeline. Note that the
perf file is preprocessed before being put into the zip file, so the trace is
portable between machines.


Annotations in Steam games
--------------------------

Steam games are run in a container, and need the environment variable
PRESSURE_VESSEL_DEVEL=1 to set up the tracing filesystem so the trace marker
can be written. This can e.g. be done by going to the game properties in
Steam and setting the command line to

.. code-block:: console

   PRESSURE_VESSEL_DEVEL=1 %command%

Then you can run the game as usual, and the driver will write trace annotations.