All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Sakari Ailus <sakari.ailus@iki.fi>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>
Subject: Re: [RFC PATCH v1 11/19] media: renesas: vsp1: Add and use function to dump a pipeline to the log
Date: Tue, 18 Jun 2024 19:25:02 +0300	[thread overview]
Message-ID: <20240618162502.GG32669@pendragon.ideasonboard.com> (raw)
In-Reply-To: <zhtlotecrnczxjpchurr3rkmewnbvlalvyivec5yzrbf3js5r4@sirkpss6cbpt>

On Tue, Jun 18, 2024 at 01:34:41PM +0200, Jacopo Mondi wrote:
> Hi Laurent
> 
> On Wed, Nov 22, 2023 at 06:30:01AM GMT, Laurent Pinchart wrote:
> > 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>
> > ---
> >  .../media/platform/renesas/vsp1/vsp1_drm.c    |  5 +++++
> >  .../media/platform/renesas/vsp1/vsp1_pipe.c   | 22 +++++++++++++++++++
> >  .../media/platform/renesas/vsp1/vsp1_pipe.h   | 19 ++++++++++++++++
> >  .../media/platform/renesas/vsp1/vsp1_video.c  | 10 ++++++++-
> >  4 files changed, 55 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drm.c b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> > index 3954c138fa7b..1aa59a74672f 100644
> > --- a/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> > +++ b/drivers/media/platform/renesas/vsp1/vsp1_drm.c
> > @@ -733,6 +733,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index,
> >  	if (ret < 0)
> >  		goto unlock;
> >
> > +	vsp1_pipeline_dump(pipe, "LIF setup");
> > +
> >  	/* Enable the VSP1. */
> >  	ret = vsp1_device_get(vsp1);
> >  	if (ret < 0)
> > @@ -906,6 +908,9 @@ void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index,
> >  	}
> >
> >  	vsp1_du_pipeline_setup_inputs(vsp1, pipe);
> > +
> > +	vsp1_pipeline_dump(pipe, "atomic update");
> > +
> >  	vsp1_du_pipeline_configure(pipe);
> >
> >  done:
> > diff --git a/drivers/media/platform/renesas/vsp1/vsp1_pipe.c b/drivers/media/platform/renesas/vsp1/vsp1_pipe.c
> > index 8eba3cda1e3d..edc5e9f3ba65 100644
> > --- a/drivers/media/platform/renesas/vsp1/vsp1_pipe.c
> > +++ b/drivers/media/platform/renesas/vsp1/vsp1_pipe.c
> > @@ -301,6 +301,28 @@ void vsp1_pipeline_init(struct vsp1_pipeline *pipe)
> >  	pipe->state = VSP1_PIPELINE_STOPPED;
> >  }
> >
> > +void __vsp1_pipeline_dump(struct _ddebug *, struct vsp1_pipeline *pipe,
> > +			  const char *msg)
> > +{
> > +	struct vsp1_device *vsp1 = pipe->output->entity.vsp1;
> > +	struct vsp1_entity *entity;
> > +	bool first = true;
> > +
> > +	printk(KERN_DEBUG "%s: %s: pipe: ", dev_name(vsp1->dev), msg);
> > +
> > +	list_for_each_entry(entity, &pipe->entities, list_pipe) {
> > +		const char *name;
> > +
> > +		name = strchrnul(entity->subdev.name, ' ');
> > +		name = name ? name + 1 : entity->subdev.name;
> > +
> > +		pr_cont("%s%s", first ? "" : ", ", name);
> > +		first = false;
> > +	}
> > +
> > +	pr_cont("\n");
> > +}
> > +
> >  /* Must be called with the pipe irqlock held. */
> >  void vsp1_pipeline_run(struct vsp1_pipeline *pipe)
> >  {
> > diff --git a/drivers/media/platform/renesas/vsp1/vsp1_pipe.h b/drivers/media/platform/renesas/vsp1/vsp1_pipe.h
> > index c1f411227de7..46a82a9f766a 100644
> > --- a/drivers/media/platform/renesas/vsp1/vsp1_pipe.h
> > +++ b/drivers/media/platform/renesas/vsp1/vsp1_pipe.h
> > @@ -9,6 +9,7 @@
> >  #ifndef __VSP1_PIPE_H__
> >  #define __VSP1_PIPE_H__
> >
> > +#include <linux/dynamic_debug.h>
> >  #include <linux/kref.h>
> >  #include <linux/list.h>
> >  #include <linux/spinlock.h>
> > @@ -142,6 +143,24 @@ struct vsp1_pipeline {
> >  void vsp1_pipeline_reset(struct vsp1_pipeline *pipe);
> >  void vsp1_pipeline_init(struct vsp1_pipeline *pipe);
> >
> > +void __vsp1_pipeline_dump(struct _ddebug *, struct vsp1_pipeline *pipe,
> > +			  const char *msg);
> > +
> > +#if defined(CONFIG_DYNAMIC_DEBUG) || \
> > +	(defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE))
> > +#define vsp1_pipeline_dump(pipe, msg)			\
> > +	_dynamic_func_call("vsp1_pipeline_dump()", __vsp1_pipeline_dump, pipe, msg)
> > +#elif defined(DEBUG)
> > +#define vsp1_pipeline_dump(pipe, msg)			\
> > +	__vsp1_pipeline_dump(NULL, pipe, msg)
> > +#else
> > +#define vsp1_pipeline_dump(pipe, msg)			\
> > +({							\
> > +	if (0)						\
> > +		__vsp1_pipeline_dump(NULL, pipe, msg);	\
> > +)}
> 
> Why can't this simply be
> 
> #else
> #define vsp1_pipeline_dump(pipe, msg)
> #endif
> 
> ?

To avoid unused local variable warnings.

> > +#endif
> > +
> >  void vsp1_pipeline_run(struct vsp1_pipeline *pipe);
> >  bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe);
> >  int vsp1_pipeline_stop(struct vsp1_pipeline *pipe);
> > diff --git a/drivers/media/platform/renesas/vsp1/vsp1_video.c b/drivers/media/platform/renesas/vsp1/vsp1_video.c
> > index 6a8db541543a..84394994ccee 100644
> > --- a/drivers/media/platform/renesas/vsp1/vsp1_video.c
> > +++ b/drivers/media/platform/renesas/vsp1/vsp1_video.c
> > @@ -520,11 +520,19 @@ static int vsp1_video_pipeline_build(struct vsp1_pipeline *pipe,
> >  static int vsp1_video_pipeline_init(struct vsp1_pipeline *pipe,
> >  				    struct vsp1_video *video)
> >  {
> > +	int ret;
> > +
> >  	vsp1_pipeline_init(pipe);
> >
> >  	pipe->frame_end = vsp1_video_pipeline_frame_end;
> >
> > -	return vsp1_video_pipeline_build(pipe, video);
> > +	ret = vsp1_video_pipeline_build(pipe, video);
> > +	if (ret)
> > +		return ret;
> > +
> > +	vsp1_pipeline_dump(pipe, "video");
> > +
> > +	return 0;
> >  }
> >
> >  static struct vsp1_pipeline *vsp1_video_pipeline_get(struct vsp1_video *video)

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2024-06-18 16:25 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22  4:29 [RFC PATCH v1 00/19] media: renesas: vsp1: Conversion to subdev active state Laurent Pinchart
2023-11-22  4:29 ` [RFC PATCH v1 01/19] media: renesas: vsp1: Drop vsp1_entity_get_pad_format() wrapper Laurent Pinchart
2024-06-18  9:52   ` Jacopo Mondi
2023-11-22  4:29 ` [RFC PATCH v1 02/19] media: renesas: vsp1: Drop vsp1_entity_get_pad_selection() wrapper Laurent Pinchart
2024-06-18  9:56   ` Jacopo Mondi
2023-11-22  4:29 ` [RFC PATCH v1 03/19] media: renesas: vsp1: Drop vsp1_rwpf_get_crop() wrapper Laurent Pinchart
2024-06-18  9:58   ` Jacopo Mondi
2023-11-22  4:29 ` [RFC PATCH v1 04/19] media: renesas: vsp1: Drop brx_get_compose() wrapper Laurent Pinchart
2024-06-18  9:59   ` Jacopo Mondi
2023-11-22  4:29 ` [RFC PATCH v1 05/19] media: renesas: vsp1: Drop custom .get_fmt() handler for histogram Laurent Pinchart
2024-06-18 10:05   ` Jacopo Mondi
2024-06-18 15:57     ` Laurent Pinchart
2023-11-22  4:29 ` [RFC PATCH v1 06/19] media: renesas: vsp1: Move partition calculation to vsp1_pipe.c Laurent Pinchart
2024-06-18 10:26   ` Jacopo Mondi
2023-11-22  4:29 ` [RFC PATCH v1 07/19] media: renesas: vsp1: Simplify partition calculation Laurent Pinchart
2024-06-18 10:29   ` Jacopo Mondi
2023-11-22  4:29 ` [RFC PATCH v1 08/19] media: renesas: vsp1: Store RPF partition configuration per RPF instance Laurent Pinchart
2024-06-18 10:32   ` Jacopo Mondi
2024-06-18 16:09     ` Laurent Pinchart
2023-11-22  4:29 ` [RFC PATCH v1 09/19] media: renesas: vsp1: Pass partition pointer to .configure_partition() Laurent Pinchart
2024-06-18 10:45   ` Jacopo Mondi
2024-06-18 16:13     ` Laurent Pinchart
2024-06-18 16:28       ` Jacopo Mondi
2023-11-22  4:30 ` [RFC PATCH v1 10/19] media: renesas: vsp1: Replace vsp1_partition_window with v4l2_rect Laurent Pinchart
2024-06-18 11:07   ` Jacopo Mondi
2024-06-18 16:24     ` Laurent Pinchart
2024-06-18 16:29       ` Jacopo Mondi
2023-11-22  4:30 ` [RFC PATCH v1 11/19] media: renesas: vsp1: Add and use function to dump a pipeline to the log Laurent Pinchart
2024-06-18 11:34   ` Jacopo Mondi
2024-06-18 16:25     ` Laurent Pinchart [this message]
2024-06-18 16:30       ` Jacopo Mondi
2023-11-22  4:30 ` [RFC PATCH v1 12/19] media: renesas: vsp1: Keep the DRM pipeline entities sorted Laurent Pinchart
2024-06-19 12:02   ` Jacopo Mondi
2023-11-22  4:30 ` [RFC PATCH v1 13/19] media: renesas: vsp1: Compute partitions for DRM pipelines Laurent Pinchart
2024-06-18 11:35   ` Jacopo Mondi
2023-11-22  4:30 ` [RFC PATCH v1 14/19] media: renesas: vsp1: Get configuration from partition instead of state Laurent Pinchart
2024-06-18 11:23   ` Jacopo Mondi
2024-06-18 16:38     ` Laurent Pinchart
2024-06-18 16:46       ` Jacopo Mondi
2023-11-22  4:30 ` [RFC PATCH v1 15/19] media: renesas: vsp1: Name parameters to entity operations Laurent Pinchart
2024-06-18 11:24   ` Jacopo Mondi
2023-11-22  4:30 ` [RFC PATCH v1 16/19] media: renesas: vsp1: Pass subdev state " Laurent Pinchart
2024-06-18 16:52   ` Jacopo Mondi
2024-06-18 17:17     ` Laurent Pinchart
2023-11-22  4:30 ` [RFC PATCH v1 17/19] media: renesas: vsp1: Initialize control handler after subdev Laurent Pinchart
2024-06-18 16:56   ` Jacopo Mondi
2023-11-22  4:30 ` [RFC PATCH v1 18/19] media: renesas: vsp1: Switch to V4L2 subdev active state Laurent Pinchart
2023-11-22  4:30 ` [RFC PATCH v1 19/19] media: renesas: vsp1: Rename all v4l2_subdev_state variables to 'state' Laurent Pinchart
2024-06-18 16:57   ` Jacopo Mondi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240618162502.GG32669@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=tomi.valkeinen@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.