[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210212100140.GC3@paasikivi.fi.intel.com>
Date: Fri, 12 Feb 2021 12:01:40 +0200
From: Sakari Ailus <sakari.ailus@...ux.intel.com>
To: Petr Mladek <pmladek@...e.com>
Cc: linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Dave Stevenson <dave.stevenson@...pberrypi.com>,
dri-devel@...ts.freedesktop.org, hverkuil@...all.nl,
laurent.pinchart@...asonboard.com, mchehab@...nel.org,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Joe Perches <joe@...ches.com>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: Re: [PATCH v6 2/3] v4l: ioctl: Use %p4cc printk modifier to print
FourCC codes
Hi Petr,
On Thu, Feb 11, 2021 at 05:31:46PM +0100, Petr Mladek wrote:
> On Mon 2021-02-08 22:09:02, Sakari Ailus wrote:
> > Now that we can print FourCC codes directly using printk, make use of the
> > feature in V4L2 core.
> >
> > Signed-off-by: Sakari Ailus <sakari.ailus@...ux.intel.com>
> > ---
> > drivers/media/v4l2-core/v4l2-ioctl.c | 85 +++++++---------------------
> > 1 file changed, 21 insertions(+), 64 deletions(-)
> >
> > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> > index 31d1342e61e8..31662c3a8c9e 100644
> > --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> > @@ -265,13 +265,9 @@ static void v4l_print_fmtdesc(const void *arg, bool write_only)
> > {
> > const struct v4l2_fmtdesc *p = arg;
> >
> > - pr_cont("index=%u, type=%s, flags=0x%x, pixelformat=%c%c%c%c, mbus_code=0x%04x, description='%.*s'\n",
> > + pr_cont("index=%u, type=%s, flags=0x%x, pixelformat=%p4cc, mbus_code=0x%04x, description='%.*s'\n",
>
> Is %p4cc really acceptable here?
>
> The original code printed only the 4 characters. The original code
> would print something like:
>
> index=21, type=bla, flags=0x0, pixelformat=BG12, mbus_code=0x0a9f, descrition="bla bla bla"
>
> while the new code will do:
>
> index=21, type=bla, flags=0x0, pixelformat=BG12 little-endian (0x32314742), mbus_code=0x0a9f, descrition="bla bla bla"
>
> This is much harder to parse because there are spaces also inside
> pixel_format=<value>
Note that also the fourcc code itself could contains spaces so that's not
new.
The fourcc (debug) form is now one and the same for V4L2 and DRM, but I
guess nothing would prevent adding a shorter form if needed. This is not
continuously happening during streaming so this is also not performance
critical in any way. The fourcc code was used to be printed this way here
mainly because it was, well, easy to do for "just" debugging purposes.
Hans, any opinion?
--
Kind regards,
Sakari Ailus
Powered by blists - more mailing lists