From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, Tianshu Qiu <tian.shu.qiu@intel.com>,
Bingbu Cao <bingbu.cao@intel.com>,
Jacopo Mondi <jacopo+renesas@jmondi.org>,
Rui Miguel Silva <rmfrfs@gmail.com>,
Martin Kepplinger <martink@posteo.de>
Subject: Re: [PATCH v2 11/12] media: v4l: subdev: Print debug information on frame descriptor
Date: Tue, 19 Sep 2023 11:19:36 +0300 [thread overview]
Message-ID: <749451b9-b754-fd9c-d0e8-4edb3cb613ac@ideasonboard.com> (raw)
In-Reply-To: <20230918133926.GG28874@pendragon.ideasonboard.com>
On 18/09/2023 16:39, Laurent Pinchart wrote:
> Hi Sakari,
>
> Thank you for the patch.
>
> On Mon, Sep 18, 2023 at 03:51:37PM +0300, Sakari Ailus wrote:
>> Print debug level information on returned frame descriptors.
>>
>> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>> ---
>> drivers/media/v4l2-core/v4l2-subdev.c | 35 ++++++++++++++++++++++++++-
>> 1 file changed, 34 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
>> index 7b087be3ff4f..abd9275febdb 100644
>> --- a/drivers/media/v4l2-core/v4l2-subdev.c
>> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
>> @@ -309,9 +309,42 @@ static int call_set_selection(struct v4l2_subdev *sd,
>> static int call_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
>> struct v4l2_mbus_frame_desc *fd)
>> {
>> + unsigned int i;
>> + int ret;
>> +
>> memset(fd, 0, sizeof(*fd));
>>
>> - return sd->ops->pad->get_frame_desc(sd, pad, fd);
>> + ret = sd->ops->pad->get_frame_desc(sd, pad, fd);
>> + if (ret)
>> + return ret;
>> +
>> + dev_dbg(sd->dev, "Frame descriptor\n");
>> + dev_dbg(sd->dev, "\ttype %s\n",
>> + fd->type == V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL ? "parallel" :
>> + fd->type == V4L2_MBUS_FRAME_DESC_TYPE_CSI2 ? "CSI-2" :
>> + "unknown");
>> + dev_dbg(sd->dev, "\tentries %u\n", fd->num_entries);
>
> You could skip this line, it's implied by the entries that you print
> below.
>
>> +
>> + for (i = 0; i < fd->num_entries; i++) {
>> + struct v4l2_mbus_frame_desc_entry *entry = &fd->entry[i];
>> +
>> + dev_dbg(sd->dev, "\tentry %u\n", i);
>> + dev_dbg(sd->dev, "\tflags%s%s\n",
>> + entry->flags & V4L2_MBUS_FRAME_DESC_FL_LEN_MAX ?
>> + " LEN_MAX" : "",
>> + entry->flags & V4L2_MBUS_FRAME_DESC_FL_BLOB ?
>> + " BLOB" : "");
>> + dev_dbg(sd->dev, "\t\tstream %u\n", entry->stream);
>> + dev_dbg(sd->dev, "\t\tpixelcode 0x%4.4x\n", entry->pixelcode);
>> + dev_dbg(sd->dev, "\t\tlength %u\n", entry->length);
>> +
>> + if (fd->type == V4L2_MBUS_FRAME_DESC_TYPE_CSI2) {
>> + dev_dbg(sd->dev, "\t\tvc %u\n", entry->bus.csi2.vc);
>> + dev_dbg(sd->dev, "\t\tdt 0x%2.2x\n", entry->bus.csi2.dt);
>
> I'd merge those two in a single line.
>
>> + }
>> + }
>
> All this is a bit verbose. If it was in a hot path I would be annoyed,
> but in this case I suppose it can be useful for debugging and won't
> affect runtime too much.
>
> It would be nice if we could have a single check and return early. That
> should be possible by using DEFINE_DYNAMIC_DEBUG_METADATA() and
> DYNAMIC_DEBUG_BRANCH(), like done in alloc_contig_dump_pages() for
> instance. It has the additional upside of being able to control all the
> messages with a single flag. I'm not sure it's worth it though, I'll let
> you decide.
Yes, this is very spammy. Maybe instead of:
Frame descriptor
type CSI-2
entries 2
entry 0
flags LEN_MAX
stream 0
pixelcode 0x3012
length 3194400
vc 0
dt 0x2c
entry 1
flags LEN_MAX
stream 1
pixelcode 0x8003
length 2904
vc 0
dt 0x12
Frame descriptor type CSI-2:
pad 0 stream 0 code 0x3012 len 3194400 vc 0 dt 0x2c LEN_MAX
pad 0 stream 1 code 0x8003 len 2904 vc 0 dt 0x12 LEN_MAX
(note: pad is missing in your patch)
Tomi
next prev parent reply other threads:[~2023-09-19 8:19 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-18 12:51 [PATCH v2 00/12] Small fixes and cleanups (ov2740 and ccs) Sakari Ailus
2023-09-18 12:51 ` [PATCH v2 01/12] media: Documentation: Align numbered list, make it a proper ReST Sakari Ailus
2023-09-18 12:51 ` [PATCH v2 02/12] media: ccs: Fix driver quirk struct documentation Sakari Ailus
2023-09-18 12:51 ` [PATCH v2 03/12] media: ccs: Correctly initialise try compose rectangle Sakari Ailus
2023-09-18 12:51 ` [PATCH v2 04/12] media: ccs: Correct error handling in ccs_register_subdev Sakari Ailus
2023-09-18 12:51 ` [PATCH v2 05/12] media: ccs: Switch to init_cfg Sakari Ailus
2023-09-18 13:53 ` Laurent Pinchart
2023-09-18 12:51 ` [PATCH v2 06/12] media: ccs: Use sub-device active state Sakari Ailus
2023-09-18 13:59 ` Laurent Pinchart
2023-09-19 10:29 ` Sakari Ailus
2023-09-19 13:42 ` Laurent Pinchart
2023-09-18 12:51 ` [PATCH v2 07/12] media: ov2740: Enable runtime PM before registering the async subdev Sakari Ailus
2023-09-18 13:27 ` Laurent Pinchart
2023-09-18 12:51 ` [PATCH v2 08/12] media: ov2740: Use sub-device active state Sakari Ailus
2023-09-18 12:51 ` [PATCH v2 09/12] media: ov2740: Return -EPROBE_DEFER if no endpoint is found Sakari Ailus
2023-09-18 13:24 ` Laurent Pinchart
2023-09-19 10:11 ` Sakari Ailus
2023-09-18 12:51 ` [PATCH v2 10/12] media: v4l: subdev: Clear frame descriptor before get_frame_desc Sakari Ailus
2023-09-18 13:30 ` Laurent Pinchart
2023-09-19 8:04 ` Tomi Valkeinen
2023-09-18 12:51 ` [PATCH v2 11/12] media: v4l: subdev: Print debug information on frame descriptor Sakari Ailus
2023-09-18 13:39 ` Laurent Pinchart
2023-09-19 8:19 ` Tomi Valkeinen [this message]
2023-09-19 10:21 ` Sakari Ailus
2023-09-18 12:51 ` [PATCH v2 12/12] media: mc: Check pad flag validity Sakari Ailus
2023-09-18 13:48 ` Laurent Pinchart
2023-09-19 10:24 ` Sakari Ailus
2023-09-19 10:37 ` Laurent Pinchart
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=749451b9-b754-fd9c-d0e8-4edb3cb613ac@ideasonboard.com \
--to=tomi.valkeinen@ideasonboard.com \
--cc=bingbu.cao@intel.com \
--cc=jacopo+renesas@jmondi.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=martink@posteo.de \
--cc=rmfrfs@gmail.com \
--cc=sakari.ailus@linux.intel.com \
--cc=tian.shu.qiu@intel.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.