Re: [PATCH v5 5/5] media: rzg2l-cru: Use v4l2_fill_pixfmt_aligned() for stride alignment

Jacopo Mondi <[email protected]> Fri, 31 Jul 2026 17:07:06 +0200
Newsgroups org.kernel.vger.linux-renesas-soc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-media
Message-ID <amy559iChdLrrMTj@zed>
Hi Tommaso

On Wed, Jul 29, 2026 at 12:55:50PM +0200, Tommaso Merciai wrote:
> Replace the open-coded bytesperline/sizeimage rounding with the newly
> added v4l2_fill_pixfmt_aligned().
>
> No functional change intended.
>
> Signed-off-by: Tommaso Merciai <[email protected]>
> ---
> v4->v5:
>  - Split the fix so it no longer depends on v4l2_fill_pixfmt_aligned()
>    and moved it first in the series, so it can be backported to stable
>    on its own (This the old v4 PATCH 4/4).
>
>  drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> index 91eda5034248..27a35ef2a6df 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> @@ -849,12 +849,8 @@ static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru,
>  	v4l_bound_align_image(&pix->width, 320, info->max_width, 1,
>  			      &pix->height, 240, info->max_height, 2, 0);
>
> -	v4l2_fill_pixfmt(pix, pix->pixelformat, pix->width, pix->height);
> -
> -	if (info->has_stride) {
> -		pix->bytesperline = ALIGN(pix->bytesperline, RZG2L_CRU_STRIDE_ALIGN);
> -		pix->sizeimage = pix->bytesperline * pix->height;
> -	}
> +	v4l2_fill_pixfmt_aligned(pix, pix->pixelformat, pix->width, pix->height,
> +				 info->has_stride ? RZG2L_CRU_STRIDE_ALIGN : 1);

this will look very nice with info->stride.

In the meantime
Reviewed-by: Jacopo Mondi <[email protected]>

Sorry for having missed it yesterday
>
>  	dev_dbg(cru->dev, "Format %ux%u bpl: %u size: %u\n",
>  		pix->width, pix->height, pix->bytesperline, pix->sizeimage);
> --
> 2.54.0
>