From patchwork Wed Jun 5 16:54:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 98990 Received: from ny.mirrors.kernel.org ([147.75.199.223]) by linuxtv.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sEtup-0004hV-0W for patchwork@linuxtv.org; Wed, 05 Jun 2024 16:55:14 +0000 Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 81E0E1C230A1 for ; Wed, 5 Jun 2024 16:55:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02B6F188CD6; Wed, 5 Jun 2024 16:55:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="AgCNIgcn" X-Original-To: linux-media@vger.kernel.org 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 8B918188CA8 for ; Wed, 5 Jun 2024 16:55:01 +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=1717606503; cv=none; b=oo+UAAnbugtt/MRoLUBnaKWyeh/Rw3+52jHWTCtnEX0pyAfiF7IzLcJzf/GIn/pOqh+Gxw+OFLbYF4tnbchE3zzAG9/ZKfzA/cJy8GjVpykF2t/VyWmoyKp2Dih9wlk6d4kJZDqvuqnVSNBjVF5K4zcus1dp4XzGPeUaqXCGpXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717606503; c=relaxed/simple; bh=HK62skjpVwxfWthHvTaDzWTrTAQushfJr6EdWX9UVaI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Cl3Yz+yPiP8LTbD+4ifJ29zpznjIzYBG3dVEKSqG/f38bEDkaxQvM2gdhlZ0eTOs34Bu+wngjw/ca6vMl8aBpN0R+H0T7zUAMpJZ4mlyoTakFqQYkDKUjMSwHQFVvBl1IdUppCrVjb9rNuIsj7kUwqQWrjROBP96v0Op+zfWDQ8= 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=AgCNIgcn; 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 Received: from localhost.localdomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F0F8410C4; Wed, 5 Jun 2024 18:54:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1717606488; bh=HK62skjpVwxfWthHvTaDzWTrTAQushfJr6EdWX9UVaI=; h=From:To:Cc:Subject:Date:From; b=AgCNIgcnVL/fyo4I5pESGdws4O562FThBzP6DBa6k8B9/3LZWMmgk0EAhwjCDoEL3 5u7Ccywa5u+KFtds5YywBj/8bcPCI9nMxW9J3Dp/1QRHT9PVSvpOzaq2Sxb2i4C/OM qVFUJ8Eph1baYXH3PGpBy/xfM5+4vX5KAVjJY0qo= From: Jacopo Mondi To: Linux Media Mailing List Cc: Jacopo Mondi , Laurent Pinchart , Sakari Ailus , Hans Verkuil , Stefan Klug , Paul Elder , Daniel Scally , Kieran Bingham , Umang Jain , Dafna Hirschfeld , Mauro Carvalho Chehab , Heiko Stuebner Subject: [PATCH 0/8] media: rkisp1: Implement support for extensible parameters Date: Wed, 5 Jun 2024 18:54:19 +0200 Message-ID: <20240605165434.432230-1-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-LSpam-Score: -2.6 (--) X-LSpam-Report: No, score=-2.6 required=5.0 tests=ARC_SIGNED=0.001,ARC_VALID=-0.1,BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DMARC_MISSING=0.001,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no The VeriSilicon ISP8000 IP, supported through the rkisp1 driver in the Linux kernel, is integrated in several SoCs from different vendors. Different revisions of the IP differ in the number of supported features and in the register space location assigned to specific ISP blocks. The current configuration parameters format, defined in include/uapi/linux/rkisp1-config.h is realized by a C structure (struct rkisp1_params_cfg) which wraps other structures that allows to configure specific ISP blocks. The layout of the parameters buffer is part of the Linux kernel uAPI and can hardly be extended or modified to adapt it to different revisions of the same IP. This series proposes the introduction of a new parameters format for the RkISP1 (without dropping support for the existing one) which is designed with the goals of being: 1) versioned: can be changed without breaking existing applications 2) extensible: new blocks and parameters can be added without breaking the uABI To do so, a new 'struct rkisp1_ext_params_cfg' type is introduced. It wraps an header and a data buffer, which userspace fills with configuration blocks for each ISP block it intends to configure. The parameters buffer is thus of different effective sizes, depending on the number of blocks userspace intends to configure. The kernel driver parses the data block and decides, based on the versioning number and the platform it operates on, how to handle each block. The parameters format is very similar to the parameters format implemented in the in-review Mali C55 ISP driver [1] I considered sending this out as RFC, but the implementation has been tested with a libcamera version ported to use the newly introduced format [1] and works as expected, so I considered it good enough to send a proper patch series A kernel branch for the interested ones is available at [3] with an associated CI pipeline [4] [1] https://lore.kernel.org/linux-media/20240529152858.183799-15-dan.scally@ideasonboard.com/ [2] https://gitlab.freedesktop.org/camera/libcamera/-/commits/imx8mp/extensible-format?ref_type=heads [3] https://gitlab.freedesktop.org/linux-media/users/jmondi/-/commits/imx8mp/media-state/extensible-format [4] https://gitlab.freedesktop.org/linux-media/users/jmondi/-/pipelines/1194073 Jacopo Mondi (8): uapi: rkisp1-config: Add extensible parameters format uapi: videodev2: Add V4L2_META_FMT_RK_ISP1_EXT_PARAMS media: rkisp1: Remove cached format info media: rkisp1: Add support for ext format media: rkisp1: Implement extensible params support media: rkisp1: Propagate pre/post-config errors media: rkisp1: Add struct rkisp1_params_buffer media: rkisp1: Copy and validate parameters buffer Documentation/admin-guide/media/rkisp1.rst | 11 +- .../media/v4l/metafmt-rkisp1.rst | 62 +- .../platform/rockchip/rkisp1/rkisp1-common.h | 29 +- .../platform/rockchip/rkisp1/rkisp1-isp.c | 14 +- .../platform/rockchip/rkisp1/rkisp1-params.c | 795 ++++++++++++++++-- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/rkisp1-config.h | 482 +++++++++++ include/uapi/linux/videodev2.h | 1 + 8 files changed, 1314 insertions(+), 81 deletions(-) base-commit: 1aea3d1d4a21e3e7895663b848ffae79ee82e065 --- 2.45.1