Re: [PATCH 4/4] media: rkvdec: align bytesperline to 64 bytes in rkvdec_fill_decoded_pixfmt()

Detlev Casanova <[email protected]>
Newsgroups org.infradead.lists.linux-rockchip,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-media
Message-ID <[email protected]>
Hi !

On Sunday, 26 July 2026 16:25:37 EDT Venkata Atchuta Bheemeswara Sarma Darbha 
wrote:
> From: Igor Paunovic <[email protected]>
> 
> Ensure bytesperline is 64-byte aligned and scale sizeimage accordingly.
> 
> Signed-off-by: Igor Paunovic <[email protected]>
> Signed-off-by: Francesco Saverio Pavone <[email protected]>
> Signed-off-by: Venkata Atchuta Bheemeswara Sarma Darbha
> <[email protected]> ---
>  drivers/media/platform/rockchip/rkvdec/rkvdec.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> b/drivers/media/platform/rockchip/rkvdec/rkvdec.c index
> 436bb460f04e..6ab6530b1cc9 100644
> --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> @@ -102,12 +102,20 @@ static void rkvdec_fill_decoded_pixfmt(struct
> rkvdec_ctx *ctx, struct v4l2_pix_format_mplane *pix_mp)
>  {
>  	const struct rkvdec_variant *variant = ctx->dev->variant;
> +	struct v4l2_plane_pix_format *plane = &pix_mp->plane_fmt[0];
> +	u32 aligned_bpl;
> 
>  	v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat, pix_mp->width,
> pix_mp->height);
> 
> -	ctx->colmv_offset = pix_mp->plane_fmt[0].sizeimage;
> +	/* ensure bpl is 64 byte aligned and scale sizeimage accordingly. 
*/
> +	aligned_bpl = ALIGN(plane->bytesperline, 64);
> +	if (aligned_bpl != plane->bytesperline) {
> +		plane->sizeimage = plane->sizeimage / plane-
>bytesperline * aligned_bpl;
> +		plane->bytesperline = aligned_bpl;
> +	}

This shouldn't be needed. As you set step_width to 64, 
v4l2_apply_frmsize_constraints() should already do the alignment.

Do you have more context as to when width is not aligned ?

> 
> -	pix_mp->plane_fmt[0].sizeimage += variant->ops->colmv_size(pix_mp-
>width,
> pix_mp->height); +	ctx->colmv_offset = plane->sizeimage;
> +	plane->sizeimage += variant->ops->colmv_size(pix_mp->width,
> pix_mp->height); }
> 
>  static void rkvdec_reset_fmt(struct rkvdec_ctx *ctx, struct v4l2_format *f,

Regards,
Detlev.




_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.