Commit Graph

18 Commits

Author SHA1 Message Date
Eric Engestrom 2c67457e5e util/list: rename LIST_ENTRY() to list_entry()
This follows the Linux kernel convention, and avoids collision with
macOS header macro.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6751
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6840
Cc: mesa-stable
Signed-off-by: Eric Engestrom <eric@igalia.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17772>
2022-07-28 10:10:44 +00:00
Connor Abbott 0a4c86fc44 util/trace: Fix u_trace_*_iterator with no tracepoints
If u_trace is empty then there are no chunks, and we didn't account for
that case.

This fixes tracing some dynamic rendering tests.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17378>
2022-07-27 19:40:44 +00:00
Danylo Piliaiev 8d34cc2471 util/u_trace: Fix iteration over config_control
Fixes: e1811af75d
("util/perf: add options to enable/disable tracepoints")

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16781>
2022-07-12 22:24:19 +00:00
Lionel Landwerlin e1811af75d util/perf: add options to enable/disable tracepoints
We want to add more tracepoints for intel drivers. Having them all
enabled at the same time can be both costly and unreadable.

This allows a driver to specify an environment variable and values to
enable/disable tracepoints.

v2: s/TRACEPOINTS_ENABLES/TRACEPOINTS_TOGGLES/ (Danylo)
    s/config_name/toggle_name/

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/16717>
2022-05-26 07:14:45 +00:00
Lionel Landwerlin 1c077ca9c0 u_trace/anv/iris: drop cs argument for recording traces
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/16605>
2022-05-19 19:04:28 +00:00
Danylo Piliaiev 850ae76970 util/u_trace: Add json output
If we want to load the u_trace output somewhere for analysis it's much
easier to deal with json than to parse strings.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16475>
2022-05-19 07:41:45 +00:00
Yonggang Luo ea7cda93f3 misc: replace `#ifdef\s\s__cplusplus` with `#ifdef\s__cplusplus`
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15762>
2022-04-21 14:43:39 +00:00
Lionel Landwerlin d014efa33e util/utrace: make generated code a tiny bit nicer to look at
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/14818>
2022-02-01 09:28:30 +00:00
Lionel Landwerlin d0363baefd util/u_trace: make mako conditional code easier to read
It was difficult to read the conditional code.

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/14818>
2022-02-01 09:28:30 +00:00
Lionel Landwerlin 8092d58e2e util/u_trace: protect against reentrant calls
With the Iris driver, the first tracepoint triggers the tracepoint for
"begin of command buffer" which leads to 2 tracepoints using the same
idx.

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/14254>
2022-01-03 18:15:08 +00:00
Lionel Landwerlin 698343edc5 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>
2021-12-01 15:14:05 +00:00
Lionel Landwerlin 65697d6141 util/u_trace: add end_of_pipe property to tracepoints
In order to capture the timestamp when things actually end on Intel
GPU HW, we need to know whether the timestamp should be capture at the
top or end of pipeline.

v2: use one line python if/else (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>
2021-12-01 15:14:05 +00:00
Lionel Landwerlin 14e45cb21e util/u_trace: refcount payloads
When cloning a chunk of tracepoints, we cannot just copy the elements
of the traces[] array. We also need the payloads associated with
those.

This change introduces a new u_trace_payloaf_buf object that is
refcounted so that we can easily import traces[] elements and their
payloads from one utrace to another.

v2: use u_vector (Danylo)

v3: Delete outdate comment (Danylo)
    Fix assert (Danylo)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 0565c993f9 ("u_trace: helpers for tracing tiling GPUs and re-usable VK cmdbuffers")
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13899>
2021-11-24 17:53:08 +00:00
Kostiantyn Lazukin 78b613db23 util/u_trace: Replace Flag with IntEnum to support python3.5
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5586

Fixes: cefaa73909

Signed-off-by: Kostiantyn Lazukin <kostiantyn.lazukin@globallogic.com>

Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13643>
2021-11-05 11:54:30 +00:00
Danylo Piliaiev 4092d5f0d8 u_trace: pass command stream through tracing functions
Allows writing timestamps into different command streams.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10969>
2021-09-10 14:58:28 +03:00
Danylo Piliaiev 0565c993f9 u_trace: helpers for tracing tiling GPUs and re-usable VK cmdbuffers
Re-usable command buffer could be resubmitted any number of times,
but tracepoints are written once. u_trace_clone_append allows
copying tracepoints and copying timestamps if GPU doesn't support
writing timestamps into indirect address.

The case of tiling GPUs is similar, command stream for draws is
resubmitted for each tile.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10969>
2021-09-10 14:58:28 +03:00
Danylo Piliaiev cefaa73909 util/u_trace: auto-generation of serialization funcs for tracepoints
Add ability to auto-generate:
- printing of args for "GPU_TRACE=1", still could be overriden with
  tp_print.
- population of extra data for perfetto event.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10969>
2021-09-10 14:58:28 +03:00
Danylo Piliaiev e14f525280 util/u_trace: make u_trace usable for other than gallium drivers
With little modifications u_trace could be usable for Vulkan drivers.

Beside removing dependencies on gallium, the other notable change is
the passing of opaque flush_data pointer via u_trace_flush. There
is data which becomes available only at this point which other drivers
may want to pass.

For example Vulkan drivers would want to pass at least submission id
(for perfetto) and a sync object to wait on in u_trace_read_ts.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10969>
2021-09-10 14:58:28 +03:00