mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v5 15/22] media: rzg2l-cru: Make use of v4l2_format_info() helpers
Date: Fri, 18 Oct 2024 15:26:11 +0300	[thread overview]
Message-ID: <20241018122611.GN30496@pendragon.ideasonboard.com> (raw)
In-Reply-To: <CA+V-a8tRDhDBFZsMEyxPTbW0juZMpAcJ=bj4rA3Nbsku8y4PxA@mail.gmail.com>

On Fri, Oct 18, 2024 at 12:45:36PM +0100, Lad, Prabhakar wrote:
> On Tue, Oct 15, 2024 at 11:33 AM Laurent Pinchart wrote:
> > On Fri, Oct 11, 2024 at 06:30:45PM +0100, Prabhakar wrote:
> > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > >
> > > Make use of v4l2_format_info() helpers to determine the input and
> > > output formats.
> > >
> > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > ---
> > >  .../platform/renesas/rzg2l-cru/rzg2l-video.c  | 22 ++++++-------------
> > >  1 file changed, 7 insertions(+), 15 deletions(-)
> > >
> > > diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> > > index 8932fab7c656..0cc69a7440bf 100644
> > > --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> > > +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> > > @@ -300,21 +300,12 @@ static void rzg2l_cru_initialize_axi(struct rzg2l_cru_dev *cru)
> > >       rzg2l_cru_write(cru, AMnAXIATTR, amnaxiattr);
> > >  }
> > >
> > > -static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru, bool *input_is_yuv,
> > > +static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru,
> > >                                const struct rzg2l_cru_ip_format *ip_fmt,
> > >                                u8 csi_vc)
> > >  {
> > >       u32 icnmc = ICnMC_INF(ip_fmt->datatype);
> > >
> > > -     switch (ip_fmt->code) {
> > > -     case MEDIA_BUS_FMT_UYVY8_1X16:
> > > -             *input_is_yuv = true;
> > > -             break;
> > > -     default:
> > > -             *input_is_yuv = false;
> > > -             break;
> > > -     }
> > > -
> > >       icnmc |= (rzg2l_cru_read(cru, ICnMC) & ~ICnMC_INF_MASK);
> > >
> > >       /* Set virtual channel CSI2 */
> > > @@ -327,19 +318,17 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru,
> > >                                          struct v4l2_mbus_framefmt *ip_sd_fmt,
> > >                                          u8 csi_vc)
> > >  {
> > > +     const struct v4l2_format_info *src_finfo, *dst_finfo;
> > >       const struct rzg2l_cru_ip_format *cru_ip_fmt;
> > > -     bool output_is_yuv = false;
> > > -     bool input_is_yuv = false;
> > >       u32 icndmr;
> > >
> > >       cru_ip_fmt = rzg2l_cru_ip_code_to_fmt(ip_sd_fmt->code);
> > > -     rzg2l_cru_csi2_setup(cru, &input_is_yuv, cru_ip_fmt, csi_vc);
> > > +     rzg2l_cru_csi2_setup(cru, cru_ip_fmt, csi_vc);
> > >
> > >       /* Output format */
> > >       switch (cru->format.pixelformat) {
> > >       case V4L2_PIX_FMT_UYVY:
> > >               icndmr = ICnDMR_YCMODE_UYVY;
> > > -             output_is_yuv = true;
> > >               break;
> > >       default:
> > >               dev_err(cru->dev, "Invalid pixelformat (0x%x)\n",
> > > @@ -347,8 +336,11 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru,
> > >               return -EINVAL;
> > >       }
> > >
> > > +     src_finfo = v4l2_format_info(cru_ip_fmt->format);
> > > +     dst_finfo = v4l2_format_info(cru->format.pixelformat);
> >
> > It would be a bit more efficient to add a yuv boolean field to the
> > rzg2l_cru_ip_format structure, as you already have looked up cru_ip_fmt
> > for the IP subdev format.
>
> I will consider this change, when adding support for the RZ/V2H SoC,
> hope that's OK for you.

It's not a blocker, it can be done on top indeed. If you end up
submitting a v6 you could add a patch on top already, but otherwise
later is fine too.

> > Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> >
> > > +
> > >       /* If input and output use same colorspace, do bypass mode */
> > > -     if (output_is_yuv == input_is_yuv)
> > > +     if (v4l2_is_format_yuv(src_finfo) == v4l2_is_format_yuv(dst_finfo))
> > >               rzg2l_cru_write(cru, ICnMC,
> > >                               rzg2l_cru_read(cru, ICnMC) | ICnMC_CSCTHR);
> > >       else

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2024-10-18 12:26 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11 17:30 [PATCH v5 00/22] media: platform: rzg2l-cru: CSI-2 and CRU enhancements Prabhakar
2024-10-11 17:30 ` [PATCH v5 01/22] media: rzg2l-cru: Use RZG2L_CRU_IP_SINK/SOURCE enum entries Prabhakar
2024-10-11 17:30 ` [PATCH v5 02/22] media: rzg2l-cru: Mark sink and source pad with MUST_CONNECT flag Prabhakar
2024-10-11 17:30 ` [PATCH v5 03/22] media: rzg2l-cru: csi2: " Prabhakar
2024-10-11 17:30 ` [PATCH v5 04/22] media: rzg2l-cru: csi2: Use ARRAY_SIZE() in media_entity_pads_init() Prabhakar
2024-10-11 17:30 ` [PATCH v5 05/22] media: rzg2l-cru: csi2: Implement .get_frame_desc() Prabhakar
2024-10-11 17:30 ` [PATCH v5 06/22] media: rzg2l-cru: Retrieve virtual channel information Prabhakar
2024-10-11 17:30 ` [PATCH v5 07/22] media: rzg2l-cru: Remove `channel` member from `struct rzg2l_cru_csi` Prabhakar
2024-10-11 17:30 ` [PATCH v5 08/22] media: rzg2l-cru: Use MIPI CSI-2 data types for ICnMC_INF definitions Prabhakar
2024-10-11 17:30 ` [PATCH v5 09/22] media: rzg2l-cru: Remove unused fields from rzg2l_cru_ip_format struct Prabhakar
2024-10-11 17:30 ` [PATCH v5 10/22] media: rzg2l-cru: Remove unnecessary WARN_ON check in format func Prabhakar
2024-10-15 10:22   ` Laurent Pinchart
2024-10-15 17:33     ` Lad, Prabhakar
2024-10-11 17:30 ` [PATCH v5 11/22] media: rzg2l-cru: Simplify configuring input format for image processing Prabhakar
2024-10-15 10:22   ` Laurent Pinchart
2024-10-11 17:30 ` [PATCH v5 12/22] media: rzg2l-cru: Inline calculating image size Prabhakar
2024-10-15 10:22   ` Laurent Pinchart
2024-10-15 17:43     ` Lad, Prabhakar
2024-10-11 17:30 ` [PATCH v5 13/22] media: rzg2l-cru: Simplify handling of supported formats Prabhakar
2024-10-15 10:23   ` Laurent Pinchart
2024-10-15 17:47     ` Lad, Prabhakar
2024-10-11 17:30 ` [PATCH v5 14/22] media: rzg2l-cru: Inline calculating bytesperline Prabhakar
2024-10-15 10:24   ` Laurent Pinchart
2024-10-11 17:30 ` [PATCH v5 15/22] media: rzg2l-cru: Make use of v4l2_format_info() helpers Prabhakar
2024-10-15 10:33   ` Laurent Pinchart
2024-10-18 11:45     ` Lad, Prabhakar
2024-10-18 12:26       ` Laurent Pinchart [this message]
2024-10-18 12:40         ` Lad, Prabhakar
2024-10-11 17:30 ` [PATCH v5 16/22] media: rzg2l-cru: Use `rzg2l_cru_ip_formats` array in enum_frame_size Prabhakar
2024-10-11 17:30 ` [PATCH v5 17/22] media: rzg2l-cru: csi2: Remove unused field from rzg2l_csi2_format Prabhakar
2024-10-11 17:30 ` [PATCH v5 18/22] media: rzg2l-cru: video: Implement .link_validate() callback Prabhakar
2024-10-15 10:33   ` Laurent Pinchart
2024-10-11 17:30 ` [PATCH v5 19/22] media: rzg2l-cru: csi2: Use rzg2l_csi2_formats array in enum_frame_size Prabhakar
2024-10-11 17:30 ` [PATCH v5 20/22] media: rzg2l-cru: Refactor ICnDMR register configuration Prabhakar
2024-10-11 17:30 ` [PATCH v5 21/22] media: rzg2l-cru: Add support to capture 8bit raw sRGB Prabhakar
2024-10-11 17:30 ` [PATCH v5 22/22] media: rzg2l-cru: Move register definitions to a separate file Prabhakar

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=20241018122611.GN30496@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --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

all inboxes | Powered by JetHome®