[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241015080121.GA20855@pendragon.ideasonboard.com>
Date: Tue, 15 Oct 2024 13:24:17 +0300
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Prabhakar <prabhakar.csengg@...il.com>
Cc: Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-renesas-soc@...r.kernel.org,
Biju Das <biju.das.jz@...renesas.com>,
Fabrizio Castro <fabrizio.castro.jz@...esas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
Subject: Re: [PATCH v5 14/22] media: rzg2l-cru: Inline calculating
bytesperline
Hi Prabhakar,
Thank you for the patch.
On Fri, Oct 11, 2024 at 06:30:44PM +0100, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
>
> Remove the `rzg2l_cru_format_bytesperline()` function and inline the
> calculation of `bytesperline` directly in `rzg2l_cru_format_align()`.
> This simplifies the code by removing an unnecessary function call and
> directly multiplying the image width by the `bpp` (bytes per pixel)
> from the format structure.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>
> ---
> .../platform/renesas/rzg2l-cru/rzg2l-video.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> index a0fa4542ac43..8932fab7c656 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> @@ -812,20 +812,16 @@ int rzg2l_cru_dma_register(struct rzg2l_cru_dev *cru)
> * V4L2 stuff
> */
>
> -static u32 rzg2l_cru_format_bytesperline(struct v4l2_pix_format *pix)
> +static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru,
> + struct v4l2_pix_format *pix)
> {
> const struct rzg2l_cru_ip_format *fmt;
>
> fmt = rzg2l_cru_ip_format_to_fmt(pix->pixelformat);
> -
> - return pix->width * fmt->bpp;
> -}
> -
> -static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru,
> - struct v4l2_pix_format *pix)
> -{
> - if (!rzg2l_cru_ip_format_to_fmt(pix->pixelformat))
> + if (!fmt) {
> pix->pixelformat = RZG2L_CRU_DEFAULT_FORMAT;
> + fmt = rzg2l_cru_ip_format_to_fmt(pix->pixelformat);
> + }
>
> switch (pix->field) {
> case V4L2_FIELD_TOP:
> @@ -844,7 +840,7 @@ static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru,
> v4l_bound_align_image(&pix->width, 320, RZG2L_CRU_MAX_INPUT_WIDTH, 1,
> &pix->height, 240, RZG2L_CRU_MAX_INPUT_HEIGHT, 2, 0);
>
> - pix->bytesperline = rzg2l_cru_format_bytesperline(pix);
> + pix->bytesperline = pix->width * fmt->bpp;
> pix->sizeimage = pix->bytesperline * pix->height;
>
> dev_dbg(cru->dev, "Format %ux%u bpl: %u size: %u\n",
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists