From patchwork Wed Feb 22 15:19:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18295 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 DCA3CC3259 for ; Wed, 22 Feb 2023 15:19:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2F57D6265E; Wed, 22 Feb 2023 16:19:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1677079171; bh=+1iyV2gHAn7SrlN9e6NHWLjBt6ZCa0hB+kgYjP2c0ps=; 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=Tep6dzi9DkobP+53rFFcBgEFwsit27MFOoKCtfWekHqtScrCGzE2U6CgL/YEwQ2wn 8Pp818NLsgu5mHE2XMXuXN+botneG4WpkZKs00GpElXL3LJdC3sNSDw4XT7NYQ0HGN zUvTaJKRvtU7yL25MB4cFw5V1zzOJxBfD39kgddJOGpZxNp7VYRNdrnD5Mm79YliyZ wBkqYKrDTFHxr/DfBAAzuuXUARkMw3RphWJ6q8Hd/ZrB7nOHqtZFCFmr+DPeZnLfP6 0NryzDUzdUGBf8HSeAMUAmEKYSIKkfdcu5l7Xa6TMfm+3Mon/JaQCzDnmMf2UiGh0A pn/be1ZVi7chA== 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 8A67F61EE3 for ; Wed, 22 Feb 2023 16:19:29 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="c9g6F5vh"; dkim-atps=neutral Received: from uno.homenet.telecomitalia.it (host-87-16-53-160.retail.telecomitalia.it [87.16.53.160]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EB6259DE; Wed, 22 Feb 2023 16:19:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1677079169; bh=+1iyV2gHAn7SrlN9e6NHWLjBt6ZCa0hB+kgYjP2c0ps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c9g6F5vhCl24gpiggut3J92riDWFZvwKJXaStI35p3tyCOvcw51FuLlQ6lFmgOyul I62JejampdlVBQwt/JT9UHNRgq/uukgi2xHELyZk2gf4jjS+XSuGN+8jEBs3g4x+JH JEOIQx+Lro3XNTxeXzsqsIhcdBJwe6yY9iveNdIo= To: libcamera-devel@lists.libcamera.org Date: Wed, 22 Feb 2023 16:19:14 +0100 Message-Id: <20230222151917.669526-2-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230222151917.669526-1-jacopo.mondi@ideasonboard.com> References: <20230222151917.669526-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 --- 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 8a30fe061d04..569fb8ecb629 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -630,23 +630,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. @@ -656,7 +652,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; @@ -669,7 +664,6 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, return nullptr; } - useMainPath = true; colorSpace = ColorSpace::Raw; break; @@ -686,7 +680,6 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, mainPathAvailable = false; } else { path = data->selfPath_; - selfPathAvailable = false; } StreamConfiguration cfg = From patchwork Wed Feb 22 15:19:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18296 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 C446DBE080 for ; Wed, 22 Feb 2023 15:19:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9A18662662; Wed, 22 Feb 2023 16:19:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1677079171; bh=C1ZErz4UhUBjNkyBlbLOTUkRDyTmLFDnOp4nOzo7sKg=; 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=38lg796UPVOzEWt3HaP6DdBpij4oUiZzCjhjGaWayq/e5ijEaCFWY2WE9ubko8axB ERgeb4CZu6AZLbPxDo7HfR/1aJ9ZbPX39nuSx4AWQJwovzH2HFCdwdnt4qiGqnWQ06 OfMgaDY5GVPg4gNA2ygxXoShqoN7xr7EyYsJWRbyPYuuOU5WAzbkl3ck1QmVtDmfCj /aMwdJ22v2JwKm0IR1Y+sQ8KGaUG6uLH0htzLSMHYA/4edKMQ7T2MSSEqmDO9iaMxh ClpOuppleenH2pNaPQ1X407sd04cfU86CVas1tEQVbRiF+WEUAPCCWrOmFUZ58e/Ul n5kI9uY7WKizQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2AEA361EE3 for ; Wed, 22 Feb 2023 16:19:30 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Lm1tpWmG"; dkim-atps=neutral Received: from uno.homenet.telecomitalia.it (host-87-16-53-160.retail.telecomitalia.it [87.16.53.160]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7D5B6FE8; Wed, 22 Feb 2023 16:19:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1677079169; bh=C1ZErz4UhUBjNkyBlbLOTUkRDyTmLFDnOp4nOzo7sKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lm1tpWmG8knYm6JXAD1VfU3ceJ0N/N6ig7TAPsitlD9aTObrSP9dOBCaNGHbN36cP 3vItRmS2eBfl8d+QEnmgmfdWis0pG+O8E23XXugQkBTdE0lRqCAa4oOpuYLrehpOo2 efv7PSmUOEmLQZXjV93IwTmNAHKK/PPIKZzTBe8M= To: libcamera-devel@lists.libcamera.org Date: Wed, 22 Feb 2023 16:19:15 +0100 Message-Id: <20230222151917.669526-3-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230222151917.669526-1-jacopo.mondi@ideasonboard.com> References: <20230222151917.669526-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 569fb8ecb629..05a7ba03b2d2 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -162,6 +162,8 @@ public: bool match(DeviceEnumerator *enumerator) override; private: + static constexpr Size kRkISP1PreviewSize = { 1920, 1080 }; + RkISP1CameraData *cameraData(Camera *camera) { return static_cast(camera->_d()); @@ -634,12 +636,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: @@ -649,12 +654,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: @@ -665,6 +674,7 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, } colorSpace = ColorSpace::Raw; + size = data->sensor_->resolution(); break; default: @@ -683,7 +693,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 Wed Feb 22 15:19:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18297 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 37CE4C329C for ; Wed, 22 Feb 2023 15:19:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5E64E62606; Wed, 22 Feb 2023 16:19:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1677079173; bh=xMSBikLF+V4AF0eVUPM2TQhcjRD1TgaaxnkoKUwYyNw=; 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=EpPWu4q9xDOABzwTfz/SYSePHL76KkXqdUntrzeVkKe2n+0d/Z/AtaHDeto21csRc TubbomCXAaaO/fhlhGFkcXs8sw15BW2JtFd4oH7UIxn5lTsM8trPIYpND8ijcKD5CH btuF+nl1eF/ThIaOoQJwpXexlt1jYVgs8znpaESj8Eef1Wy6H67FVmJQGexkdJbkDA qINvjqmRyX0H6e/WOX01UXJ98Iov+/v2UE6IvhrJCSnGvP2b3GSP5nzqolaSb+rdSe 6eDGYWZy0h0et8EPhUAgw5z4WimP/fJWs+CvrX9Pg98ccV9GJzMUveK/Y92L/mBRKI pazZCHjCmERIw== 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 E65D862606 for ; Wed, 22 Feb 2023 16:19:30 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Mmc+lX4r"; dkim-atps=neutral Received: from uno.homenet.telecomitalia.it (host-87-16-53-160.retail.telecomitalia.it [87.16.53.160]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 230831E7C; Wed, 22 Feb 2023 16:19:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1677079170; bh=xMSBikLF+V4AF0eVUPM2TQhcjRD1TgaaxnkoKUwYyNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mmc+lX4r1+a5vn5lv8mxhIlFAVW8MvxzUEZb6gneS9YDmQ7b0pMIEpex3c5caN8Ez zDJBKOLVyoiXbsATaW2zxtI0W81cXJPrxqpF0JN/0vlOqnH8vakwrvDKh2AqdKwGyt jIvs1CbIt2GKbfNa1OPiafDahkivY+RLxPQuaK6M= To: libcamera-devel@lists.libcamera.org Date: Wed, 22 Feb 2023 16:19:16 +0100 Message-Id: <20230222151917.669526-4-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230222151917.669526-1-jacopo.mondi@ideasonboard.com> References: <20230222151917.669526-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 05a7ba03b2d2..23ff859e3835 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -626,6 +626,16 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, if (roles.empty()) return config; + /* If still capture is requested, reserve the main path for it. */ + bool reserveMainPath = false; + for (const StreamRole role : roles) { + if (role != StreamRole::StillCapture) + continue; + + reserveMainPath = true; + break; + } + /* * 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 @@ -644,6 +654,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; @@ -685,7 +698,7 @@ PipelineHandlerRkISP1::generateConfiguration(Camera *camera, RkISP1Path *path; - if (useMainPath) { + if (useMainPath && !reserveMainPath) { path = data->mainPath_; mainPathAvailable = false; } else { From patchwork Wed Feb 22 15:19:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18298 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 33E4AC329D for ; Wed, 22 Feb 2023 15:19:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CEE6A62653; Wed, 22 Feb 2023 16:19:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1677079174; bh=Et2NTSDfUNPx5FFsms1sFNkh90eZg5g0TlDuO4bW2AA=; 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=Gbx2uLy6rqhRpIx+Tgy9wYaRiPLJxYx3mBJOo8D0QDDliVG760bKaZUtgWxdnIR17 G8H4x+5OgjKClDdgfBjjUj4vuceIhKOZDekN6tQyC7TjmYZmXbjFRXNNpNbGY945dt gfPMrPH0eEfaLOTIRWp01uHT8HITyxR1auJxyotlppVMx2oOAOxirtiqEQckXwwdVx VD5HFKWGObyvhjFnjKkuH5xNPH64oyQdhnzltQrAmBG1bLtDW1UQDX2edZEBTC0d/O MPR/CjWZK15w6tJj/QgQbx5Hs0qDSVo0bniYAo66G/FTfcbSmhUFm469qRjU/X2JOY Aq7ew2i1lfphg== 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 4A0BE62661 for ; Wed, 22 Feb 2023 16:19:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="MJ/ZXLJh"; dkim-atps=neutral Received: from uno.homenet.telecomitalia.it (host-87-16-53-160.retail.telecomitalia.it [87.16.53.160]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AAE022A4D; Wed, 22 Feb 2023 16:19:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1677079171; bh=Et2NTSDfUNPx5FFsms1sFNkh90eZg5g0TlDuO4bW2AA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MJ/ZXLJhRhzBzDcnN00VZ/85xNhpe1fdSVzLhpXeTnjMv9MrkFRCbnuLAHdX2evKK oOe5Ot4ECvy4cT09deVftCxv99VBIMF0YGIiQ+LXV65nTWtnuS0YRM07I/bZu/m5Jn k5BkTR4ktD0tWCeAN69diXgssjFW/wfpWLCh6jdc= To: libcamera-devel@lists.libcamera.org Date: Wed, 22 Feb 2023 16:19:17 +0100 Message-Id: <20230222151917.669526-5-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230222151917.669526-1-jacopo.mondi@ideasonboard.com> References: <20230222151917.669526-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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