util/u_trace/perfetto: add new env variable to enable perfetto

When using the Vulkan API, command buffers can be recorded way before
perfetto is enabled. This can be problematic if you want already
recorded command buffers to produce traces.

This new environment variable makes perfetto enabled internally so
that command buffers are recorded with timestamps, even though no
perfetto recording happens.

v2: rename to GPU_TRACE_INSTRUMENT (Rob)

v3: Move instrumentation check to generated headers (Danylo)
    Decouple instrumentation enabling from tracing (Danylo)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13911>
This commit is contained in:
Lionel Landwerlin
2021-11-22 12:56:20 +02:00
committed by Marge Bot
parent 65697d6141
commit 698343edc5
5 changed files with 39 additions and 6 deletions

View File

@@ -104,6 +104,22 @@ the steps above :
# Back in the perfetto tmux, press enter to start the capture
Vulkan data sources
~~~~~~~~~~~~~~~~~~~
The Vulkan API gives the application control over recording of command
buffers as well as when they are submitted to the hardware. As a
consequence, we need to ensure command buffers are properly
instrumented for the perfetto driver data sources prior to Perfetto
actually collecting traces.
This can be achieved by setting the ``GPU_TRACE_INSTRUMENT``
environment variable before starting a Vulkan application :
.. code-block:: console
GPU_TRACE_INSTRUMENT=1 ./build/my_vulkan_app
Driver Specifics
~~~~~~~~~~~~~~~~