linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Figa <tfiga@chromium.org>
To: Ezequiel Garcia <ezequiel@collabora.com>
Cc: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
	Helen Koike <helen.koike@collabora.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	kernel@collabora.com, Dafna Hirschfeld <dafna3@gmail.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH v2 2/4] media: staging: rkisp1: rsz: use hdiv, vdiv of yuv422 instead of macros
Date: Wed, 27 May 2020 00:26:05 +0200	[thread overview]
Message-ID: <CAAFQd5Di0hJKMo1NB6DJSRL5FMnK1sVtuhD0BhcKSUGTXd66sQ@mail.gmail.com> (raw)
In-Reply-To: <5a4e994d9b5b702205301a9b72bef2d013d4e106.camel@collabora.com>

On Fri, May 22, 2020 at 5:05 PM Ezequiel Garcia <ezequiel@collabora.com> wrote:
>
> On Fri, 2020-05-22 at 16:15 +0200, Dafna Hirschfeld wrote:
> >
> > On 22.05.20 15:31, Ezequiel Garcia wrote:
> > > Hi Dafna, Helen,
> > >
> > > On Fri, 2020-05-22 at 14:11 +0200, Dafna Hirschfeld wrote:
> > > > On 21.05.20 00:08, Helen Koike wrote:
> > > > > On 5/20/20 6:54 PM, Helen Koike wrote:
> > > > > > Hi Dafna,
> > > > > >
> > > > > > On 5/15/20 11:29 AM, Dafna Hirschfeld wrote:
> > > > > > > The resize block of rkisp1 always get the input as yuv422.
> > > > > > > Instead of defining the default hdiv, vdiv as macros, the
> > > > > > > code is more clear if it takes the (hv)div from the YUV422P
> > > > > > > info. This makes it clear where those values come from.
> > > > > > > The patch also adds documentation to explain that.
> > > > > > >
> > > > > > > Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
> > > > > >
> > > > > > Acked-by: Helen Koike <helen.koike@collabora.com>
> > > > > >
> > > > > > Thanks!
> > > > > > Helen
> > > > > >
> > > > > > > ---
> > > > > > >    drivers/staging/media/rkisp1/rkisp1-resizer.c | 25 +++++++++----------
> > > > > > >    1 file changed, 12 insertions(+), 13 deletions(-)
> > > > > > >
> > > > > > > diff --git a/drivers/staging/media/rkisp1/rkisp1-resizer.c b/drivers/staging/media/rkisp1/rkisp1-resizer.c
> > > > > > > index d049374413dc..04a29af8cc92 100644
> > > > > > > --- a/drivers/staging/media/rkisp1/rkisp1-resizer.c
> > > > > > > +++ b/drivers/staging/media/rkisp1/rkisp1-resizer.c
> > > > > > > @@ -16,9 +16,6 @@
> > > > > > >    #define RKISP1_DEF_FMT MEDIA_BUS_FMT_YUYV8_2X8
> > > > > > >    #define RKISP1_DEF_PIXEL_ENC V4L2_PIXEL_ENC_YUV
> > > > > > >
> > > > > > > -#define RKISP1_MBUS_FMT_HDIV 2
> > > > > > > -#define RKISP1_MBUS_FMT_VDIV 1
> > > > > > > -
> > > > > > >    enum rkisp1_shadow_regs_when {
> > > > > > >     RKISP1_SHADOW_REGS_SYNC,
> > > > > > >     RKISP1_SHADOW_REGS_ASYNC,
> > > > > > > @@ -361,11 +358,12 @@ static void rkisp1_rsz_config_regs(struct rkisp1_resizer *rsz,
> > > > > > >    static void rkisp1_rsz_config(struct rkisp1_resizer *rsz,
> > > > > > >                           enum rkisp1_shadow_regs_when when)
> > > > > > >    {
> > > > > > > -   u8 hdiv = RKISP1_MBUS_FMT_HDIV, vdiv = RKISP1_MBUS_FMT_VDIV;
> > > > > > >     struct v4l2_rect sink_y, sink_c, src_y, src_c;
> > > > > > >     struct v4l2_mbus_framefmt *src_fmt;
> > > > > > >     struct v4l2_rect *sink_crop;
> > > > > > >     struct rkisp1_capture *cap = &rsz->rkisp1->capture_devs[rsz->id];
> > > > > > > +   const struct v4l2_format_info *yuv422_info =
> > > > > > > +           v4l2_format_info(V4L2_PIX_FMT_YUV422P);
> > > > > > >
> > >
> > > Instead of hardcoding this fourcc, is there any way we can
> > > retrieve it from a configured format?
> > >
> > What do you mean?
> > If the configured format is bayer then the resizer is disabled.
> > Otherwise the resizer always get the input as yuv422, this is why it is hard coded.
> >
>
> I don't like to rely on these assumptions/knowledge.
> It's much cleaner to retrieve the format, and avoiding
> hardcoding things as much as you can.

It would indeed be cleaner if we could retrieve this format from
somewhere, but where would that be? In theory we could assign a
YUV4:2:2 mbus format to the resizer input pad, but I think there is no
similar data available for mbs formats, is there?

Actually, if we look at this a bit more strictly, V4L2_PIX_FMT_YUV422P
is not exactly what the resizer gets at its input.
V4L2_PIX_FMT_YUV422P is a specific memory representation and the
corresponding v4l2_format_info struct contains data about the memory
layout. The resizer gets an unspecified YUV 4:2:2 pixel stream. Making
the code suggest that it's V4L2_PIX_FMT_YUV422P might make it more
confusing in another way.

Perhaps the way forward would be to simply add a comment explaining
where the 2 and 1 dividers come from?

Best regards,
Tomasz

  parent reply	other threads:[~2020-05-26 22:26 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 14:29 [PATCH v2 0/4] media: staging: rkisp1: various fixes to capture formats Dafna Hirschfeld
2020-05-15 14:29 ` [PATCH v2 1/4] media: staging: rkisp1: cap: change RGB24 format to XBGR32 Dafna Hirschfeld
2020-05-20 21:50   ` Helen Koike
2020-05-26 23:04   ` Tomasz Figa
2020-06-10 16:11     ` Dafna Hirschfeld
2020-06-10 16:15       ` Tomasz Figa
2020-05-15 14:29 ` [PATCH v2 2/4] media: staging: rkisp1: rsz: use hdiv, vdiv of yuv422 instead of macros Dafna Hirschfeld
2020-05-20 21:54   ` Helen Koike
2020-05-20 22:08     ` Helen Koike
2020-05-22 12:11       ` Dafna Hirschfeld
2020-05-22 13:31         ` Ezequiel Garcia
2020-05-22 14:15           ` Dafna Hirschfeld
2020-05-22 15:04             ` Ezequiel Garcia
2020-05-25  9:51               ` Dafna Hirschfeld
2020-05-26 22:26               ` Tomasz Figa [this message]
2020-05-22 13:57         ` Laurent Pinchart
2020-05-22 14:54           ` Dafna Hirschfeld
2020-05-22 14:59             ` Laurent Pinchart
2020-06-10 16:36               ` Dafna Hirschfeld
2020-05-26 22:44   ` Tomasz Figa
2020-06-10 17:01     ` Dafna Hirschfeld
2020-06-10 17:08       ` Tomasz Figa
2020-05-15 14:29 ` [PATCH v2 3/4] media: staging: rkisp1: rsz: set output format to YUV422 if cap format is YUV444 Dafna Hirschfeld
2020-05-20 22:23   ` Helen Koike
2020-05-26 23:09   ` Tomasz Figa
2020-06-12 12:45     ` Dafna Hirschfeld
2020-06-18 17:47       ` Tomasz Figa
2020-06-18 18:00         ` Dafna Hirschfeld
2020-06-18 18:12           ` Tomasz Figa
2020-06-18 18:50             ` Dafna Hirschfeld
2020-06-18 19:18               ` Tomasz Figa
2020-06-19  7:30                 ` Dafna Hirschfeld
2020-06-19 12:04                   ` Tomasz Figa
2020-07-18 16:05                     ` Dafna Hirschfeld
2020-05-15 14:29 ` [PATCH v2 4/4] media: staging: rkisp1: cap: remove support of BGR666 format Dafna Hirschfeld
2020-05-20 22:34   ` Helen Koike
2020-05-26 22:57     ` Tomasz Figa
2020-05-27 10:14       ` Helen Koike

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=CAAFQd5Di0hJKMo1NB6DJSRL5FMnK1sVtuhD0BhcKSUGTXd66sQ@mail.gmail.com \
    --to=tfiga@chromium.org \
    --cc=dafna.hirschfeld@collabora.com \
    --cc=dafna3@gmail.com \
    --cc=ezequiel@collabora.com \
    --cc=helen.koike@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).