lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b84b59d5b190edfce326df824f453464c00812ac.camel@ndufresne.ca>
Date: Wed, 24 Dec 2025 10:56:17 -0500
From: Nicolas Dufresne <nicolas@...fresne.ca>
To: Sven Püschel <s.pueschel@...gutronix.de>, Jacob Chen
	 <jacob-chen@...wrt.com>, Ezequiel Garcia <ezequiel@...guardiasur.com.ar>, 
 Mauro Carvalho Chehab
	 <mchehab@...nel.org>, Heiko Stuebner <heiko@...ech.de>, Rob Herring
	 <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
	 <conor+dt@...nel.org>
Cc: linux-media@...r.kernel.org, linux-rockchip@...ts.infradead.org, 
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org, 
	devicetree@...r.kernel.org, kernel@...gutronix.de
Subject: Re: [PATCH v2 17/22] media: rockchip: rga: remove stride from
 rga_frame

Le mercredi 03 décembre 2025 à 16:52 +0100, Sven Püschel a écrit :
> Remove the stride variable from rga_frame. Despite the comment it
> didn't involve any calculation and is just a copy of the
> plane_fmt[0].bytesperline value. Therefore avoid this struct member
> and use the bytesperline value directly in the places where it is
> required.
> 
> Signed-off-by: Sven Püschel <s.pueschel@...gutronix.de>

This I believe was the only user of fmt->x_div / fmt->y_div, please cleanup the
structure definition.

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@...labora.com>

> ---
>  drivers/media/platform/rockchip/rga/rga-hw.c | 20 ++++++++++++--------
>  drivers/media/platform/rockchip/rga/rga.c    |  5 +----
>  drivers/media/platform/rockchip/rga/rga.h    |  3 ---
>  3 files changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/media/platform/rockchip/rga/rga-hw.c
> b/drivers/media/platform/rockchip/rga/rga-hw.c
> index fb0389ae8e132..4dee33d8f7206 100644
> --- a/drivers/media/platform/rockchip/rga/rga-hw.c
> +++ b/drivers/media/platform/rockchip/rga/rga-hw.c
> @@ -43,7 +43,7 @@ rga_get_corner_addrs(struct rga_frame *frm, struct rga_addrs
> *addrs,
>  	struct rga_corners_addrs corner_addrs;
>  	struct rga_addrs *lt, *lb, *rt, *rb;
>  	unsigned int x_div = 0,
> -		     y_div = 0, uv_stride = 0, pixel_width = 0;
> +		     y_div = 0, y_stride = 0, uv_stride = 0, pixel_width = 0;
>  
>  	lt = &corner_addrs.left_top;
>  	lb = &corner_addrs.left_bottom;
> @@ -52,14 +52,15 @@ rga_get_corner_addrs(struct rga_frame *frm, struct
> rga_addrs *addrs,
>  
>  	x_div = frm->fmt->x_div;
>  	y_div = frm->fmt->y_div;
> -	uv_stride = frm->stride / x_div;
> -	pixel_width = frm->stride / frm->pix.width;
> +	y_stride = frm->pix.plane_fmt[0].bytesperline;
> +	uv_stride = y_stride / x_div;
> +	pixel_width = y_stride / frm->pix.width;
>  
> -	lt->y_addr = addrs->y_addr + y * frm->stride + x * pixel_width;
> +	lt->y_addr = addrs->y_addr + y * y_stride + x * pixel_width;
>  	lt->u_addr = addrs->u_addr + (y / y_div) * uv_stride + x / x_div;
>  	lt->v_addr = addrs->v_addr + (y / y_div) * uv_stride + x / x_div;
>  
> -	lb->y_addr = lt->y_addr + (h - 1) * frm->stride;
> +	lb->y_addr = lt->y_addr + (h - 1) * y_stride;
>  	lb->u_addr = lt->u_addr + (h / y_div - 1) * uv_stride;
>  	lb->v_addr = lt->v_addr + (h / y_div - 1) * uv_stride;
>  
> @@ -160,6 +161,7 @@ static void rga_cmd_set_trans_info(struct rga_ctx *ctx)
>  	union rga_src_act_info src_act_info;
>  	union rga_dst_vir_info dst_vir_info;
>  	union rga_dst_act_info dst_act_info;
> +	u32 in_stride, out_stride;
>  
>  	src_h = ctx->in.crop.height;
>  	src_w = ctx->in.crop.width;
> @@ -282,13 +284,15 @@ static void rga_cmd_set_trans_info(struct rga_ctx *ctx)
>  	 * Calculate the framebuffer virtual strides and active size,
>  	 * note that the step of vir_stride / vir_width is 4 byte words
>  	 */
> -	src_vir_info.data.vir_stride = ctx->in.stride >> 2;
> -	src_vir_info.data.vir_width = ctx->in.stride >> 2;
> +	in_stride = ctx->in.pix.plane_fmt[0].bytesperline;
> +	src_vir_info.data.vir_stride = in_stride >> 2;
> +	src_vir_info.data.vir_width = in_stride >> 2;
>  
>  	src_act_info.data.act_height = src_h - 1;
>  	src_act_info.data.act_width = src_w - 1;
>  
> -	dst_vir_info.data.vir_stride = ctx->out.stride >> 2;
> +	out_stride = ctx->out.pix.plane_fmt[0].bytesperline;
> +	dst_vir_info.data.vir_stride = out_stride >> 2;
>  	dst_act_info.data.act_height = dst_h - 1;
>  	dst_act_info.data.act_width = dst_w - 1;
>  
> diff --git a/drivers/media/platform/rockchip/rga/rga.c
> b/drivers/media/platform/rockchip/rga/rga.c
> index 0d7b0bcac950e..7e30fafb25fab 100644
> --- a/drivers/media/platform/rockchip/rga/rga.c
> +++ b/drivers/media/platform/rockchip/rga/rga.c
> @@ -220,8 +220,6 @@ static int rga_open(struct file *file)
>  		.fmt = &rga->hw->formats[0],
>  	};
>  
> -	def_frame.stride = (def_width * def_frame.fmt->depth) >> 3;
> -
>  	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
>  	if (!ctx)
>  		return -ENOMEM;
> @@ -428,7 +426,6 @@ static int vidioc_s_fmt(struct file *file, void *priv,
> struct v4l2_format *f)
>  	if (IS_ERR(frm))
>  		return PTR_ERR(frm);
>  	frm->fmt = rga_fmt_find(rga, pix_fmt->pixelformat);
> -	frm->stride = pix_fmt->plane_fmt[0].bytesperline;
>  
>  	/* Reset crop settings */
>  	frm->crop.left = 0;
> @@ -442,7 +439,7 @@ static int vidioc_s_fmt(struct file *file, void *priv,
> struct v4l2_format *f)
>  		 "[%s] fmt - %p4cc %dx%d (stride %d)\n",
>  		  V4L2_TYPE_IS_OUTPUT(f->type) ? "OUTPUT" : "CAPTURE",
>  		  &frm->fmt->fourcc, pix_fmt->width, pix_fmt->height,
> -		  frm->stride);
> +		  pix_fmt->plane_fmt[0].bytesperline);
>  
>  	for (i = 0; i < pix_fmt->num_planes; i++) {
>  		v4l2_dbg(debug, 1, &rga->v4l2_dev,
> diff --git a/drivers/media/platform/rockchip/rga/rga.h
> b/drivers/media/platform/rockchip/rga/rga.h
> index 466d568b9e614..a7f891b94a478 100644
> --- a/drivers/media/platform/rockchip/rga/rga.h
> +++ b/drivers/media/platform/rockchip/rga/rga.h
> @@ -34,9 +34,6 @@ struct rga_frame {
>  	/* Image format */
>  	struct rga_fmt *fmt;
>  	struct v4l2_pix_format_mplane pix;
> -
> -	/* Variables that can calculated once and reused */
> -	u32 stride;
>  };
>  
>  struct rga_dma_desc {

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ