From patchwork Tue Mar 7 11:48:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18351 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 29A04BDE17 for ; Tue, 7 Mar 2023 11:48:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0B595626BD; Tue, 7 Mar 2023 12:48:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1678189701; bh=yTZCZe+asRpABZTXEMdxSzftafd8+qHzj3TlxvWe8Y0=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=31GnVCco6lemk2uCPNzOAm2lv16IHlfCMlYDE8ovs+p7+Wt0CT03l/3s4R+mzGxAg SlcvtZ/3nMY7Trjd+Eoz2k1HB9ub+WfPrAjZE9LDXslJA76KZd0DBjgcM+OZaKbZzu jx5Ot91m1t+fLn97hlwaATaYcddnO1CVC2cjacyqxN9AFz7uV/zOMZY5mPfrFxS8W5 9ksKbdSvAYJpmHE6f9uRou0aPeOhiTdYzb4sL4856ij7b6uYf2xVQJe0BmPa2bfOn4 rWhedKjc05PzU7hT8Ri3ilnHwCij9Tu+17XBIspPoErz/kjWHl56UR5VmANAMu6Ep6 HUCdr5bxS7jkQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 95DDD6265E for ; Tue, 7 Mar 2023 12:48:19 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="F7NnQAaU"; dkim-atps=neutral Received: from uno.homenet.telecomitalia.it (host-79-47-54-87.retail.telecomitalia.it [79.47.54.87]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9E5CD6D5; Tue, 7 Mar 2023 12:48:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1678189699; bh=yTZCZe+asRpABZTXEMdxSzftafd8+qHzj3TlxvWe8Y0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F7NnQAaUWn2wEKDy8fA4fvhoVCB6SLd2/NxxRRxHga/Tq/092WbhHsG3yeWIHJUqP IrxZgqdN4Sm1UiR57lcT6+8W+0pvC+wNHiSZDMzqdwR2N/ADbuGTMkzy9okwlso2GJ dvxT90ymZkgv3izr+/x/vvtqWQbuKDf49in3NsYw= To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Mar 2023 12:48:01 +0100 Message-Id: <20230307114804.42291-2-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230307114804.42291-1-jacopo.mondi@ideasonboard.com> References: <20230307114804.42291-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/4] libcamera: rkisp1: Generate config using main path 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: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi , libcamera@luigi311.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The generateConfiguration() implementation in the Rockchip RkISP1 pipeline handler uses by default the self path (if available) for the Viewfinder and VideoRecording StreamRoles. The validate() implementation, at the contrary, prefers using the main path, when available, for all streams. As the self-path is limited in output resolution to 1920x1920, generating a configuration using the self path limits the maximum stream size to 1920x1920, while higher resolutions can be obtained by using the main path. Align the generateConfiguration() implementation to the validate() one by using the main path by default if available. Bug: https://bugs.libcamera.org/show_bug.cgi?id=180 Reported-by: libcamera@luigi311.com Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 096c9cca3a0a..ebc9bef8688a 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -647,23 +647,19 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, * first stream and use it for all streams. */ std::optional colorSpace; - bool mainPathAvailable = true; - bool selfPathAvailable = data->selfPath_; for (const StreamRole role : roles) { - bool useMainPath; + bool useMainPath = mainPathAvailable; switch (role) { case StreamRole::StillCapture: - useMainPath = mainPathAvailable; /* JPEG encoders typically expect sYCC. */ if (!colorSpace) colorSpace = ColorSpace::Sycc; break; case StreamRole::Viewfinder: - useMainPath = !selfPathAvailable; /* * sYCC is the YCbCr encoding of sRGB, which is commonly * used by displays. @@ -673,7 +669,6 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, break; case StreamRole::VideoRecording: - useMainPath = !selfPathAvailable; /* Rec. 709 is a good default for HD video recording. */ if (!colorSpace) colorSpace = ColorSpace::Rec709; @@ -686,7 +681,6 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, return nullptr; } - useMainPath = true; colorSpace = ColorSpace::Raw; break; @@ -703,7 +697,6 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, mainPathAvailable = false; } else { path = data->selfPath_; - selfPathAvailable = false; } StreamConfiguration cfg = From patchwork Tue Mar 7 11:48:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18352 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 5F176C3262 for ; Tue, 7 Mar 2023 11:48:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AF1AA626BB; Tue, 7 Mar 2023 12:48:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1678189703; bh=tEJ/Ku6ALYwkf5j6tOc7gxeM/+0Fa2jQJ7p3FxLaXk4=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=QBTDTTnPCPsohiZXixp5bU4iASDmj8jbuQAJljnszX8weqEa4N7lcX/EOnkCbDCDr oFE8mFtKEl2R1NbOJ5bzaM9T8UyuQh3Nbt4r7MLLfOE+wW4F+ls+AP/bKctNBD6HvY OE+rFyMDMEgQvPddTQQeMGF844Mgy9TeqCirgBL/4/6BcAB+ROwh9LMWmkP+06F4F5 SAI9deQpvByZAoodC83OQsevYVXy0j7bub+PSYm/SaAeCJuNwfT5A8b/X5DuLq48H7 raYpbgnQQ5NmJl8habObQnuZK0G37PF/8VjifRbRDJRkrh4MmzGt3/lg5OWGGhpujf KmOJLg7q8n74Q== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 95E25626B4 for ; Tue, 7 Mar 2023 12:48:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Y2dXDfQf"; dkim-atps=neutral Received: from uno.homenet.telecomitalia.it (host-79-47-54-87.retail.telecomitalia.it [79.47.54.87]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B0EC89A8; Tue, 7 Mar 2023 12:48:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1678189700; bh=tEJ/Ku6ALYwkf5j6tOc7gxeM/+0Fa2jQJ7p3FxLaXk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y2dXDfQfSjCiIyUCCeGgw0fRgqedHvPRMkE6rkfATV3xU5xmk6LbYAx9YYmbbEY2R oX9+hhKCQCT+tXZSGTpAcHD5qxPxGjEAvWmrtJc6VveVLB2BQ+H3RiT0kntk+/0qzj c+nb5TCDVlGIL+4zLwy6CPPcY4FKBGwdhjFJpJwY= To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Mar 2023 12:48:02 +0100 Message-Id: <20230307114804.42291-3-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230307114804.42291-1-jacopo.mondi@ideasonboard.com> References: <20230307114804.42291-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/4] libcamera: rkisp1: Assign sizes to roles 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: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi , libcamera@luigi311.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Currently each RkISP1 path (main and self) generate a configuration by bounding the sensor's resolution to their respective maximum output aspect ratio and size. Size maxResolution = maxResolution_.boundedToAspectRatio(resolution) .boundedTo(resolution); In the case of self path, whose maximum size is 1920x1920, the generated configuration could get assigned unusual sizes, as the result of the above operation As an example, with the imx258 sensor whose resolution is 4208x3118, the resulting size for the Viewfinder use case is an unusual 1920x1423. Fix this by assigning to each role a desired output size: - Use the sensor's resolution for StillCapture and Raw - Use 1080p for Viewfinder and VideoRecording Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +++++++++++- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 10 ++++++++-- src/libcamera/pipeline/rkisp1/rkisp1_path.h | 1 + 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index ebc9bef8688a..60ab7380034c 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -164,6 +164,8 @@ public: bool match(DeviceEnumerator *enumerator) override; private: + static constexpr Size kRkISP1PreviewSize = { 1920, 1080 }; + RkISP1CameraData *cameraData(Camera *camera) { return static_cast(camera->_d()); @@ -651,12 +653,15 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, for (const StreamRole role : roles) { bool useMainPath = mainPathAvailable; + Size size; switch (role) { case StreamRole::StillCapture: /* JPEG encoders typically expect sYCC. */ if (!colorSpace) colorSpace = ColorSpace::Sycc; + + size = data->sensor_->resolution(); break; case StreamRole::Viewfinder: @@ -666,12 +671,16 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, */ if (!colorSpace) colorSpace = ColorSpace::Sycc; + + size = kRkISP1PreviewSize; break; case StreamRole::VideoRecording: /* Rec. 709 is a good default for HD video recording. */ if (!colorSpace) colorSpace = ColorSpace::Rec709; + + size = kRkISP1PreviewSize; break; case StreamRole::Raw: @@ -682,6 +691,7 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, } colorSpace = ColorSpace::Raw; + size = data->sensor_->resolution(); break; default: @@ -700,7 +710,7 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, } StreamConfiguration cfg = - path->generateConfiguration(data->sensor_.get(), role); + path->generateConfiguration(data->sensor_.get(), size, role); if (!cfg.pixelFormat.isValid()) return nullptr; diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index 5079b268c464..a27ac6fc35cb 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -127,15 +127,21 @@ void RkISP1Path::populateFormats() } StreamConfiguration -RkISP1Path::generateConfiguration(const CameraSensor *sensor, StreamRole role) +RkISP1Path::generateConfiguration(const CameraSensor *sensor, + const Size &size, + StreamRole role) { const std::vector &mbusCodes = sensor->mbusCodes(); const Size &resolution = sensor->resolution(); + /* Min and max resolutions to populate the available stream formats. */ Size maxResolution = maxResolution_.boundedToAspectRatio(resolution) .boundedTo(resolution); Size minResolution = minResolution_.expandedToAspectRatio(resolution); + /* The desired stream size, bound to the max resolution. */ + Size streamSize = size.boundedTo(maxResolution); + /* Create the list of supported stream formats. */ std::map> streamFormats; unsigned int rawBitsPerPixel = 0; @@ -189,7 +195,7 @@ RkISP1Path::generateConfiguration(const CameraSensor *sensor, StreamRole role) StreamFormats formats(streamFormats); StreamConfiguration cfg(formats); cfg.pixelFormat = format; - cfg.size = maxResolution; + cfg.size = streamSize; cfg.bufferCount = RKISP1_BUFFER_COUNT; return cfg; diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h index bdf3f95b95e1..cd77957ee4a6 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h @@ -41,6 +41,7 @@ public: bool isEnabled() const { return link_->flags() & MEDIA_LNK_FL_ENABLED; } StreamConfiguration generateConfiguration(const CameraSensor *sensor, + const Size &resolution, StreamRole role); CameraConfiguration::Status validate(const CameraSensor *sensor, StreamConfiguration *cfg); From patchwork Tue Mar 7 11:48:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18353 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 C3CADC329C for ; Tue, 7 Mar 2023 11:48:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 24D7F626C4; Tue, 7 Mar 2023 12:48:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1678189704; bh=Js72QCTaA6BDl8LnSR0Hc45/HYXluIjxQWxgDjOpCIE=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=BgKtLIZOgX8njUAU7HklsygP3N0eFQutLC6NK81t9e6wkayEIdWQbp3kCqzw77aJ5 U9j8lkljTxlOdhuyC4BtaRCQdlSH83DXEiKmONBKvPxxl0nD5CNqvEuInHd6JiSQEq F56EA5i/D1Ulfs3IfPDEDVWhz+GLALHUEcYRwpt1UurT4pDF2Uakjy/OlOP5qgThze lgC0w6j5hQhr7OPe1XHz+OZE+Jw0JiwGvWboYLz6CRa+QgndZyYL8lK4AU8tD19taq td9Za3BLxc0OHKqby6vSzLsPCmuxWNySHokkUt227Ih+b6hEWesA5QHKhkVq4uvARS UW0z0aT7dP68w== 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 7BAB1626BB for ; Tue, 7 Mar 2023 12:48:21 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="oPJefkvF"; dkim-atps=neutral Received: from uno.homenet.telecomitalia.it (host-79-47-54-87.retail.telecomitalia.it [79.47.54.87]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9EAEC4AD; Tue, 7 Mar 2023 12:48:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1678189701; bh=Js72QCTaA6BDl8LnSR0Hc45/HYXluIjxQWxgDjOpCIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oPJefkvFu3UBXjKCnpTNfljnBuRgcb/lUnP0nslV3Q5RENLDKvHWzuYScnc1hO7N4 HGhZvbb5vMBUt553wSFr6qktxizfPHatvU2ODO1y7g86t8Rmu6L/bbnDb+bixsEHsG a9K7PuVTpoXoPiLwHwVN0gHSMM9dEZGlwfYtbC2s= To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Mar 2023 12:48:03 +0100 Message-Id: <20230307114804.42291-4-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230307114804.42291-1-jacopo.mondi@ideasonboard.com> References: <20230307114804.42291-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/4] libcamera: rkisp1: Reserve main path for StillCapture 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: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi , libcamera@luigi311.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The main output path can produce images in higher resolution and should be reserved for the StillCapture role when a configuration is generated. Before this change if StillCapture was not requested first it got assigned to the self-path and thus down-scaled to 1920x1920. With this change, StillCapture can be asked last and it would take precedence over other streams for the usage of the main path. $ cam -c1 --stream role=viewfinder --stream role=still Camera camera.cpp:969 streams configuration: (0) 1920x1080-NV12 (1) 4208x3120-NV12 Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 60ab7380034c..cd92e99a50b3 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -643,6 +643,10 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, if (roles.empty()) return config; + /* If still capture is requested, reserve the main path for it. */ + bool reserveMainPath = std::find(roles.cbegin(), roles.cend(), + StreamRole::StillCapture) != roles.cend(); + /* * As the ISP can't output different color spaces for the main and self * path, pick a sensible default color space based on the role of the @@ -661,6 +665,9 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, if (!colorSpace) colorSpace = ColorSpace::Sycc; + /* Unlock usage of main path which was reserved. */ + reserveMainPath = false; + size = data->sensor_->resolution(); break; @@ -702,7 +709,7 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, RkISP1Path *path; - if (useMainPath) { + if (useMainPath && !reserveMainPath) { path = data->mainPath_; mainPathAvailable = false; } else { From patchwork Tue Mar 7 11:48:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18354 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 EB4E9BDE17 for ; Tue, 7 Mar 2023 11:48:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9CEBE626C3; Tue, 7 Mar 2023 12:48:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1678189705; bh=v+WGKwdwfLN7Z5/CqAoChHKxkVfoQXG8rWoPfrM3qqw=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=jyhF2Ko7D7YUHYssPU0JmALH3JHCRNjJG6fwvNT2ZBftR9XQnLacgXPKmglff1XBb BeZ/ns2j/BWDDX0HN2/FzlkhxODlIIW9l6wDFuwPgrSmOkRVm+OTNmCuBCaWv52k+W ovlf0w82ySiaA9luyLkbYoM+ID3kzzj3hduB6yOiJlL7YmV4pi3ikCYEUX6JEctnxN S98L4gtmHWuv5ZcpjB39s9XOradrM0AvNUm9I+w4WxLqhoxiGsjw9TzTEVxI8ap1ER nLD3ekwDBDCmqfxLwZ2NyHH4SN7G+3iZnpqIq1WwuzzwbLK7dMSOBR5/ndBn1NuV5F 0k8WacODQ5KCQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 416B5626BC for ; Tue, 7 Mar 2023 12:48:22 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="oeaKUbYx"; dkim-atps=neutral Received: from uno.homenet.telecomitalia.it (host-79-47-54-87.retail.telecomitalia.it [79.47.54.87]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 798246D5; Tue, 7 Mar 2023 12:48:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1678189702; bh=v+WGKwdwfLN7Z5/CqAoChHKxkVfoQXG8rWoPfrM3qqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oeaKUbYx2Lw7D1VtoKlhlWSrs76XfjM7g2JPYl899fJWJtD7QW8gtHafGl4ZDzpgb GaeQ9X06KswSzI97Hg4ZlmSHQOITApc/V6CCm4VJPNZdaB7d38mGDqb6iPn5xmyhlI ippEt3wavZbXAOmINHlTI+0dFa+E/7TXTPfB3FdA= To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Mar 2023 12:48:04 +0100 Message-Id: <20230307114804.42291-5-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230307114804.42291-1-jacopo.mondi@ideasonboard.com> References: <20230307114804.42291-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 4/4] libcamera: rkisp1: Fix enumeration of RAW formats 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: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi , libcamera@luigi311.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The current implementation enumerates a single RAW format (the sensor's resolution) and does that regardless of what role the CameraConfiguration has been generated for. Fix this by: - Enumerate RAW StreamFormats only when the requested role is StreamRole::Raw - Add all the sensor's provided resolutions that fit the video device output maximum size Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder --- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index a27ac6fc35cb..0e4d76677732 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -150,18 +150,33 @@ RkISP1Path::generateConfiguration(const CameraSensor *sensor, for (const auto &format : streamFormats_) { const PixelFormatInfo &info = PixelFormatInfo::info(format); + /* Populate stream formats for non-RAW configurations. */ if (info.colourEncoding != PixelFormatInfo::ColourEncodingRAW) { + if (role == StreamRole::Raw) + continue; + streamFormats[format] = { { minResolution, maxResolution } }; continue; } - /* Skip raw formats not supported by the sensor. */ + /* Skip RAW formats for non-raw roles. */ + if (role != StreamRole::Raw) + continue; + + /* Populate stream formats for RAW configurations. */ uint32_t mbusCode = formatToMediaBus.at(format); if (std::find(mbusCodes.begin(), mbusCodes.end(), mbusCode) == mbusCodes.end()) + /* Skip formats not supported by sensor. */ continue; - streamFormats[format] = { { resolution, resolution } }; + /* Add all the RAW sizes the sensor can produce for this code. */ + for (const auto &rawSize : sensor->sizes(mbusCode)) { + if (rawSize > maxResolution_) + continue; + + streamFormats[format].push_back({ rawSize, rawSize }); + } /* * Store the raw format with the highest bits per pixel for