From nobody Mon Feb 9 20:09:33 2026 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E1292D5408 for ; Tue, 7 Oct 2025 08:32:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759825974; cv=none; b=r/IRotMWWRMrgJWVOBtvHKk0eaQO5Jlbp3hIVog63y5C0+zi21trjMPO78HJp4Yh1F0+1gYMEtkTmA3maPOvWBTGAmJXqd/U6tjtzEF11yarNog96L7x5dPqSYDW5JUwll7nHHDX3gdTXoN0PurtA/ujihBHbnX/qTe11AfvJp4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759825974; c=relaxed/simple; bh=Bz5OwsUHnjn3p4WpBdtld1xIHeD+7KZpfsp68vDecvg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nQ6zb1UGkEe1J3FtE+227uIbbSErtC7DQq0VGHMI5m4NSpsS5eWnAj/dFMQ499EHVISwaXdbdwZ3sqGz8kHpzk3NeUZ7M++YKPRuNxKHb1Ej5TRAssGO/Pzfm8nNsvIIqDnpO+Gaxy0ClYlG23mqvRB8tOd+753ark7dV685vIk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=peter.mobile.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1v637p-0002Hb-J6; Tue, 07 Oct 2025 10:32:49 +0200 From: =?utf-8?q?Sven_P=C3=BCschel?= Date: Tue, 07 Oct 2025 10:31:55 +0200 Subject: [PATCH 02/16] media: rockchip: rga: use stride for offset calculation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251007-spu-rga3-v1-2-36ad85570402@pengutronix.de> References: <20251007-spu-rga3-v1-0-36ad85570402@pengutronix.de> In-Reply-To: <20251007-spu-rga3-v1-0-36ad85570402@pengutronix.de> To: Jacob Chen , Ezequiel Garcia , Mauro Carvalho Chehab , Heiko Stuebner , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kernel@pengutronix.de, =?utf-8?q?Sven_P=C3=BCschel?= X-Mailer: b4 0.14.2 X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: s.pueschel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Use the stride instead of the width for the offset calculation. This ensures that the bytesperline value doesn't need to match the width value of the image. Furthermore this patch removes the dependency on the uv_factor property and instead reuses the v4l2_format_info to determine the correct division factor. Signed-off-by: Sven P=C3=BCschel --- drivers/media/platform/rockchip/rga/rga-buf.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/rockchip/rga/rga-buf.c b/drivers/media/= platform/rockchip/rga/rga-buf.c index 730bdf98565a55704cef92345ccf9f486b99b06e..b5e6b1b527ca81721c64d96d984= d5e981449c237 100644 --- a/drivers/media/platform/rockchip/rga/rga-buf.c +++ b/drivers/media/platform/rockchip/rga/rga-buf.c @@ -14,7 +14,6 @@ #include #include =20 -#include "rga-hw.h" #include "rga.h" =20 static ssize_t fill_descriptors(struct rga_dma_desc *desc, size_t max_desc, @@ -92,14 +91,19 @@ static int rga_buf_init(struct vb2_buffer *vb) return 0; } =20 -static int get_plane_offset(struct rga_frame *f, int plane) +static int get_plane_offset(struct rga_frame *f, + const struct v4l2_format_info *info, + int plane) { + u32 stride =3D f->pix.plane_fmt[0].bytesperline; + if (plane =3D=3D 0) return 0; if (plane =3D=3D 1) - return f->width * f->height; + return stride * f->height; if (plane =3D=3D 2) - return f->width * f->height + (f->width * f->height / f->fmt->uv_factor); + return stride * f->height + + (stride * f->height / info->hdiv / info->vdiv); =20 return -EINVAL; } @@ -145,7 +149,7 @@ static int rga_buf_prepare(struct vb2_buffer *vb) /* Fill the remaining planes */ info =3D v4l2_format_info(f->fmt->fourcc); for (i =3D info->mem_planes; i < info->comp_planes; i++) - offsets[i] =3D get_plane_offset(f, i); + offsets[i] =3D get_plane_offset(f, info, i); =20 rbuf->offset.y_off =3D offsets[0]; rbuf->offset.u_off =3D offsets[1]; --=20 2.51.0