[PATCH 00/11] v4l2: Add tracing for stateless codecs

Detlev Casanova
2026-02-12T16:23:51Z

Hi !

This patchset aims to improve codec event tracing in v4l2.

The traces added in visl by Daniel Almeida are moved to the global trace
events and slightly reworked to be printed in a more consistent format.

To each trace are also added a tgid and fd fields, helping userspace track
different decoding sessions (contexts) based on the given file descriptor
used by the given process id.

Also for better tracking, stream on and stream off events are added as
well as HW run and HW done events to track decoder core usage.

Finally, add a show_fdinfo callback on video device files, allowing drivers
to expose usage information.
Currently only used for frame buffer memory usage.

The main focus is to be able to generate perfetto traces to show VPU usage,
a perfetto producer using this can be found at [1].

[1]: https://gitlab.collabora.com/detlev/hantro-perf/-/tree/hantro-improved-info

Detlev Casanova (11):
media: Move visl traces to v4l2-core
media: Reformat v4l2-requests trace event printk
media: Add tgid and fd fields in v4l2_fh struct
media: Add tgid and fd to the v4l2-requests trace fields
media: Add missing types to v4l2_ctrl_ptr
media: Trace the stateless controls when set in v4l2-ctrls-core.c
media: Add stream on/off traces and run them in the ioctl
media: Add HW run/done trace events
media: hantro: Add v4l2_hw run/done traces
media: v4l2: Add callback for show_fdinfo
media: hantro: Add fdinfo callback

drivers/media/platform/verisilicon/hantro.h | 2 +
.../media/platform/verisilicon/hantro_drv.c | 25 +
.../media/platform/verisilicon/hantro_v4l2.c | 10 +-
.../verisilicon/rockchip_vpu981_regs.h | 1 +
.../platform/verisilicon/rockchip_vpu_hw.c | 4 +
drivers/media/test-drivers/visl/Makefile | 2 +-
drivers/media/test-drivers/visl/visl-dec.c | 76 -
.../media/test-drivers/visl/visl-trace-av1.h | 314 ---
.../media/test-drivers/visl/visl-trace-fwht.h | 66 -
.../media/test-drivers/visl/visl-trace-h264.h | 349 ----
.../media/test-drivers/visl/visl-trace-hevc.h | 464 -----
.../test-drivers/visl/visl-trace-mpeg2.h | 99 -
.../test-drivers/visl/visl-trace-points.c | 11 -
.../media/test-drivers/visl/visl-trace-vp8.h | 156 --
.../media/test-drivers/visl/visl-trace-vp9.h | 292 ---
drivers/media/v4l2-core/v4l2-ctrls-api.c | 10 +
drivers/media/v4l2-core/v4l2-ctrls-core.c | 114 +
drivers/media/v4l2-core/v4l2-dev.c | 10 +
drivers/media/v4l2-core/v4l2-fh.c | 1 +
drivers/media/v4l2-core/v4l2-ioctl.c | 37 +-
drivers/media/v4l2-core/v4l2-trace.c | 48 +
include/media/v4l2-ctrls.h | 19 +
include/media/v4l2-dev.h | 1 +
include/media/v4l2-fh.h | 4 +
include/trace/events/v4l2.h | 58 +
include/trace/events/v4l2_requests.h | 1836 +++++++++++++++++
26 files changed, 2178 insertions(+), 1831 deletions(-)
delete mode 100644 drivers/media/test-drivers/visl/visl-trace-av1.h
delete mode 100644 drivers/media/test-drivers/visl/visl-trace-fwht.h
delete mode 100644 drivers/media/test-drivers/visl/visl-trace-h264.h
delete mode 100644 drivers/media/test-drivers/visl/visl-trace-hevc.h
delete mode 100644 drivers/media/test-drivers/visl/visl-trace-mpeg2.h
delete mode 100644 drivers/media/test-drivers/visl/visl-trace-points.c
delete mode 100644 drivers/media/test-drivers/visl/visl-trace-vp8.h
delete mode 100644 drivers/media/test-drivers/visl/visl-trace-vp9.h
create mode 100644 include/trace/events/v4l2_requests.h

--
2.53.0