From patchwork Thu Jan 23 17:04:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13948494 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 24669446A1; Thu, 23 Jan 2025 17:04:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651883; cv=none; b=PhmnIcT8KJIJrRKxiE2wjGHLUgwE5ZMj8vjGgX+c6MYZVjc/sM5rvsK5iE1+1piMZe1SLrlAeOjM4G9Lwx+wvohj/eiSjZOA7qVhwWn3/dC/7ZDVi2TgyZgZi2yT9/aicMkOS3DskQnWzu5RY3AeWZFDVAp5TLdnGdQK1kQ3Kec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651883; c=relaxed/simple; bh=6sR8cA9DorUfdFJCUsS7a867gEswq7Ha+kq68rMEtOU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GApaNaxZGOmeBKNh9ZGS7fXRVy5VinBFYDe+/Ju2h1ejsoQfeCDlV5AMVeE/3OvpKNjoZxjBM8SOHWSPiLWxW57U0DtrAFVUAnVsHtWdYzdpeKKwZTDE6qn4DW/ljouNPDlSEeNlJMRI99PyqF5Ag9lPL2elvt27X/o+fEH392I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=GcD3W+qz; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="GcD3W+qz" Received: from [192.168.1.103] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A5858D1F; Thu, 23 Jan 2025 18:03:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737651815; bh=6sR8cA9DorUfdFJCUsS7a867gEswq7Ha+kq68rMEtOU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GcD3W+qzABQf4PijNxE79/JJhlMlcaWzpXuNfvq5UcY4edVRFcqIevq4v4myGBlh6 Vr/1W+cZLoCvav6LW9aT4PihjGXchnMc/xULnJAkIbKW/BrEBTB5J/b2aIjQ+nxsRu YkJlr/14rQblbUFccmzb2qmP9NbeGNc9xv88eI+8= From: Jacopo Mondi Date: Thu, 23 Jan 2025 18:04:02 +0100 Subject: [PATCH 1/6] media: vsp1: Add support IIF ISP Interface Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250123-v4h-iif-v1-1-7b4e5299939f@ideasonboard.com> References: <20250123-v4h-iif-v1-0-7b4e5299939f@ideasonboard.com> In-Reply-To: <20250123-v4h-iif-v1-0-7b4e5299939f@ideasonboard.com> To: Laurent Pinchart , Kieran Bingham , Mauro Carvalho Chehab , =?utf-8?q?Niklas_S=C3=B6derlun?= =?utf-8?q?d?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Jacopo Mondi X-Mailer: b4 0.15-dev-1b0d6 X-Developer-Signature: v=1; a=openpgp-sha256; l=12916; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=6sR8cA9DorUfdFJCUsS7a867gEswq7Ha+kq68rMEtOU=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBnknakz+HKXijPJ3+6bSCRIVFIW2Wfuo49M0Z/X uziY/kj3JuJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ5J2pAAKCRByNAaPFqFW PH/mEACIm7dwO0AP6OOjv9dhCF++FBhcdYBDuqf/V4qf6q8mgscIEHlJCimhVz5EJGmQEo4Y+3G Ml3ki8dzx2/TsM3KgnIAvmZp/r7w/tHiK6xlVUGe5lFSo57i6cNhzT+UxmWjOH6Za3ZewHw20/c bLHkXV1rdLZkgztxyooygMSVbvnUXCoZBDUMlb7/KZnOl46Ya778TuCB2gKxCsnjJWBd6V+8xwY 7tedXvcIiPDqfCK3f5TnTr/KZ8C2WN2XDfTLk8EBBRdj72ngAlxBWjckgA+Qr9Nom+esuz/vlyY Ult672toHck0RByX3ghNyJrKIkTprh8NF/OD/AGAuoZ04wyicPRnCOwJ8u4LNUiUhPSgcGjBOuE Zxm4mXkWVeS4my6i4r3HSd7tixQiBbobAd2vTtyhS/Ycva9plJ7oUhGsaHapJJ9lAYAX6tkrsab H4DgEcbaaXWfyAYRuVauU1Fr6NnOVGaZWeVGY7fwxtJqkXJruP+Q1aWDAYuEwkbbaVzSKyvO316 0HmKXXfHhJe/gjTUn+AWbfTNJIMYjT/Ox/a+jUPQtN4fnx3T9mZnblgGNjOro78P1IWS8t1RJjt 3htmTKxqO6+leNbDywnZXZdsmVFmL+Neqmqq9U+64/JGxOS7ldZu0aAUbBoabTQUxjsmIA8Yx9k qebpVhQxb9gW/Hw== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The IIF (ISP InterFace) is a specialized BRU version that transfers data to the ISP by reading from external memory through two RPF instances. Add support for it in the vsp1 driver by introducing a new entity type. The sole required operation is to enable the IIF function on the BRU during configure_stream(). Signed-off-by: Jacopo Mondi --- drivers/media/platform/renesas/vsp1/Makefile | 2 +- drivers/media/platform/renesas/vsp1/vsp1.h | 3 + drivers/media/platform/renesas/vsp1/vsp1_drv.c | 11 ++ drivers/media/platform/renesas/vsp1/vsp1_entity.c | 8 ++ drivers/media/platform/renesas/vsp1/vsp1_entity.h | 1 + drivers/media/platform/renesas/vsp1/vsp1_iif.c | 134 ++++++++++++++++++++++ drivers/media/platform/renesas/vsp1/vsp1_iif.h | 31 +++++ drivers/media/platform/renesas/vsp1/vsp1_pipe.c | 1 + drivers/media/platform/renesas/vsp1/vsp1_pipe.h | 1 + drivers/media/platform/renesas/vsp1/vsp1_regs.h | 7 ++ 10 files changed, 198 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/vsp1/Makefile b/drivers/media/platform/renesas/vsp1/Makefile index 4bb4dcbef7b55be7a40231a04e14029911da9beb..e080377af01672451c3274118f74dbd132ec573f 100644 --- a/drivers/media/platform/renesas/vsp1/Makefile +++ b/drivers/media/platform/renesas/vsp1/Makefile @@ -5,6 +5,6 @@ vsp1-y += vsp1_rpf.o vsp1_rwpf.o vsp1_wpf.o vsp1-y += vsp1_clu.o vsp1_hsit.o vsp1_lut.o vsp1-y += vsp1_brx.o vsp1_sru.o vsp1_uds.o vsp1-y += vsp1_hgo.o vsp1_hgt.o vsp1_histo.o -vsp1-y += vsp1_lif.o vsp1_uif.o +vsp1-y += vsp1_lif.o vsp1_uif.o vsp1_iif.o obj-$(CONFIG_VIDEO_RENESAS_VSP1) += vsp1.o diff --git a/drivers/media/platform/renesas/vsp1/vsp1.h b/drivers/media/platform/renesas/vsp1/vsp1.h index 2f6f0c6ae55514d312e48232a5f8c8673f69ba13..263024639dd2a7564fc70ad52dbe17f9a5279f45 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1.h +++ b/drivers/media/platform/renesas/vsp1/vsp1.h @@ -32,6 +32,7 @@ struct vsp1_clu; struct vsp1_hgo; struct vsp1_hgt; struct vsp1_hsit; +struct vsp1_iif; struct vsp1_lif; struct vsp1_lut; struct vsp1_rwpf; @@ -56,6 +57,7 @@ struct vsp1_uif; #define VSP1_HAS_BRS BIT(9) #define VSP1_HAS_EXT_DL BIT(10) #define VSP1_HAS_NON_ZERO_LBA BIT(11) +#define VSP1_HAS_IIF BIT(12) struct vsp1_device_info { u32 version; @@ -91,6 +93,7 @@ struct vsp1_device { struct vsp1_hgt *hgt; struct vsp1_hsit *hsi; struct vsp1_hsit *hst; + struct vsp1_iif *iif; struct vsp1_lif *lif[VSP1_MAX_LIF]; struct vsp1_lut *lut; struct vsp1_rwpf *rpf[VSP1_MAX_RPF]; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drv.c b/drivers/media/platform/renesas/vsp1/vsp1_drv.c index 9fc6bf624a520ae38e9c5f30dfa4dfa412eec38e..cbaad0ea0b73f90f3994bbdfb4304d2f71eabccd 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_drv.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_drv.c @@ -29,6 +29,7 @@ #include "vsp1_hgo.h" #include "vsp1_hgt.h" #include "vsp1_hsit.h" +#include "vsp1_iif.h" #include "vsp1_lif.h" #include "vsp1_lut.h" #include "vsp1_pipe.h" @@ -292,6 +293,16 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) list_add_tail(&vsp1->bru->entity.list_dev, &vsp1->entities); } + if (vsp1_feature(vsp1, VSP1_HAS_IIF)) { + vsp1->iif = vsp1_iif_create(vsp1); + if (IS_ERR(vsp1->iif)) { + ret = PTR_ERR(vsp1->iif); + goto done; + } + + list_add_tail(&vsp1->iif->entity.list_dev, &vsp1->entities); + } + if (vsp1_feature(vsp1, VSP1_HAS_CLU)) { vsp1->clu = vsp1_clu_create(vsp1); if (IS_ERR(vsp1->clu)) { diff --git a/drivers/media/platform/renesas/vsp1/vsp1_entity.c b/drivers/media/platform/renesas/vsp1/vsp1_entity.c index 8b8945bd8f108354f1b484530bc496dbac7d3d88..343fc8f7fd6ef37a1c2e10ceaca2b7818cbd752d 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_entity.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_entity.c @@ -63,9 +63,14 @@ void vsp1_entity_route_setup(struct vsp1_entity *entity, /* * The ILV and BRS share the same data path route. The extra BRSSEL bit * selects between the ILV and BRS. + * + * For VSPX the IIF (a specialized BRU) is enabled with the extra + * IIFSEL bit. */ if (source->type == VSP1_ENTITY_BRS) route |= VI6_DPR_ROUTE_BRSSEL; + else if (source->type == VSP1_ENTITY_IIF) + route |= VI6_DPR_BRU_ROUTE_IIFSEL; vsp1_dl_body_write(dlb, source->route->reg, route); } @@ -528,6 +533,9 @@ struct media_pad *vsp1_entity_remote_pad(struct media_pad *pad) { VI6_DPR_NODE_WPF(idx) }, VI6_DPR_NODE_WPF(idx) } static const struct vsp1_route vsp1_routes[] = { + { VSP1_ENTITY_IIF, 0, VI6_DPR_BRU_ROUTE, + { VI6_DPR_NODE_BRU_IN(0), VI6_DPR_NODE_BRU_IN(1), + VI6_DPR_NODE_BRU_IN(3) }, VI6_DPR_NODE_WPF(0) }, { VSP1_ENTITY_BRS, 0, VI6_DPR_ILV_BRS_ROUTE, { VI6_DPR_NODE_BRS_IN(0), VI6_DPR_NODE_BRS_IN(1) }, 0 }, { VSP1_ENTITY_BRU, 0, VI6_DPR_BRU_ROUTE, diff --git a/drivers/media/platform/renesas/vsp1/vsp1_entity.h b/drivers/media/platform/renesas/vsp1/vsp1_entity.h index 1bcc9e27dfdc7385e91987c84c46fc3725f3b90e..bdcb780a79dafccda3843bd65d337b64d6e12eb3 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_entity.h +++ b/drivers/media/platform/renesas/vsp1/vsp1_entity.h @@ -28,6 +28,7 @@ enum vsp1_entity_type { VSP1_ENTITY_HGT, VSP1_ENTITY_HSI, VSP1_ENTITY_HST, + VSP1_ENTITY_IIF, VSP1_ENTITY_LIF, VSP1_ENTITY_LUT, VSP1_ENTITY_RPF, diff --git a/drivers/media/platform/renesas/vsp1/vsp1_iif.c b/drivers/media/platform/renesas/vsp1/vsp1_iif.c new file mode 100644 index 0000000000000000000000000000000000000000..ceb5e5988b02d86e9b444036ba70c7517d863850 --- /dev/null +++ b/drivers/media/platform/renesas/vsp1/vsp1_iif.c @@ -0,0 +1,134 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * vsp1_iif.c -- R-Car VSP1 IIF (ISP Interface) + * + * Copyright (C) 2025 Ideas On Board Oy + * Copyright (C) 2025 Renesas Corporation + */ + +#include "vsp1.h" +#include "vsp1_brx.h" +#include "vsp1_dl.h" +#include "vsp1_iif.h" + +#define IIF_MIN_WIDTH 128U +#define IIF_MIN_HEIGHT 32U +#define IIF_MAX_WIDTH 5120U +#define IIF_MAX_HEIGHT 4096U + +/* ----------------------------------------------------------------------------- + * Device Access + */ + +static inline void vsp1_iif_write(struct vsp1_iif *iif, + struct vsp1_dl_body *dlb, u32 reg, u32 data) +{ + vsp1_dl_body_write(dlb, iif->base + reg, data); +} + +/* ----------------------------------------------------------------------------- + * V4L2 Subdevice Operations + */ + +static const unsigned int iif_codes[] = { + MEDIA_BUS_FMT_SRGGB8_1X8, + MEDIA_BUS_FMT_SGRBG8_1X8, + MEDIA_BUS_FMT_SGBRG8_1X8, + MEDIA_BUS_FMT_SBGGR8_1X8, + MEDIA_BUS_FMT_SRGGB10_1X10, + MEDIA_BUS_FMT_SGRBG10_1X10, + MEDIA_BUS_FMT_SGBRG10_1X10, + MEDIA_BUS_FMT_SBGGR10_1X10, + MEDIA_BUS_FMT_SRGGB12_1X12, + MEDIA_BUS_FMT_SGRBG12_1X12, + MEDIA_BUS_FMT_SGBRG12_1X12, + MEDIA_BUS_FMT_SBGGR12_1X12, + MEDIA_BUS_FMT_SRGGB16_1X16, + MEDIA_BUS_FMT_SGRBG16_1X16, + MEDIA_BUS_FMT_SGBRG16_1X16, + MEDIA_BUS_FMT_SBGGR16_1X16, + MEDIA_BUS_FMT_METADATA_FIXED +}; + +static int iif_enum_mbus_code(struct v4l2_subdev *subdev, + struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_mbus_code_enum *code) +{ + return vsp1_subdev_enum_mbus_code(subdev, sd_state, code, iif_codes, + ARRAY_SIZE(iif_codes)); +} + +static int iif_enum_frame_size(struct v4l2_subdev *subdev, + struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_frame_size_enum *fse) +{ + return vsp1_subdev_enum_frame_size(subdev, sd_state, fse, + IIF_MIN_WIDTH, IIF_MIN_HEIGHT, + IIF_MAX_WIDTH, IIF_MAX_HEIGHT); +} + +static int iif_set_format(struct v4l2_subdev *subdev, + struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_format *fmt) +{ + return vsp1_subdev_set_pad_format(subdev, sd_state, fmt, iif_codes, + ARRAY_SIZE(iif_codes), + IIF_MIN_WIDTH, IIF_MIN_HEIGHT, + IIF_MAX_WIDTH, IIF_MAX_HEIGHT); +} + +static const struct v4l2_subdev_pad_ops iif_pad_ops = { + .enum_mbus_code = iif_enum_mbus_code, + .enum_frame_size = iif_enum_frame_size, + .get_fmt = vsp1_subdev_get_pad_format, + .set_fmt = iif_set_format, +}; + +static const struct v4l2_subdev_ops iif_ops = { + .pad = &iif_pad_ops, +}; + +/* ----------------------------------------------------------------------------- + * VSP1 Entity Operations + */ + +static void iif_configure_stream(struct vsp1_entity *entity, + struct v4l2_subdev_state *state, + struct vsp1_pipeline *pipe, + struct vsp1_dl_list *dl, + struct vsp1_dl_body *dlb) +{ + struct vsp1_iif *iif = to_iif(&entity->subdev); + + vsp1_iif_write(iif, dlb, VI6_IIF_CTRL, VI6_IIF_CTRL_CTRL); +} + +static const struct vsp1_entity_operations iif_entity_ops = { + .configure_stream = iif_configure_stream, +}; + +/* ----------------------------------------------------------------------------- + * Initialization and Cleanup + */ + +struct vsp1_iif *vsp1_iif_create(struct vsp1_device *vsp1) +{ + struct vsp1_iif *iif; + int ret; + + iif = devm_kzalloc(vsp1->dev, sizeof(*iif), GFP_KERNEL); + if (iif == NULL) + return ERR_PTR(-ENOMEM); + + /* IIF is a specialized BRU instance, uses the same register base. */ + iif->base = VI6_BRU_BASE; + iif->entity.ops = &iif_entity_ops; + iif->entity.type = VSP1_ENTITY_IIF; + + ret = vsp1_entity_init(vsp1, &iif->entity, "iif", 3, &iif_ops, + MEDIA_ENT_F_PROC_VIDEO_COMPOSER); + if (ret < 0) + return ERR_PTR(ret); + + return iif; +} diff --git a/drivers/media/platform/renesas/vsp1/vsp1_iif.h b/drivers/media/platform/renesas/vsp1/vsp1_iif.h new file mode 100644 index 0000000000000000000000000000000000000000..2ec3b1e3aeaca943dab870ca997ff1a582ef8117 --- /dev/null +++ b/drivers/media/platform/renesas/vsp1/vsp1_iif.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * vsp1_iif.h -- R-Car VSP1 IIF (ISP Interface) + * + * Copyright (C) 2025 Ideas On Board Oy + * Copyright (C) 2025 Renesas Corporation + */ +#ifndef __VSP1_IIF_H__ +#define __VSP1_IIF_H__ + +#include +#include +#include + +#include "vsp1_entity.h" + +#define IIF_PAD_SINK 0 + +struct vsp1_iif { + struct vsp1_entity entity; + unsigned int base; +}; + +static inline struct vsp1_iif *to_iif(struct v4l2_subdev *subdev) +{ + return container_of(subdev, struct vsp1_iif, entity.subdev); +} + +struct vsp1_iif *vsp1_iif_create(struct vsp1_device *vsp1); + +#endif /* __VSP1_IIF_H__ */ diff --git a/drivers/media/platform/renesas/vsp1/vsp1_pipe.c b/drivers/media/platform/renesas/vsp1/vsp1_pipe.c index bb0739f684f39e23326a4d8fdb9f43e020bc23c8..8e9be3ec1b4dbdad1cbe35ae3a88952f46e41343 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_pipe.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_pipe.c @@ -286,6 +286,7 @@ void vsp1_pipeline_reset(struct vsp1_pipeline *pipe) pipe->brx = NULL; pipe->hgo = NULL; pipe->hgt = NULL; + pipe->iif = NULL; pipe->lif = NULL; pipe->uds = NULL; } diff --git a/drivers/media/platform/renesas/vsp1/vsp1_pipe.h b/drivers/media/platform/renesas/vsp1/vsp1_pipe.h index 1ba7bdbad5a845da0a4d71888e193e46d62bed90..1655a820da102003d3d7da82a7cdd64e01c29ac6 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_pipe.h +++ b/drivers/media/platform/renesas/vsp1/vsp1_pipe.h @@ -119,6 +119,7 @@ struct vsp1_pipeline { struct vsp1_entity *brx; struct vsp1_entity *hgo; struct vsp1_entity *hgt; + struct vsp1_entity *iif; struct vsp1_entity *lif; struct vsp1_entity *uds; struct vsp1_entity *uds_input; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_regs.h b/drivers/media/platform/renesas/vsp1/vsp1_regs.h index 7eca82e0ba7ec5e02a5f3b9a30ccdcb48db39ed2..5d655785db85fe7cc7d7774fac168ca98891a0f5 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_regs.h +++ b/drivers/media/platform/renesas/vsp1/vsp1_regs.h @@ -252,6 +252,12 @@ #define VI6_RPF_BRDITH_CTRL_ODE BIT(8) #define VI6_RPF_BRDITH_CTRL_CBRM BIT(0) +/* ----------------------------------------------------------------------------- + * IIF Control Registers + */ +#define VI6_IIF_CTRL 0x0608 +#define VI6_IIF_CTRL_CTRL 0x13 + /* ----------------------------------------------------------------------------- * WPF Control Registers */ @@ -388,6 +394,7 @@ #define VI6_DPR_HST_ROUTE 0x2044 #define VI6_DPR_HSI_ROUTE 0x2048 #define VI6_DPR_BRU_ROUTE 0x204c +#define VI6_DPR_BRU_ROUTE_IIFSEL BIT(28) #define VI6_DPR_ILV_BRS_ROUTE 0x2050 #define VI6_DPR_ROUTE_BRSSEL BIT(28) #define VI6_DPR_ROUTE_FXA_MASK (0xff << 16) From patchwork Thu Jan 23 17:04:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13948495 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 B09A6149C4F; Thu, 23 Jan 2025 17:04:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651885; cv=none; b=pe9LVsbkkapY5xGjkXIOmkhSHXbTpgi11l15vS6oKmYla+8d3cehqk8rgfIsNVXWGSfl/ByObH4RoANNzm9ierTwlPPEOLT8HUeyBiBH2CdK0vVOcuc+9iOVFEcu60hqQKJ28qAK0YLFexI1gHlRUKQ7EULcJBmSJb67eQJJ3Xw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651885; c=relaxed/simple; bh=jZKh6B50TkxYhqw5Z/u4Kx/iYsZDEdgdZdK+m9No1oQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hSLt7h3exZjohWPammTCp5xa8VkqnN1AJ9FmdyXUXBnkllR9lBjE1XnPAiyyn9oWdt+1393tSUx8IY8WTg22Gw3Emk2MxgWXhrtqXzf3ieCqqkzT87wR3P49IX1LVVocYOggWngZXZVS+g2rlBSGREJ6BOJ9mpA3xu8MyJYY0yU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=KqafMyie; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="KqafMyie" Received: from [192.168.1.103] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 47987F91; Thu, 23 Jan 2025 18:03:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737651815; bh=jZKh6B50TkxYhqw5Z/u4Kx/iYsZDEdgdZdK+m9No1oQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KqafMyierUSxBYuquZlhJp3/oCv/uceCiANubf16HjRUgQzPXtwJLACnxGMQ9xBsa oF0vNDczxfDDue9n0rq9iOfe45Ptgjy455ZyZ0B2PGLWdqWDDC3Nmyx7jg8xW8n7CM NHeD5kXlt+xxe5s27AYVwY3mjyoha4wI6YvGO0T8= From: Jacopo Mondi Date: Thu, 23 Jan 2025 18:04:03 +0100 Subject: [PATCH 2/6] media: vsp1: Enable FREE interrupt Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250123-v4h-iif-v1-2-7b4e5299939f@ideasonboard.com> References: <20250123-v4h-iif-v1-0-7b4e5299939f@ideasonboard.com> In-Reply-To: <20250123-v4h-iif-v1-0-7b4e5299939f@ideasonboard.com> To: Laurent Pinchart , Kieran Bingham , Mauro Carvalho Chehab , =?utf-8?q?Niklas_S=C3=B6derlun?= =?utf-8?q?d?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Jacopo Mondi X-Mailer: b4 0.15-dev-1b0d6 X-Developer-Signature: v=1; a=openpgp-sha256; l=2322; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=jZKh6B50TkxYhqw5Z/u4Kx/iYsZDEdgdZdK+m9No1oQ=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBnknak30BWwhfg/hI20CXlvjFY4Mrb5w8g0tsze H5V1o3Z61iJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ5J2pAAKCRByNAaPFqFW PBzED/oCL+N/G0usGoJehLc1EUWjQ45EcJ9G2ZS4RCDaWP7u+1iGIUN0lm21FWR59vCcm+dL7p2 aRSzIS81dOIQS58b3zO1s1y/zjmZ9cVuYA9Y3+6Pg4EuF/6qhnVmyXyA8qrjWddf571KYi1zAsy 0BfzyYn1FW4qwYYOWucq4NrF9rQyO0janmvECooJZBFsOlmCYLSgM23BlZXOaZYAIVJ1h+mOW7G EkOKSTIxNLlHkYGku7cC7C+jAAQVygfds2EBrlFgfxaTogqGckGbPQDn12E4A686zbrptx7J42F IAYJiWdUYfQQXLaZma91jS+SZMS7yCi+CKRjRWIFJEdfFuzK7jkP6TKULcIBJoVmkWzxLh6N00H WlF8oggPUQXsCiMxboaLd7dHpd7g6Hvz4UvrtD4MUIpLuNJJRUIAkFMeua9oU7FVE3JPLF26YdT xetrNNBL28yML4C2i2P6ccWiEkFX8ta96tIbNq4Hibyn21J3TBNvcilU/ToGZz46Lqb0OUBHVKH roarLKoTyoMzXUQtjtdLZEw6dpF0qXd0uWEtZvQElj6jl1EvleLPM3K/HGlYoxvC2rWNVkxcpi1 23RDzCpHbt9klyukhsLsAdKcbAUtp0T/euytSkHlZf16i4NO+gQCYu1VocGh+O5dmk0iJ4M2Pxp /brcNU+u3jm/q1Q== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B Enable the "FrameEnd" interrupt to support the VSPX operations. The frame completion interrupt signals that the transfer of the config buffer and image buffer to the ISP has completed. Enable the interrupt source if the pipe has an IIF entity, such as in the VSPX case. Signed-off-by: Jacopo Mondi --- drivers/media/platform/renesas/vsp1/vsp1_drv.c | 3 ++- drivers/media/platform/renesas/vsp1/vsp1_wpf.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drv.c b/drivers/media/platform/renesas/vsp1/vsp1_drv.c index cbaad0ea0b73f90f3994bbdfb4304d2f71eabccd..5aa0751a896f8a58bd11128ccaa092c9596cdb5d 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_drv.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_drv.c @@ -69,7 +69,8 @@ static irqreturn_t vsp1_irq_handler(int irq, void *data) i, wpf->entity.pipe->underrun_count); } - if (status & VI6_WPF_IRQ_STA_DFE) { + if (status & VI6_WPF_IRQ_STA_DFE || + status & VI6_WPF_IRQ_STA_FRE) { vsp1_pipeline_frame_end(wpf->entity.pipe); ret = IRQ_HANDLED; } diff --git a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c index f176750ccd9847fdb8d51f7f51a6bd5092b70197..93a663f58a5930a3c7c40a96a30888d0b8ccb2ed 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c @@ -239,6 +239,7 @@ static void wpf_configure_stream(struct vsp1_entity *entity, const struct v4l2_mbus_framefmt *source_format; const struct v4l2_mbus_framefmt *sink_format; unsigned int index = wpf->entity.index; + u32 irqmask = 0; unsigned int i; u32 outfmt = 0; u32 srcrpf = 0; @@ -312,9 +313,9 @@ static void wpf_configure_stream(struct vsp1_entity *entity, vsp1_wpf_write(wpf, dlb, VI6_WPF_SRCRPF, srcrpf); /* Enable interrupts. */ + irqmask = VI6_WPF_IRQ_ENB_DFEE | (pipe->iif ? VI6_WPF_IRQ_ENB_FREE : 0); vsp1_dl_body_write(dlb, VI6_WPF_IRQ_STA(index), 0); - vsp1_dl_body_write(dlb, VI6_WPF_IRQ_ENB(index), - VI6_WPF_IRQ_ENB_DFEE); + vsp1_dl_body_write(dlb, VI6_WPF_IRQ_ENB(index), irqmask); /* * Configure writeback for display pipelines (the wpf writeback flag is From patchwork Thu Jan 23 17:04:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13948496 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 CB10214AD38; Thu, 23 Jan 2025 17:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651886; cv=none; b=f/F7aepaxXcUPUpsupAM5dH+ZxupVcPtF0IGEy67QbpgqwAvuME2vpWuqMtSZ/SCP0D5mTEp8150esm7Y3fCQiX4nU/dvRXGNptoKwtKYsr2LuiE9+/wuZdbiOUWhLvuDBrEDK9i4j7e11f18ue9FT3CaQBxN1JWuhZcEJ0T20I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651886; c=relaxed/simple; bh=Ofhcffi96xVaiPanXXo+FgUHdIeQ2P6FlYUylPJ67I4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ntcpLIwyj6VhBIN10Dv5YeBQxcYBJaQIMQZbgZMjtWn1HjAu85TUS8QZG2fQ3gqGtOSUg8D/mTBL7zFG5Dwi8EGQsMbA2amz1rKMT/j0qCQPqDpFsDbWZZ/G0zOIneK4YzLlJF9NrSzdyk+MKZIfSoGn2rypQO3E9yfzFmcauWs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=s/4EnnDW; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="s/4EnnDW" Received: from [192.168.1.103] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CFD04134C; Thu, 23 Jan 2025 18:03:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737651816; bh=Ofhcffi96xVaiPanXXo+FgUHdIeQ2P6FlYUylPJ67I4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=s/4EnnDWNac7iU3BqsW7S/RAE8Bccl+7Tfgh9qw52HVaR/plONW/aWirNuf5y0paJ rG5usoNlnSqPBuRASjHllMO/BYHqBOuWdlDcOGUT8ft8Rf7bXlfbuAfS9pODjSL4CG ZYTXQQ/1/zo+N2JAISagP13l9M7cVv5J+ksLUkHo= From: Jacopo Mondi Date: Thu, 23 Jan 2025 18:04:04 +0100 Subject: [PATCH 3/6] media: vsp1: dl: Use singleshot DL for VSPX Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250123-v4h-iif-v1-3-7b4e5299939f@ideasonboard.com> References: <20250123-v4h-iif-v1-0-7b4e5299939f@ideasonboard.com> In-Reply-To: <20250123-v4h-iif-v1-0-7b4e5299939f@ideasonboard.com> To: Laurent Pinchart , Kieran Bingham , Mauro Carvalho Chehab , =?utf-8?q?Niklas_S=C3=B6derlun?= =?utf-8?q?d?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Jacopo Mondi X-Mailer: b4 0.15-dev-1b0d6 X-Developer-Signature: v=1; a=openpgp-sha256; l=1681; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=Ofhcffi96xVaiPanXXo+FgUHdIeQ2P6FlYUylPJ67I4=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBnknak3zh1vYQ6DaayWjRYUlThLrTlinxHiI20C G7dL2mvNZqJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ5J2pAAKCRByNAaPFqFW PKYoD/9tHsCtVRFF3O9klLSPQVWZG9P8lqsdSH8PiFyIUql3KmLV+ELcew+0LXgE7SPHfluUR+C +KRXqR+tUduVjRIdER9xBmf6kqnipiLjjUCSBq/C55ebsOhmWPyYRTeUU5JoNYDYRxLxDi3kUcR IwK8vO+sgI+4PAX5gExKocJD+FSwSjQUlPEp/pv3his0HIAtNd+SuMawtIJt6cEY3ZbZoVVgi2R E/TvFQh2/BzZKpJ+L3owNFu4CwroswNuYemlROqVDq/g4bJItdnZCuDQP9gano38m3XfNhTUh2l rOyWrDFJUuxhRdpHdL1hbuSAuuhhPPEmwZnAtNmSJOxCby8GRyMcdGxBJsljSwdT4alt5CKmWQN G74iRKAnDelkC0wauUZ0V26YhO4/jmDcxcHyCoDsw/KxC44BEu6b1fZCuWdZiRlFowY88QwnYqQ Du2OUY1A0kyhFCpZER+rTO4qogP65tv3aTfvgq+uNPyTpp9hETgr9s9a5bkjAfMHM138YCF34dM kFHYT/gTRSGP/cwJp/jjwrpiwJsHZkuW94kxy3fqv6H9nTSXsAl6T1LpaqljQErutOswkGubJwF hxasEjWN7a3LX2dysiDrk8viFAygAhusv9k2iH9QBA5EnvM4Ux1tYUnJtm/hkd2UIX17vXl9fy0 BqjX945HPj+Yz8A== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The vsp1_dl library allows to program a display list and feed it continuously to the VSP2. As an alternative operation mode, the library allows to program the VSP2 in 'single shot' mode, where a display list is submitted to the VSP on request only. Currently the 'single shot' mode is only available when the VSP2 is controlled by userspace, while it works in continuous mode when driven by DRM, as frames have to be submitted to the display continuously. For the VSPX use case, where there is no uapi support, we should however work in single-shot mode as the ISP driver programs the VSPX on request. Initialize the display lists in single shot mode in case the VSP1 is controlled by userspace or in case the pipeline features an IIF entity, as in the VSPX case. Signed-off-by: Jacopo Mondi --- drivers/media/platform/renesas/vsp1/vsp1_dl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_dl.c b/drivers/media/platform/renesas/vsp1/vsp1_dl.c index ad3fa1c9cc737c92870c087dd7cb8cf584fce41b..b8f0398522257f2fb771b419f34b56e59707476b 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_dl.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_dl.c @@ -1099,7 +1099,12 @@ struct vsp1_dl_manager *vsp1_dlm_create(struct vsp1_device *vsp1, return NULL; dlm->index = index; - dlm->singleshot = vsp1->info->uapi; + /* + * uapi = single shot mode; + * DRM = continuous mode; + * VSPX = single shot mode; + */ + dlm->singleshot = (vsp1->info->uapi || vsp1->iif); dlm->vsp1 = vsp1; spin_lock_init(&dlm->lock); From patchwork Thu Jan 23 17:04:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13948498 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 48BEB15A843; Thu, 23 Jan 2025 17:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651890; cv=none; b=u2OnhC2WsiKcr54Vp9fXu9RiaO1kuLCD/jQZ5pwNFJT87UieXUqF04MVtiaWasHM2SNlmAX+RjoJpo8BWi87q/Ww5DlOHnbFbLJZy7aC3VCkjRV4Egmlvl3lEIdRdazBk8PRfosd2rsqSAddDWlv4bfW09jJtmtGZEuyvYIi3IQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651890; c=relaxed/simple; bh=HN8kF88g6U5ekkg7MbQ55RqNYqDf07+TYAAH59fiKLY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VjGkzqt6cbIrlvVpeqQVpTocmbykHahx0RbP2NUqhOEEJXMw3eWPmR6zsSVORueFnR5wRHIVu4JUGNfbg/BGSS9VKEcRvEs4S1HTOcKUQsOL/t5Lbnw0teDdnXCGKIBVxjfevJAgy/1IhtNC2anOu8c/PsxkzmvsLiM6E1ArqjQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Hc5AYXIY; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Hc5AYXIY" Received: from [192.168.1.103] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 659C41990; Thu, 23 Jan 2025 18:03:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737651816; bh=HN8kF88g6U5ekkg7MbQ55RqNYqDf07+TYAAH59fiKLY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Hc5AYXIYZYjfyOA0ho4PnlJemr1MyWcKr/k9SbP8EAzd05OmaTGPu+gBdRpTAxpDL uqt8HWM4JcFeO0r+XQY4bbrTd9ffHS8lEqAR9qzcp1i0o8ewjVvUdUsoI/SejXMhco NN8X51ig3AMMDYJEDErnGx+EVXoXjnd9Cu24pMvs= From: Jacopo Mondi Date: Thu, 23 Jan 2025 18:04:05 +0100 Subject: [PATCH 4/6] media: vsp1: rwpf: Break out format handling Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250123-v4h-iif-v1-4-7b4e5299939f@ideasonboard.com> References: <20250123-v4h-iif-v1-0-7b4e5299939f@ideasonboard.com> In-Reply-To: <20250123-v4h-iif-v1-0-7b4e5299939f@ideasonboard.com> To: Laurent Pinchart , Kieran Bingham , Mauro Carvalho Chehab , =?utf-8?q?Niklas_S=C3=B6derlun?= =?utf-8?q?d?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Jacopo Mondi X-Mailer: b4 0.15-dev-1b0d6 X-Developer-Signature: v=1; a=openpgp-sha256; l=2732; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=HN8kF88g6U5ekkg7MbQ55RqNYqDf07+TYAAH59fiKLY=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBnknakjSWLVp6xXuXoX1mNgUB1r+4Uv8KI2TKVW Hedg83Ur+6JAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ5J2pAAKCRByNAaPFqFW PA21D/sGRlHkE+QF6tEekkrO64wovTEP1GpXKYIJyAZ+m2na9VFIbyS4YtRvi2wckXp6V9gRihu zP+/dpTHOefg3hDS+ZBvKcDQKovOCfre/vodV6IxRpwlF/weO3lBbziNjo/aSI15KPr51YQIYjj qIqIYmBuFZtaKpUtQd6RDKR+uWmm9T0DugDVhgXU+OMOzqNvDazAsAvdnfwGYOCCWGtShixUg7A ns0PfFIEAqDWjyHVb0E/JrT0hjPo7QNIotPy/YToKM5aixOdfQxoBfXs73Ejsh8VbixFEdlKNan xY7WI4M8HGUnTq5s7ECTZjNZQ4LEjqtTP9RHbotnrKTHLHWb8+3BtNn0UKkkJ84ETsl4p+uh2qF wJ9EoCSOuVQS3vuCacNbampRAVAloa5PTFpb5h8oR4eOeuD2c45XyausaYy43mnQU1RpfGt+kx8 gQ94M7yU5U8C/h1oOZskqhyAf1wSuNyGWCkOh4EawLvswIFo0qtrV2k7JN2CapSd3ZufoKadbcP D53qp0ZtMWUp9aAUt0GDO3Nwy/H+FHC51iVDmyinbcfQckAlKEnrYsOwBVpthNX/heQYxkQEvXb asy3nU9sFJUY2xwyy7OoTAP+iS3A0lZ0T5rHuyE8L6cKEy+Pzc7JKrJYvqjxxeZKoKgytRRxbSW 0d5Py83fISfvk0g== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The current implementation of the r/wpf format handling assumes three formats to be supported in the RGB/YUV space. With the forthcoming support for VSPX the r/wpf units will be used to fetch from exteranal memory images in RAW Bayer format and buffers of ISP configuration parameters. Prepare for adding support for these new formats by breaking out the list of supported media bus codes in the vsp1_rwpf.c file. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- drivers/media/platform/renesas/vsp1/vsp1_rwpf.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c index 9d38203e73d00b82a1a7db0353e2f0b5a94084f6..93b0ed5fd0da0c6a182dbbfe1e54eb8cfd66c493 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c @@ -16,6 +16,12 @@ #define RWPF_MIN_WIDTH 1 #define RWPF_MIN_HEIGHT 1 +static const u32 rwpf_mbus_codes[] = { + MEDIA_BUS_FMT_ARGB8888_1X32, + MEDIA_BUS_FMT_AHSV8888_1X32, + MEDIA_BUS_FMT_AYUV8_1X32, +}; + /* ----------------------------------------------------------------------------- * V4L2 Subdevice Operations */ @@ -24,16 +30,10 @@ static int vsp1_rwpf_enum_mbus_code(struct v4l2_subdev *subdev, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_mbus_code_enum *code) { - static const unsigned int codes[] = { - MEDIA_BUS_FMT_ARGB8888_1X32, - MEDIA_BUS_FMT_AHSV8888_1X32, - MEDIA_BUS_FMT_AYUV8_1X32, - }; - - if (code->index >= ARRAY_SIZE(codes)) + if (code->index >= ARRAY_SIZE(rwpf_mbus_codes)) return -EINVAL; - code->code = codes[code->index]; + code->code = rwpf_mbus_codes[code->index]; return 0; } @@ -57,6 +57,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, struct vsp1_rwpf *rwpf = to_rwpf(subdev); struct v4l2_subdev_state *state; struct v4l2_mbus_framefmt *format; + unsigned int i; int ret = 0; mutex_lock(&rwpf->entity.lock); @@ -68,9 +69,11 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, } /* Default to YUV if the requested format is not supported. */ - if (fmt->format.code != MEDIA_BUS_FMT_ARGB8888_1X32 && - fmt->format.code != MEDIA_BUS_FMT_AHSV8888_1X32 && - fmt->format.code != MEDIA_BUS_FMT_AYUV8_1X32) + for (i = 0; i < ARRAY_SIZE(rwpf_mbus_codes); ++i) { + if (fmt->format.code == rwpf_mbus_codes[i]) + break; + } + if (i == ARRAY_SIZE(rwpf_mbus_codes)) fmt->format.code = MEDIA_BUS_FMT_AYUV8_1X32; format = v4l2_subdev_state_get_format(state, fmt->pad); From patchwork Thu Jan 23 17:04:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13948497 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 1FDA016F265; Thu, 23 Jan 2025 17:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651889; cv=none; b=uH2dHqdc88qTSD1kJZ+ZEuJ35TeMeZ5a0eNjtJyTPJf4VuKQDn6SbDzVJ40ZbYCTUiYP0xobbIBEI0tlnDNTLafo2C8UvCVIHvP6juXlomfH8jjhIGW2gfrJRHUUA3ICNUKpklqh88JjhKcy+fydcd2cKP9ks772L0ftevTt3N0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651889; c=relaxed/simple; bh=7LBi/BT+KVm+GtmM7OTDrnVrADDfpecaRpYCzrH1Cb4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MsSsDagUY12JBI90CO4OLXQ7K+J7HM0Ej+6RlzLkDggTNv09ZVasD1UJfrp84Th5FLX+es44ddTgxS+lvdMr5747qn0AtEZ7HLLKeuj0HNnrvVqLFDE586I/hCNv2gR9KG+Mtn/j5jETC5+wy9quud6u6LPio3U1+z62ZjcqNQU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=ORgy6gos; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ORgy6gos" Received: from [192.168.1.103] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EF0FC19AE; Thu, 23 Jan 2025 18:03:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737651817; bh=7LBi/BT+KVm+GtmM7OTDrnVrADDfpecaRpYCzrH1Cb4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ORgy6gosWkqs9vKSa8oizks3NyPYQ2JTkuN4JqaWN79HSNbv3z/JeA0+BRJ22WAY7 9a5AEPieGZcn5WwxGhfW7IPe7oW9vTgLDIcioEt9ldhbAJG8h//A1sNUEtokPR6ZWt Ln2XThqwT2hNccAVtYrroKnnF9kQOLmcq0xpCUe4= From: Jacopo Mondi Date: Thu, 23 Jan 2025 18:04:06 +0100 Subject: [PATCH 5/6] media: vsp1: rwpf: Support RAW Bayer and ISP config Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250123-v4h-iif-v1-5-7b4e5299939f@ideasonboard.com> References: <20250123-v4h-iif-v1-0-7b4e5299939f@ideasonboard.com> In-Reply-To: <20250123-v4h-iif-v1-0-7b4e5299939f@ideasonboard.com> To: Laurent Pinchart , Kieran Bingham , Mauro Carvalho Chehab , =?utf-8?q?Niklas_S=C3=B6derlun?= =?utf-8?q?d?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Jacopo Mondi X-Mailer: b4 0.15-dev-1b0d6 X-Developer-Signature: v=1; a=openpgp-sha256; l=1573; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=7LBi/BT+KVm+GtmM7OTDrnVrADDfpecaRpYCzrH1Cb4=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBnknalgZ/r23/85CNVGvxizArF3a83Mf10ipBn4 xrk0sBPhE+JAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ5J2pQAKCRByNAaPFqFW PC2JD/9dXHHGELSh1NLcCjZhBYMkfQEFKMn+TQ5p2u1BbHPjFrxjnbfB+wB97DPco8fHESUEmuI fsJWinQn5SyKyb/+e7ktL07IBojXz/oq8XHohsW1L1MHnBBDsVhcz4fuX7lwUgsccFk/eSqHDbO cvMFEUmQtMPFrr3WFTKmbEccrsDdANsEMAL0v7ujc4E2QTVggQ6czQuwqtCO3mdhI869s8EZ8Hx Z0L6w/hpdiypwmTsCFnB0+nY6xNTusaYWCBZcws8Ah0vGIp6iqgmaoy6JH+AZGaAMnCEIeAsEJG GeQVDcZbu6GZXOr3c0fdmn1lL3VIT2ekx+q/IlWgwL6BDLKIj7aX0JEQ+GeAx6wOaH2GHKaUTVL Uc8pCh5Q1TRUEJzMFWKsL9Tuhw4WOJ5HEP+/Htkk4VzcjZ0k/NND8Z5yvPM9TE9L9Thlejf2RVT Yy+ycbV2cB0Noxmd3aiyFJ3VtJFX9UkomfpGvIYm8OaFI5X5Ea37d9B9n7xZSebZWldnXLg6YhE UOBCrVPU5/spq0op2BPHPp4NS0oNRFb+C5pc8VH4Tjqmw18qfx+Y6bWz1Djz1nRjIL3N7DSd2+k gBhrfyxhJr1idVEGMfYn5u14l9nByEdvTPberEwN2lYkvKODBpDz+cHKZXy5WhJyM8wsFMdY0g5 I3hNmWGk1XRfKwA== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B With the forthcoming support for VSPX the r/wpf unit will be used to perform memory access on the behalf of the ISP units. Prepare to support reading from external memory images in RAW Bayer format and ISP configuration parameters by expanding the list of supported media bus codes. Signed-off-by: Jacopo Mondi --- drivers/media/platform/renesas/vsp1/vsp1_rwpf.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c index 93b0ed5fd0da0c6a182dbbfe1e54eb8cfd66c493..75dde92ec35585825eb70c0faa31ff4cb1d4a3d4 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_rwpf.c @@ -20,6 +20,23 @@ static const u32 rwpf_mbus_codes[] = { MEDIA_BUS_FMT_ARGB8888_1X32, MEDIA_BUS_FMT_AHSV8888_1X32, MEDIA_BUS_FMT_AYUV8_1X32, + MEDIA_BUS_FMT_SRGGB8_1X8, + MEDIA_BUS_FMT_SGRBG8_1X8, + MEDIA_BUS_FMT_SGBRG8_1X8, + MEDIA_BUS_FMT_SBGGR8_1X8, + MEDIA_BUS_FMT_SRGGB10_1X10, + MEDIA_BUS_FMT_SGRBG10_1X10, + MEDIA_BUS_FMT_SGBRG10_1X10, + MEDIA_BUS_FMT_SBGGR10_1X10, + MEDIA_BUS_FMT_SRGGB12_1X12, + MEDIA_BUS_FMT_SGRBG12_1X12, + MEDIA_BUS_FMT_SGBRG12_1X12, + MEDIA_BUS_FMT_SBGGR12_1X12, + MEDIA_BUS_FMT_SRGGB16_1X16, + MEDIA_BUS_FMT_SGRBG16_1X16, + MEDIA_BUS_FMT_SGBRG16_1X16, + MEDIA_BUS_FMT_SBGGR16_1X16, + MEDIA_BUS_FMT_METADATA_FIXED }; /* ----------------------------------------------------------------------------- From patchwork Thu Jan 23 17:04:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13948499 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 7676221325E; Thu, 23 Jan 2025 17:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651893; cv=none; b=TiqeE4uQyitghtZO0R60BzGXefBMuka1467FVkvzMQDD/WzO2IToPIDi8QHjQmRE8TfQIZMkW6HzQWD2SdDTw7r2IGe5OHHRmjKYZPXCTuAbdE8ThTtRZ6mVTj1Myh3TVqdrGmqM92jbEhf7iETvyTyOWaZ+XouTxm/lm9+qX5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737651893; c=relaxed/simple; bh=6Rhq7m0mfOiA+XjVW/iGea+Z9wS3Y4XZxjZqtEyzltk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bMrRnXL6XZx/1UmYwH1iS+WBvTK4ESzyksI0/gRDdu8KVcvj5hH64XGM0cM32xtfJuc6WbI99BexcQI0uf5HaJLD9JqMvRUlc3w+GJvEJZoJeaMzIlxjKxokKMmjrzuaqP/TSPba6ej12FHOxqR2sH+xXScx/dA2VJuMcUY4wZo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=k1uKMqfB; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="k1uKMqfB" Received: from [192.168.1.103] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 88C251A89; Thu, 23 Jan 2025 18:03:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1737651817; bh=6Rhq7m0mfOiA+XjVW/iGea+Z9wS3Y4XZxjZqtEyzltk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=k1uKMqfBdJk2nnt4GKqVDywKE7J+wDs+Zyw4Nd8WET6sG6RDFxkSdPDsVL+B5kV8m 8EFZHqd+Ng6mqFALEXXtE4UEY3BNI5nMZzRoz/QpDAAhdnuwqLu0zBAMteJ5FvLbr5 yOs2lzJrHnGXJMJOBUNy/J0C3+iKdfZauLyyM6/M= From: Jacopo Mondi Date: Thu, 23 Jan 2025 18:04:07 +0100 Subject: [PATCH 6/6] media: vsp1: rwpf: Support operations with IIF Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250123-v4h-iif-v1-6-7b4e5299939f@ideasonboard.com> References: <20250123-v4h-iif-v1-0-7b4e5299939f@ideasonboard.com> In-Reply-To: <20250123-v4h-iif-v1-0-7b4e5299939f@ideasonboard.com> To: Laurent Pinchart , Kieran Bingham , Mauro Carvalho Chehab , =?utf-8?q?Niklas_S=C3=B6derlun?= =?utf-8?q?d?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Jacopo Mondi X-Mailer: b4 0.15-dev-1b0d6 X-Developer-Signature: v=1; a=openpgp-sha256; l=6705; i=jacopo.mondi+renesas@ideasonboard.com; h=from:subject:message-id; bh=6Rhq7m0mfOiA+XjVW/iGea+Z9wS3Y4XZxjZqtEyzltk=; b=owEBbQKS/ZANAwAIAXI0Bo8WoVY8AcsmYgBnknalUroA6hChXqG/NGKlBUKIrOrLeEF6QyE8N F42+XtTisiJAjMEAAEIAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCZ5J2pQAKCRByNAaPFqFW POzFD/40oe/xdZVYBI4iVj6jcOsmU/X94M9v7ofF/uYXj//nsFgaID9CXwpNhmbXZ68zsDtapnE Y+DjhnX7Y+L2NEQ7MXlHTp+4/RwC89xTlK8lX8qWiskgL6p/94w33MvcLO8uUf1C29jqTSIu6ld cVlyzYr+Q2wdUSNNVOjQiwDEh1vEanzf5xe16IOZMH22/uCA2CapRoZQVqHGgrX0ynV3Bv6fINF Wrvh7E2FgSRuj/EBRuoHithcrSvP33Ti+KpksGlK8HD2PCRjmVGjAQQerSI977BZwA3Md5qiMtc uYyNF9RRuLsG092cHXCLg/N2mW8yEtkJc0x1gG75DEyH7KSe5abZvbZZTWlqF99lZRLzoFFefKM EUcN85bt5uKMQVkvFC1iWoyqSj2kK5Jj/wJNefB167hcSVzuZu8Fg9oNLNxUfqXqXG/wdS+Gque eDD4xN7trXQq528cs1eALTO+EYLxqbmVoHybDcrh0eKFYfvfFaMKfdk04XoVMTi4C7b/RBBOylj eDvCM5NumSWXCOv7+wvwqNLXfK3K8cDFxjHTPIHW81Kx+xhg3fV7SbBjs8vn/1ygRXW9PsLP7v4 uKzHlTtYj9Q+eadU09JDHHH11HmoxdYvnfU/AwZen+udK/mJbY9u8JcUWQD7GFdyzJcj32XsSJp oW7jTShOfgiNi0g== X-Developer-Key: i=jacopo.mondi+renesas@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B When the RPF/WPF units are used for ISP interfacing through the IIF, the set of accessible registers is limited compared to the regular VSPD operations. Support ISP interfacing in the rpf and wpf drivers by checking if the pipe features an IIF instance and writing only the relevant registers. Signed-off-by: Jacopo Mondi --- drivers/media/platform/renesas/vsp1/vsp1_rpf.c | 66 +++++++++++++++----------- drivers/media/platform/renesas/vsp1/vsp1_wpf.c | 18 +++++-- 2 files changed, 53 insertions(+), 31 deletions(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c index 5c8b3ba1bd3c2c7b9289f05c9c2578e9717c23ff..e215491a3d962e2ae3c06b7835ca3b7654f04d10 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c @@ -60,6 +60,7 @@ static void rpf_configure_stream(struct vsp1_entity *entity, const struct v4l2_mbus_framefmt *sink_format; unsigned int left = 0; unsigned int top = 0; + u32 alpha_sel = 0; u32 pstride; u32 infmt; @@ -84,7 +85,7 @@ static void rpf_configure_stream(struct vsp1_entity *entity, sink_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SINK); source_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SOURCE); - infmt = VI6_RPF_INFMT_CIPM + infmt = (pipe->iif ? 0 : VI6_RPF_INFMT_CIPM) | (fmtinfo->hwfmt << VI6_RPF_INFMT_RDFMT_SHIFT); if (fmtinfo->swap_yc) @@ -98,7 +99,7 @@ static void rpf_configure_stream(struct vsp1_entity *entity, vsp1_rpf_write(rpf, dlb, VI6_RPF_INFMT, infmt); vsp1_rpf_write(rpf, dlb, VI6_RPF_DSWAP, fmtinfo->swap); - if (entity->vsp1->info->gen == 4) { + if (entity->vsp1->info->gen == 4 && !pipe->iif) { u32 ext_infmt0; u32 ext_infmt1; u32 ext_infmt2; @@ -150,23 +151,6 @@ static void rpf_configure_stream(struct vsp1_entity *entity, vsp1_rpf_write(rpf, dlb, VI6_RPF_EXT_INFMT2, ext_infmt2); } - /* Output location. */ - if (pipe->brx) { - const struct v4l2_rect *compose; - - compose = v4l2_subdev_state_get_compose(pipe->brx->state, - rpf->brx_input); - left = compose->left; - top = compose->top; - } - - if (pipe->interlaced) - top /= 2; - - vsp1_rpf_write(rpf, dlb, VI6_RPF_LOC, - (left << VI6_RPF_LOC_HCOORD_SHIFT) | - (top << VI6_RPF_LOC_VCOORD_SHIFT)); - /* * On Gen2 use the alpha channel (extended to 8 bits) when available or * a fixed alpha value set through the V4L2_CID_ALPHA_COMPONENT control @@ -188,11 +172,35 @@ static void rpf_configure_stream(struct vsp1_entity *entity, * contains an alpha channel. On Gen2 the global alpha is ignored in * that case. * - * In all cases, disable color keying. + * In all the above cases, disable color keying. + * + * VSPX wants alpha_sel to be set to 0. */ - vsp1_rpf_write(rpf, dlb, VI6_RPF_ALPH_SEL, VI6_RPF_ALPH_SEL_AEXT_EXT | - (fmtinfo->alpha ? VI6_RPF_ALPH_SEL_ASEL_PACKED - : VI6_RPF_ALPH_SEL_ASEL_FIXED)); + alpha_sel = pipe->iif ? 0 + : VI6_RPF_ALPH_SEL_AEXT_EXT + | (fmtinfo->alpha ? VI6_RPF_ALPH_SEL_ASEL_PACKED + : VI6_RPF_ALPH_SEL_ASEL_FIXED); + vsp1_rpf_write(rpf, dlb, VI6_RPF_ALPH_SEL, alpha_sel); + + if (pipe->iif) + return; + + /* Output location. */ + if (pipe->brx) { + const struct v4l2_rect *compose; + + compose = v4l2_subdev_state_get_compose(pipe->brx->state, + rpf->brx_input); + left = compose->left; + top = compose->top; + } + + if (pipe->interlaced) + top /= 2; + vsp1_rpf_write(rpf, dlb, VI6_RPF_LOC, + (left << VI6_RPF_LOC_HCOORD_SHIFT) | + (top << VI6_RPF_LOC_VCOORD_SHIFT)); + if (entity->vsp1->info->gen >= 3) { u32 mult; @@ -338,11 +346,15 @@ static void rpf_configure_partition(struct vsp1_entity *entity, */ if (pipe->interlaced) { vsp1_rpf_configure_autofld(rpf, dl); - } else { - vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_ADDR_Y, mem.addr[0]); - vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_ADDR_C0, mem.addr[1]); - vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_ADDR_C1, mem.addr[2]); + return; } + + vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_ADDR_Y, mem.addr[0]); + if (!mem.addr[1]) + return; + + vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_ADDR_C0, mem.addr[1]); + vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_ADDR_C1, mem.addr[2]); } static void rpf_partition(struct vsp1_entity *entity, diff --git a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c index 93a663f58a5930a3c7c40a96a30888d0b8ccb2ed..736f76389e07a7cc28ba098a0a0bdf350a0794f7 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c @@ -248,8 +248,11 @@ static void wpf_configure_stream(struct vsp1_entity *entity, sink_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SINK); source_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SOURCE); - /* Format */ - if (!pipe->lif || wpf->writeback) { + /* + * Format configuration. Skip for IIF (VSPX) or if the pipe doesn't have + * an active output. + */ + if (!pipe->iif && (!pipe->lif || wpf->writeback)) { const struct v4l2_pix_format_mplane *format = &wpf->format; const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; @@ -292,7 +295,7 @@ static void wpf_configure_stream(struct vsp1_entity *entity, * Sources. If the pipeline has a single input and BRx is not used, * configure it as the master layer. Otherwise configure all * inputs as sub-layers and select the virtual RPF as the master - * layer. + * layer. For VSPX configure the enabled sources as masters. */ for (i = 0; i < vsp1->info->rpf_count; ++i) { struct vsp1_rwpf *input = pipe->inputs[i]; @@ -300,7 +303,11 @@ static void wpf_configure_stream(struct vsp1_entity *entity, if (!input) continue; - srcrpf |= (!pipe->brx && pipe->num_inputs == 1) + /* For VSPX we enable and use RPF0 only for now. */ + if (pipe->iif && i > 0) + break; + + srcrpf |= (pipe->iif || (!pipe->brx && pipe->num_inputs == 1)) ? VI6_WPF_SRCRPF_RPF_ACT_MST(input->entity.index) : VI6_WPF_SRCRPF_RPF_ACT_SUB(input->entity.index); } @@ -317,6 +324,9 @@ static void wpf_configure_stream(struct vsp1_entity *entity, vsp1_dl_body_write(dlb, VI6_WPF_IRQ_STA(index), 0); vsp1_dl_body_write(dlb, VI6_WPF_IRQ_ENB(index), irqmask); + if (pipe->iif) + return; + /* * Configure writeback for display pipelines (the wpf writeback flag is * never set for memory-to-memory pipelines). Start by adding a chained