media: renesas: vsp1: Add and use function to dump a pipeline to the log
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Sat, 18 Nov 2023 22:39:34 +0000 (00:39 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Wed, 19 Jun 2024 22:36:48 +0000 (01:36 +0300)
commit032000264cbec9b17af2f76dd2899a7cc20ef422
tree4e1d97ed93d5e03678579e9189e8179f552a5069
parent41be7fcc5d632402382a7c2a77ac84baf24d47cc
media: renesas: vsp1: Add and use function to dump a pipeline to the log

It is useful for debugging purpose to dump a vsp1_pipeline to the kernel
log. Add a new function to do so, and use it when initializing the video
and DRM pipelines.

As __vsp1_pipeline_dump() needs to construct the log message
iteratively, it uses pr_cont(...) (exact equivalent to the more verbose
"printk(KERN_CONT ..."). The function thus can't use dev_dbg() to log
the initial part of the message, for two reasons:

- pr_cont() doesn't seem to work with dev_*(). Even if the format string
  passed to dev_*() doesn't end with a '\n', pr_cont() starts a new line
  in the log. This behaviour doesn't seem to be clearly documented, and
  may or may not be on purpose.

- Messages printed by dev_dbg() may be omitted if dynamic debugging is
  enabled. In that case, the continuation messages will still be
  printed, leading to confusing log messages.

To still benefit from the dynamic debug infrastructure, we declare a
vsp1_pipeline_dump() macro that uses _dynamic_func_call() when dynamic
debugging is enabled. The whole vsp1_pipeline_dump() call can be
selected at runtime. The __vsp1_pipeline_dump() function then uses a
plain "printk(KERN_DEBUG ...)" to print the message header using the
debug log level, and pr_cont() to print the rest of the message on the
same line.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
drivers/media/platform/renesas/vsp1/vsp1_drm.c
drivers/media/platform/renesas/vsp1/vsp1_pipe.c
drivers/media/platform/renesas/vsp1/vsp1_pipe.h
drivers/media/platform/renesas/vsp1/vsp1_video.c