From patchwork Mon Nov 25 15:14:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22068 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 54203C32A3 for ; Mon, 25 Nov 2024 15:14:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 039DF65F76; Mon, 25 Nov 2024 16:14:40 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DNP4YCFv"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F07B365F5A for ; Mon, 25 Nov 2024 16:14:37 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:4cf:a935:de6f:a329]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 284296B5; Mon, 25 Nov 2024 16:14:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1732547656; bh=0Aa7FvXUGXvpviXw862Z2hJ2rHPTDooK68rBTSbgP5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DNP4YCFvLUP9+vBf28RCjH32n5emhktqKz9YWf3Pxy0CpsUqAzXsJd0lqXrdCrZy7 owrol7/7B2te+A+ACM0ZQscm/QpcJ/rXZ5CvCIsP5iI5hJC7BBSeYIMXxcIl9B7g8W 4OvqqVYN8isaM4QnLwJIpAvOzTbHYtZD+YrO7feo= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder , Jacopo Mondi Subject: [PATCH v2 1/8] libcamera: rkisp1: Fix scope of dewarper stop() exit action Date: Mon, 25 Nov 2024 16:14:10 +0100 Message-ID: <20241125151430.2437285-2-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> References: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Move the definition of the dewarper stop() action into the scope were the corresponding start() happens. Fixes: 12b553d691d4 ("libcamera: rkisp1: Plumb the dw100 dewarper as V4L2M2M converter") Signed-off-by: Stefan Klug Reviewed-by: Paul Elder Reviewed-by: Jacopo Mondi --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 6c6d711f91b3..5ffcfbce56be 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -1043,8 +1043,8 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL LOG(RkISP1, Error) << "Failed to start dewarper"; return ret; } + actions += [&]() { dewarper_->stop(); }; } - actions += [&]() { dewarper_->stop(); }; } if (data->mainPath_->isEnabled()) { From patchwork Mon Nov 25 15:14:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22069 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 3B9DEC32A3 for ; Mon, 25 Nov 2024 15:14:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E2ADA65FA9; Mon, 25 Nov 2024 16:14:42 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="fTQyFCDT"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7B9E265F66 for ; Mon, 25 Nov 2024 16:14:40 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:4cf:a935:de6f:a329]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8A3A26B5; Mon, 25 Nov 2024 16:14:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1732547658; bh=cgO8lxy+ffKobDxcO/AnCPxhEEU35ecVqeqPt8Withs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fTQyFCDT2gHCqTi8OjS4tRSHBicUnOIB377tHe8Yoa2wn1zwadI0PzPrSVlB36nA8 5WvYUJo78r0cY3KJXaRsGRfdXSESV9HlQLvVM+dOBLp/VZhWXw09KwwxoCB1FBs/hv Z+7/qM2rq70ESVLNYQx+mo3aUmt9azZiIpon960w= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder , Jacopo Mondi Subject: [PATCH v2 2/8] libcamera: rkisp1: Keep aspect ratio on imx8mp Date: Mon, 25 Nov 2024 16:14:11 +0100 Message-ID: <20241125151430.2437285-3-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> References: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" In the current code, the input stage of the image resizer is used to apply a crop to keep the aspect ratio in cases where the requested output aspect ratio differs from the one of the selected sensor mode. On the imx8mp the resizer hardware is not capable of cropping (for reference see also rkisp1-resizer.c:rkisp1_rsz_set_sink_crop() in the linux kernel v6.10). Therefore apply the necessary cropping on the output of the ISP (on the image stabilization block). The cropping code on the image resizer doesn't need modifications as the requested crop gets ignored by the kernel. While at it, remove a todo comment that is no longer needed. Signed-off-by: Stefan Klug Reviewed-by: Paul Elder Reviewed-by: Jacopo Mondi --- Changes in v2: - Fixed alignment - Improved comments - Removed todo comment - Collected tags --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 16 ++++++++++++++++ src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 13 ++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 5ffcfbce56be..a66b9dda83ab 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -811,6 +811,22 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) if (!isRaw_) format.code = MEDIA_BUS_FMT_YUYV8_2X8; + /* + * On devices without DUAL_CROP (like the imx8mp) cropping needs to be + * done on the ISP/IS output. + */ + if (media_->hwRevision() == RKISP1_V_IMX8MP) { + /* imx8mp has only a single path. */ + const auto &cfg = config->at(0); + Size ispCrop = format.size.boundedToAspectRatio(cfg.size) + .alignedUpTo(2, 2); + rect = ispCrop.centeredTo(Rectangle(format.size).center()); + if (ispCrop != format.size) + LOG(RkISP1, Info) << "ISP output needs to be cropped to " + << rect; + format.size = ispCrop; + } + LOG(RkISP1, Debug) << "Configuring ISP output pad with " << format << " crop " << rect; diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index 236d05af7a2f..eee5b09e2ff0 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -417,11 +417,14 @@ int RkISP1Path::configure(const StreamConfiguration &config, /* * Crop on the resizer input to maintain FOV before downscaling. * - * \todo The alignment to a multiple of 2 pixels is required but may - * change the aspect ratio very slightly. A more advanced algorithm to - * compute the resizer input crop rectangle is needed, and it should - * also take into account the need to crop away the edge pixels affected - * by the ISP processing blocks. + * Note that this does not apply to devices without DUAL_CROP support + * (like imx8mp) , where the cropping needs to be done on the + * ImageStabilizer block on the ISP source pad and therefore is + * configured before this stage. For simplicity we still set the crop. + * This gets ignored by the kernel driver because the hardware is + * missing the capability. + * + * Alignment to a multiple of 2 pixels is required by the resizer. */ Size ispCrop = inputFormat.size.boundedToAspectRatio(config.size) .alignedUpTo(2, 2); From patchwork Mon Nov 25 15:14:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22070 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9E208C32A3 for ; Mon, 25 Nov 2024 15:14:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 57A846602C; Mon, 25 Nov 2024 16:14:46 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="m3/DmxC3"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EFDE165FE3 for ; Mon, 25 Nov 2024 16:14:42 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:4cf:a935:de6f:a329]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4B07B6B5; Mon, 25 Nov 2024 16:14:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1732547661; bh=PFLFr1z8SrdYOryUAxh70oJ0WUiBhP33FFItw/qivV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m3/DmxC3M2cOA+SeTr2uDIDs9mY8kZsmYSvldybG76HEhYt9y8B1WozOf9c9WPdA3 kpU+tSnAvLWRD1fLE5wp/zFppwE6RvcezEIU4arsN0Bfa/5XuYOWKqtFK378JU0IaV eZfdjFVcFR6lwvU9m8N2ptDUgLnbagvUpUOhisJg= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder Subject: [PATCH v2 3/8] libcamera: geometry: Add Rectangle::transformedBetween() Date: Mon, 25 Nov 2024 16:14:12 +0100 Message-ID: <20241125151430.2437285-4-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> References: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Handling cropping and scaling within a complicated pipeline involves transformations of rectangles between different coordinate systems. For example the full input of the dewarper (0,0)/1920x1080 might correspond to the rectangle (0, 243)/2592x1458 in sensor coordinates (of a 2592x1944 sensor). Add a function that allows the transformation of a rectangle defined in one reference frame (dewarper) into the coordinates of a second reference frame (sensor). Signed-off-by: Stefan Klug Reviewed-by: Paul Elder Reviewed-by: Jacopo Mondi --- Changes in v2: - Renamed mappedBetween() to transformedBetween() - Improved documentation - Collected tags --- include/libcamera/geometry.h | 3 +++ src/libcamera/geometry.cpp | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h index 9ca5865a3d0d..e5f0a843d314 100644 --- a/include/libcamera/geometry.h +++ b/include/libcamera/geometry.h @@ -299,6 +299,9 @@ public: __nodiscard Rectangle scaledBy(const Size &numerator, const Size &denominator) const; __nodiscard Rectangle translatedBy(const Point &point) const; + + Rectangle transformedBetween(const Rectangle &source, + const Rectangle &target) const; }; bool operator==(const Rectangle &lhs, const Rectangle &rhs); diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp index 90ccf8c19f97..2c9308cb25ee 100644 --- a/src/libcamera/geometry.cpp +++ b/src/libcamera/geometry.cpp @@ -837,6 +837,43 @@ Rectangle Rectangle::translatedBy(const Point &point) const return { x + point.x, y + point.y, width, height }; } +/** + * \brief Transforms a Rectangle from one reference frame to another + * \param[in] source The \a source reference frame + * \param[in] destination The \a destination reference frame + * + * The params source and destinations specify two reference frames for the same + * data. The rectangle is translated from the source reference frame into the + * destination reference frame. + * + * For example, consider a sensor with a resolution of 4040x2360 pixels and a + * assume a rectangle of (100, 100)/3840x2160 (sensorFrame) in sensor + * coordinates is mapped to a rectangle (0,0)/(1920,1080) (displayFrame) in + * display coordinates. This function can be used to transform an arbitrary + * rectangle from display coordinates to sensor coordinates or vice versa: + * + * \code{.cpp} + * // Bottom right quarter in sensor coordinates + * Rectangle sensorRect(2020, 100, 1920, 1080); + * displayRect = sensorRect.transformedBetween(sensorFrame, displayFrame); + * // displayRect is now (960, 540)/960x540 + * sensorRect = displayRect.transformedBetween(displayFrame, sensorFrame); + * \endcode + */ +Rectangle Rectangle::transformedBetween(const Rectangle &source, + const Rectangle &destination) const +{ + Rectangle r; + double sx = static_cast(destination.width) / source.width; + double sy = static_cast(destination.height) / source.height; + + r.x = static_cast((x - source.x) * sx) + destination.x; + r.y = static_cast((y - source.y) * sy) + destination.y; + r.width = static_cast(width * sx); + r.height = static_cast(height * sy); + return r; +} + /** * \brief Compare rectangles for equality * \return True if the two rectangles are equal, false otherwise From patchwork Mon Nov 25 15:14:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22071 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D2E3DC32A3 for ; Mon, 25 Nov 2024 15:14:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8364366030; Mon, 25 Nov 2024 16:14:49 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="N9ne0gyS"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A875A65F77 for ; Mon, 25 Nov 2024 16:14:45 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:4cf:a935:de6f:a329]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 006C96B5; Mon, 25 Nov 2024 16:14:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1732547664; bh=gdaV5ba3O9WoUQxKGYs9XfX5z+OLsMDpZDoywV83c4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N9ne0gySPOgMV3K00VMS9ffCbAXn8stxeqGatdNeqy+OX/ThJQdjENr3MjDZg8HAQ qVDJ9fDjciBhlCyacP/lo5v2z4BFg+4/0GOjNXdMB9UvZKDvm0uxi8oQqQ2U/C0Srl XAfQkL6wheQV4xLnHDugKOIwJGAjIQsEkMKOEGpQ= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder , Jacopo Mondi Subject: [PATCH v2 4/8] pipeline: rkisp1: Split inputCrop and outputCrop Date: Mon, 25 Nov 2024 16:14:13 +0100 Message-ID: <20241125151430.2437285-5-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> References: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" One Rectangle instance is used to calculate the inputCrop and the outputCrop of the ISP in the rkisp1 pipeline. Split that into two distinct variables, because both values will be needed in the upcoming patches. This patch does not contain any functional changes. Signed-off-by: Stefan Klug Reviewed-by: Paul Elder Reviewed-by: Jacopo Mondi --- Changes in v2: - Moved declaration of outputCrop after setSelection(inputCrop) to get the potentially updated inputCrop - Collected tags --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index a66b9dda83ab..82f6df74840e 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -794,15 +794,16 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) if (ret < 0) return ret; - Rectangle rect(0, 0, format.size); - ret = isp_->setSelection(0, V4L2_SEL_TGT_CROP, &rect); + Rectangle inputCrop(0, 0, format.size); + ret = isp_->setSelection(0, V4L2_SEL_TGT_CROP, &inputCrop); if (ret < 0) return ret; LOG(RkISP1, Debug) << "ISP input pad configured with " << format - << " crop " << rect; + << " crop " << inputCrop; + Rectangle outputCrop = inputCrop; const PixelFormat &streamFormat = config->at(0).pixelFormat; const PixelFormatInfo &info = PixelFormatInfo::info(streamFormat); isRaw_ = info.colourEncoding == PixelFormatInfo::ColourEncodingRAW; @@ -820,18 +821,18 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) const auto &cfg = config->at(0); Size ispCrop = format.size.boundedToAspectRatio(cfg.size) .alignedUpTo(2, 2); - rect = ispCrop.centeredTo(Rectangle(format.size).center()); + outputCrop = ispCrop.centeredTo(Rectangle(format.size).center()); if (ispCrop != format.size) LOG(RkISP1, Info) << "ISP output needs to be cropped to " - << rect; + << outputCrop; format.size = ispCrop; } LOG(RkISP1, Debug) << "Configuring ISP output pad with " << format - << " crop " << rect; + << " crop " << outputCrop; - ret = isp_->setSelection(2, V4L2_SEL_TGT_CROP, &rect); + ret = isp_->setSelection(2, V4L2_SEL_TGT_CROP, &outputCrop); if (ret < 0) return ret; @@ -842,7 +843,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) LOG(RkISP1, Debug) << "ISP output pad configured with " << format - << " crop " << rect; + << " crop " << outputCrop; std::map streamConfig; std::vector> outputCfgs; From patchwork Mon Nov 25 15:14:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22072 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id E4424C32A3 for ; Mon, 25 Nov 2024 15:14:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 988B466035; Mon, 25 Nov 2024 16:14:52 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="GR3Y2JcJ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C9B7B65F77 for ; Mon, 25 Nov 2024 16:14:48 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:4cf:a935:de6f:a329]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 22C4A6B5; Mon, 25 Nov 2024 16:14:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1732547667; bh=qrWkRQ5IZIRs6UqBkZKNuXx/ZUkSpXqEiMXr7EYG2hA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GR3Y2JcJ3m2ZEsH+41EIHLNViSGP1vPXbVPtfNJisM3Zuhu45LVtRG8qBQ435sbMi 2wjJj6otK08w44WPvj2DHuscP4EUQ/zM+uVG5ouplpv2akLm4mAuMlfW4MBadd846L TKfEgKqOdirVtCawda1GFO/IvBT8aSPPzty3EiKQ= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder , Jacopo Mondi Subject: [PATCH v2 5/8] pipeline: rkisp1: Reorder sensorInfo collection code Date: Mon, 25 Nov 2024 16:14:14 +0100 Message-ID: <20241125151430.2437285-6-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> References: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The sensorInfo (specifically the crop rectangle of the selected sensor mode) is collected to be passed to the IPA later. In an upcoming patch that data will also be needed for correct ScalerCrop handling. Move the collection of the sensorInfo before the dewarper configuration step and refactor the code a bit. Signed-off-by: Stefan Klug Reviewed-by: Paul Elder Reviewed-by: Jacopo Mondi --- Changes in v2: - Collected tags --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 82f6df74840e..1ba416aaa545 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -845,6 +845,11 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) << "ISP output pad configured with " << format << " crop " << outputCrop; + IPACameraSensorInfo sensorInfo; + ret = data->sensor_->sensorInfo(&sensorInfo); + if (ret) + return ret; + std::map streamConfig; std::vector> outputCfgs; @@ -884,14 +889,9 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) return ret; /* Inform IPA of stream configuration and sensor controls. */ - ipa::rkisp1::IPAConfigInfo ipaConfig{}; - - ret = data->sensor_->sensorInfo(&ipaConfig.sensorInfo); - if (ret) - return ret; - - ipaConfig.sensorControls = data->sensor_->controls(); - ipaConfig.paramFormat = paramFormat.fourcc; + ipa::rkisp1::IPAConfigInfo ipaConfig{ sensorInfo, + data->sensor_->controls(), + paramFormat.fourcc }; ret = data->ipa_->configure(ipaConfig, streamConfig, &data->ipaControls_); if (ret) { From patchwork Mon Nov 25 15:14:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22073 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 26AC2C32A3 for ; Mon, 25 Nov 2024 15:14:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B1F0966034; Mon, 25 Nov 2024 16:14:53 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="qTFXaew5"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 59A0E65FE3 for ; Mon, 25 Nov 2024 16:14:51 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:4cf:a935:de6f:a329]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A3A7EE1F; Mon, 25 Nov 2024 16:14:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1732547669; bh=knniJ0aUE/TXqU61yO0r18bhGE24rQ3H6mBXI0cxkRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qTFXaew5HHak5GN4nshvt7rhOyghHUTjN3I5245cHn4v30MEeav7jwbqEaqjGBsH6 Qq93JML6jv4LbxKy7jHoK0AfwEj/XfVU4SJ0ofVLvLvTMcDkjLnsZtJs4JkmbugYgc YrinfK838lSs+OT4nGdoDnLn0TkgEggE+bvv4heA= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v2 6/8] libcamera: converter_v4l2_m2m: Improve crop bounds support Date: Mon, 25 Nov 2024 16:14:15 +0100 Message-ID: <20241125151430.2437285-7-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> References: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When a converter (dw100 on imx8mp in this case) is used in a pipeline, the ScalerCrop control get's created at createCamera() time. As this is before configure(), no streams were configured on the converter and the stream specific crop bounds are not known. Extend the converter class to report the default crop bounds in case the provided stream is not found. Signed-off-by: Stefan Klug --- Changes in v2: - Added this patch --- .../internal/converter/converter_v4l2_m2m.h | 1 + src/libcamera/converter.cpp | 3 + .../converter/converter_v4l2_m2m.cpp | 113 +++++++++--------- 3 files changed, 59 insertions(+), 58 deletions(-) diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h index 0bc0d053e2c4..a5286166f574 100644 --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h @@ -105,6 +105,7 @@ private: std::map> streams_; std::map queue_; + std::pair inputCropBounds_; }; } /* namespace libcamera */ diff --git a/src/libcamera/converter.cpp b/src/libcamera/converter.cpp index 945f2527b96a..d4b5e5260e02 100644 --- a/src/libcamera/converter.cpp +++ b/src/libcamera/converter.cpp @@ -195,6 +195,9 @@ Converter::~Converter() * this function should be called after the \a stream has been configured using * configure(). * + * When called with an invalid \a stream, the function returns the default crop + * bounds of the converter. + * * \return A pair containing the minimum and maximum crop bound in that order */ diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp index d63ef2f8028f..bd7e5cce600d 100644 --- a/src/libcamera/converter/converter_v4l2_m2m.cpp +++ b/src/libcamera/converter/converter_v4l2_m2m.cpp @@ -30,6 +30,52 @@ namespace libcamera { LOG_DECLARE_CATEGORY(Converter) +namespace { + +int getCropBounds(V4L2VideoDevice *device, Rectangle &minCrop, + Rectangle &maxCrop) +{ + Rectangle minC; + Rectangle maxC; + + /* Find crop bounds */ + minC.width = 1; + minC.height = 1; + maxC.width = UINT_MAX; + maxC.height = UINT_MAX; + + int ret = device->setSelection(V4L2_SEL_TGT_CROP, &minC); + if (ret) { + LOG(Converter, Error) + << "Could not query minimum selection crop: " + << strerror(-ret); + return ret; + } + + ret = device->getSelection(V4L2_SEL_TGT_CROP_BOUNDS, &maxC); + if (ret) { + LOG(Converter, Error) + << "Could not query maximum selection crop: " + << strerror(-ret); + return ret; + } + + /* Reset the crop to its maximum */ + ret = device->setSelection(V4L2_SEL_TGT_CROP, &maxC); + if (ret) { + LOG(Converter, Error) + << "Could not reset selection crop: " + << strerror(-ret); + return ret; + } + + minCrop = minC; + maxCrop = maxC; + return 0; +} + +} /* namespace */ + /* ----------------------------------------------------------------------------- * V4L2M2MConverter::V4L2M2MStream */ @@ -98,41 +144,10 @@ int V4L2M2MConverter::V4L2M2MStream::configure(const StreamConfiguration &inputC outputBufferCount_ = outputCfg.bufferCount; if (converter_->features() & Feature::InputCrop) { - Rectangle minCrop; - Rectangle maxCrop; - - /* Find crop bounds */ - minCrop.width = 1; - minCrop.height = 1; - maxCrop.width = UINT_MAX; - maxCrop.height = UINT_MAX; - - ret = setInputSelection(V4L2_SEL_TGT_CROP, &minCrop); - if (ret) { - LOG(Converter, Error) - << "Could not query minimum selection crop: " - << strerror(-ret); - return ret; - } - - ret = getInputSelection(V4L2_SEL_TGT_CROP_BOUNDS, &maxCrop); - if (ret) { - LOG(Converter, Error) - << "Could not query maximum selection crop: " - << strerror(-ret); - return ret; - } - - /* Reset the crop to its maximum */ - ret = setInputSelection(V4L2_SEL_TGT_CROP, &maxCrop); - if (ret) { - LOG(Converter, Error) - << "Could not reset selection crop: " - << strerror(-ret); + ret = getCropBounds(m2m_->output(), inputCropBounds_.first, + inputCropBounds_.second); + if (ret) return ret; - } - - inputCropBounds_ = { minCrop, maxCrop }; } return 0; @@ -258,27 +273,9 @@ V4L2M2MConverter::V4L2M2MConverter(MediaDevice *media) return; } - /* Discover Feature::InputCrop */ - Rectangle maxCrop; - maxCrop.width = UINT_MAX; - maxCrop.height = UINT_MAX; - - ret = m2m_->output()->setSelection(V4L2_SEL_TGT_CROP, &maxCrop); - if (ret) - return; - - /* - * Rectangles for cropping targets are defined even if the device - * does not support cropping. Their sizes and positions will be - * fixed in such cases. - * - * Set and inspect a crop equivalent to half of the maximum crop - * returned earlier. Use this to determine whether the crop on - * input is really supported. - */ - Rectangle halfCrop(maxCrop.size() / 2); - ret = m2m_->output()->setSelection(V4L2_SEL_TGT_CROP, &halfCrop); - if (!ret && halfCrop != maxCrop) { + ret = getCropBounds(m2m_->output(), inputCropBounds_.first, + inputCropBounds_.second); + if (!ret && inputCropBounds_.first != inputCropBounds_.second) { features_ |= Feature::InputCrop; LOG(Converter, Info) @@ -477,10 +474,10 @@ std::pair V4L2M2MConverter::inputCropBounds(const Stream *stream) { auto iter = streams_.find(stream); - if (iter == streams_.end()) - return {}; + if (iter != streams_.end()) + return iter->second->inputCropBounds(); - return iter->second->inputCropBounds(); + return inputCropBounds_; } /** From patchwork Mon Nov 25 15:14:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22074 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 29FABC32A3 for ; Mon, 25 Nov 2024 15:14:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A5F626603A; Mon, 25 Nov 2024 16:14:56 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JeT4GE4Z"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 51EAC6602C for ; Mon, 25 Nov 2024 16:14:54 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:4cf:a935:de6f:a329]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9140012E9; Mon, 25 Nov 2024 16:14:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1732547672; bh=+4nBmgLriUUBQtjNnMckVwtbR90u/ELyhcgVmxo84Os=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JeT4GE4ZcnBOCCI5u9K5I7+/tbPSsstfafZX99fCy5jDAis7nmFVlHRImS6wOR0uB ekHn8UJ6E2byB3EGSXykcp23BU4ke8TJAJkbohp1UaszHZLMF7sjyYa95ONlnjgVQu SEC9P+THfSAdUBIK/eUHkGFsofXqRJs3wSMdtWLs= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder Subject: [PATCH v2 7/8] pipeline: rkisp1: Fix ScalerCrop to be in sensor coordinates Date: Mon, 25 Nov 2024 16:14:16 +0100 Message-ID: <20241125151430.2437285-8-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> References: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" ScalerCrop is specified as being in sensor coordinates. The current dewarper implementation on the imx8mp handles ScalerCrop in dewarper coordinates. This leads to unexpected results and an unusable ScalerCrop control in camshark. Fix that by transforming back and forth between sensor coordinates and dewarper coordinates. Signed-off-by: Stefan Klug Reviewed-by: Paul Elder --- Changes in v2: - Initialize dewarperSensorCrop_ to sane defaults - Collected tags --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 50 +++++++++++++++++++----- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 1ba416aaa545..0a044b08bc87 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -204,6 +204,7 @@ private: RkISP1SelfPath selfPath_; std::unique_ptr dewarper_; + Rectangle dewarperSensorCrop_; bool useDewarper_; std::optional activeCrop_; @@ -863,6 +864,15 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) outputCfgs.push_back(const_cast(cfg)); ret = dewarper_->configure(cfg, outputCfgs); useDewarper_ = ret ? false : true; + + /* + * Calculate the crop rectangle of the data + * flowing into the dewarper in sensor + * coordinates. + */ + dewarperSensorCrop_ = + outputCrop.transformedBetween(inputCrop, + sensorInfo.analogCrop); } } else if (hasSelfPath_) { ret = selfPath_.configure(cfg, format); @@ -1225,10 +1235,19 @@ int PipelineHandlerRkISP1::updateControls(RkISP1CameraData *data) std::pair cropLimits = dewarper_->inputCropBounds(&data->mainPathStream_); - controls[&controls::ScalerCrop] = ControlInfo(cropLimits.first, - cropLimits.second, - cropLimits.second); - activeCrop_ = cropLimits.second; + /* + * ScalerCrop is specified to be in Sensor coordinates. + * So we need to transform the limits to sensor coordinates. + * We can safely assume that the maximum crop limit contains the + * full fov of the dewarper. + */ + Rectangle min = cropLimits.first.transformedBetween(cropLimits.second, + dewarperSensorCrop_); + Rectangle max = cropLimits.second.transformedBetween(cropLimits.second, + dewarperSensorCrop_); + + controls[&controls::ScalerCrop] = ControlInfo(min, max, max); + activeCrop_ = max; } /* Add the IPA registered controls to list of camera controls. */ @@ -1256,6 +1275,8 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) /* Initialize the camera properties. */ data->properties_ = data->sensor_->properties(); + dewarperSensorCrop_ = Rectangle(data->sensor_->resolution()); + /* * \todo Read delay values from the sensor itself or from a * a sensor database. For now use generic values taken from @@ -1479,22 +1500,33 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer) /* Handle scaler crop control. */ const auto &crop = request->controls().get(controls::ScalerCrop); if (crop) { - Rectangle appliedRect = crop.value(); + Rectangle rect = crop.value(); + + /* + * ScalerCrop is specified to be in Sensor coordinates. + * So we need to transform it into dewarper coordinates. + * We can safely assume that the maximum crop limit contains the + * full fov of the dewarper. + */ + std::pair cropLimits = + dewarper_->inputCropBounds(&data->mainPathStream_); + rect = rect.transformedBetween(dewarperSensorCrop_, cropLimits.second); int ret = dewarper_->setInputCrop(&data->mainPathStream_, - &appliedRect); - if (!ret && appliedRect != crop.value()) { + &rect); + rect = rect.transformedBetween(cropLimits.second, dewarperSensorCrop_); + if (!ret && rect != crop.value()) { /* * If the rectangle is changed by setInputCrop on the * dewarper, log a debug message and cache the actual * applied rectangle for metadata reporting. */ LOG(RkISP1, Debug) - << "Applied rectangle " << appliedRect.toString() + << "Applied rectangle " << rect.toString() << " differs from requested " << crop.value().toString(); } - activeCrop_ = appliedRect; + activeCrop_ = rect; } /* From patchwork Mon Nov 25 15:14:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22075 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 8BA47C32A3 for ; Mon, 25 Nov 2024 15:15:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CFE206603D; Mon, 25 Nov 2024 16:14:59 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="TG6yWZPC"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 055056603C for ; Mon, 25 Nov 2024 16:14:57 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:4cf:a935:de6f:a329]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4E5086B5; Mon, 25 Nov 2024 16:14:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1732547675; bh=sn4sxcC4HIKI8WwHR5LtzEAMmK0tZ3z/Qjk+SuBsuzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TG6yWZPCt4f/NiHwpRD37wKqDS074srRTc8tcpmOG7E8zOCNKl3orwA4iXkUrDQ98 TApbdmxoHh31YPEsCmTAPdGtVOeneSM6wdyj85x0Z4oypkuG4w73V5bRN0xYUDeiOm PO+15ztoyPsagQXbD8VYf3lEkw6u5GbZMMtMqMB0= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder Subject: [PATCH v2 8/8] pipeline: rkisp1: Add ScalerMaximumCrop property Date: Mon, 25 Nov 2024 16:14:17 +0100 Message-ID: <20241125151430.2437285-9-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> References: <20241125151430.2437285-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The ScalerMaximumCrop property holds the biggest allowed ScalerCrop value. Add it to the rkisp1. Signed-off-by: Stefan Klug Reviewed-by: Paul Elder --- Changes in v2: - Moved one hunk to the correct patch 6/7 --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 0a044b08bc87..993515c258ef 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -1247,6 +1248,7 @@ int PipelineHandlerRkISP1::updateControls(RkISP1CameraData *data) dewarperSensorCrop_); controls[&controls::ScalerCrop] = ControlInfo(min, max, max); + data->properties_.set(properties::ScalerCropMaximum, max); activeCrop_ = max; }