Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH v4 0/9] v4l2: Add tracing for stateless codecs
@ 2026-11-27 16:45 Detlev Casanova
  2026-11-27 16:45 ` [PATCH v4 1/9] media: Move visl traces to v4l2-core Detlev Casanova
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Detlev Casanova @ 2026-11-27 16:45 UTC (permalink / raw)
  To: Daniel Almeida, Mauro Carvalho Chehab, Steven Rostedt,
	Masami Hiramatsu, Mathieu Desnoyers, Nicolas Dufresne,
	Benjamin Gaignard, Philipp Zabel, Heiko Stuebner
  Cc: linux-kernel, linux-media, linux-trace-kernel, linux-rockchip,
	linux-arm-kernel, kernel, Detlev Casanova

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.
They are adapted to trace each each field separately and not just the
whole struct so that userspace can filter on different fields and
libraries like libtracefs and libtraceevent can be used to list the
fields instead of parsing the trace printk's.

The trace event templates are also reworked to avoid long lines, but
quoted string splits are kept as they don't cut words.

To each trace event 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.

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].
Other controls can be traced later as well, this patch set only focuses on
mem2mem type drivers.

checkpatch.pl reports alignement issues in the trace headers, they are
voluntary. No other warnings should be reported.

[1]:
https://gitlab.collabora.com/detlev/v4l2-perfetto.git

Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
---
Changes in v4:
- Update visl doc with new trace names
- hantro: Move hw_cycles in vpu to avoid ctx race in irq with watchdog
- hantro: trace run before starting watchdog and done after canceling watchdog
- Trace controls from p_new instead of p_cur
- Trace controls if there was no errors
- Add missing EXT_SPS_LT and EXT_SPS_ST tracing
- Allow fd to be 0
- Also report queue type in run trace
- Move v4l2_ctrl_vp9_frame tracepoint symbol to the VP9 code block
- Use s32 instead of u32 for file descriptors
- Fix a HEVC flag print in trace
- Link to v3: https://patch.msgid.link/20261125-v4l2-add-ftrace-v3-0-1d1db48372ed@collabora.com

Changes in v3:
- Rebased on master
- Fixed sps_st field size in traces
- Fixed checkpatch issues (except parenthesis alignment in trace headers)
- Link to v2: https://patch.msgid.link/20260610-v4l2-add-ftrace-v2-0-9756edf72ac1@collabora.com

Changes in v2:
- Don't modify the printk format
- Trace all fields of the structs instead of the whole struct as a buffer
- Remove fdinfo patches (they will come in another patch set)
- Fix long lines
- Rename v4l2_requests.h trace header to v4l2_controls.h
- Add basic documentation

To: Daniel Almeida <daniel.almeida@collabora.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Benjamin Gaignard <benjamin.gaignard@collabora.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
To: Heiko Stuebner <heiko@sntech.de>
Cc: kernel@collabora.com
Cc: linux-kernel@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: linux-trace-kernel@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org

---
Detlev Casanova (9):
      media: Move visl traces to v4l2-core
      media: Map each struct field to its own trace field
      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

 Documentation/admin-guide/media/visl.rst           |   24 +-
 drivers/media/platform/verisilicon/hantro.h        |    3 +
 drivers/media/platform/verisilicon/hantro_drv.c    |    9 +
 .../platform/verisilicon/rockchip_vpu981_regs.h    |    1 +
 .../media/platform/verisilicon/rockchip_vpu_hw.c   |    2 +
 drivers/media/test-drivers/visl/Makefile           |    2 +-
 drivers/media/test-drivers/visl/visl-dec.c         |   76 -
 drivers/media/test-drivers/visl/visl-trace-av1.h   |  314 ---
 drivers/media/test-drivers/visl/visl-trace-fwht.h  |   66 -
 drivers/media/test-drivers/visl/visl-trace-h264.h  |  349 ---
 drivers/media/test-drivers/visl/visl-trace-hevc.h  |  464 ----
 drivers/media/test-drivers/visl/visl-trace-mpeg2.h |   99 -
 .../media/test-drivers/visl/visl-trace-points.c    |   11 -
 drivers/media/test-drivers/visl/visl-trace-vp8.h   |  156 --
 drivers/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          |  131 +
 drivers/media/v4l2-core/v4l2-fh.c                  |    2 +
 drivers/media/v4l2-core/v4l2-ioctl.c               |   39 +-
 drivers/media/v4l2-core/v4l2-trace.c               |   50 +
 include/media/v4l2-ctrls.h                         |   19 +
 include/media/v4l2-fh.h                            |    4 +
 include/trace/events/v4l2.h                        |   89 +
 include/trace/events/v4l2_controls.h               | 2704 ++++++++++++++++++++
 24 files changed, 3076 insertions(+), 1840 deletions(-)
---
base-commit: 8d7fe9885c62fc9a95bf55d9db244d9672a8aadc
change-id: 20260608-v4l2-add-ftrace-aec6e7f60a6c

Best regards,
--  
Detlev Casanova <detlev.casanova@collabora.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-11-27 17:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 16:45 [PATCH v4 0/9] v4l2: Add tracing for stateless codecs Detlev Casanova
2026-11-27 16:45 ` [PATCH v4 1/9] media: Move visl traces to v4l2-core Detlev Casanova
2026-11-27 16:45 ` [PATCH v4 2/9] media: Map each struct field to its own trace field Detlev Casanova
2026-11-27 16:45 ` [PATCH v4 3/9] media: Add tgid and fd fields in v4l2_fh struct Detlev Casanova
2026-11-27 16:57   ` sashiko-bot
2026-11-27 16:45 ` [PATCH v4 4/9] media: Add tgid and fd to the v4l2-requests trace fields Detlev Casanova
2026-11-27 16:45 ` [PATCH v4 5/9] media: Add missing types to v4l2_ctrl_ptr Detlev Casanova
2026-11-27 16:45 ` [PATCH v4 6/9] media: Trace the stateless controls when set in v4l2-ctrls-core.c Detlev Casanova
2026-11-27 17:04   ` sashiko-bot
2026-11-27 16:45 ` [PATCH v4 7/9] media: Add stream on/off traces and run them in the ioctl Detlev Casanova
2026-11-27 16:45 ` [PATCH v4 8/9] media: Add HW run/done trace events Detlev Casanova
2026-11-27 16:45 ` [PATCH v4 9/9] media: hantro: Add v4l2_hw run/done traces Detlev Casanova
2026-11-27 17:07   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox