From patchwork Wed Jul 16 14:20:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 23822 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 A9367C3237 for ; Wed, 16 Jul 2025 14:20:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4931B68F6A; Wed, 16 Jul 2025 16:20:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="TopTQ4Gh"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D76DE68F35 for ; Wed, 16 Jul 2025 16:20:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=9VZdOFfGmvs9e0K84SjEmfwrVV97MyVAnBjtT6x6T+8=; b=TopTQ4Gh4CvfEVjRiDWEW3esHM yqSuhcxrzfUVYlFAAS+pSQMA9DNBwE/TL8rkXfW7i16kflOhfkd71burz/6XVB8quZciiMr9GbLvZ 0HJBPHGQyDW3pQtC8d0SOHJmSs7g5LNfmhlb3vPbSPTegNHFYPv2zsJ0aJFyes+DsBfAj+bc2o+an FZgdA6X98ZEYv/RUzEC075isgoou0GZJ/udiAIKRTOOrIgf65SDoIqf+jiV2T0iJwYHn85/TSG2Ww WRP67DP+f6A2RhPE2+l0Xn88MM7iCO3/K+YZRZPEwoJSfv6fXbnEwDxpIMRmXeervmAxfEujhIXG3 R6IW2b1A==; Received: from [49.36.69.57] (helo=uajain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uc2ze-00HLf5-Py; Wed, 16 Jul 2025 16:20:23 +0200 From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Robert Mader , Umang Jain Subject: [RFC PATCH 1/6] libcamera: simple: Set the number of software ISP streams to 2 Date: Wed, 16 Jul 2025 19:50:21 +0530 Message-ID: <20250716142027.236277-2-uajain@igalia.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250716142027.236277-1-uajain@igalia.com> References: <20250716142027.236277-1-uajain@igalia.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" From: Milan Zamazal When software ISP is enabled, we want to be able to provide a raw stream in addition to the processed stream. For this purpose, we need two streams. If only the processed stream is requested, it doesn't harm to allocate two. This is a hack for the lack of a better easy option. The number of streams is determined as a camera property in the pipeline matching. The actual number of streams needed (one or two) is determined only when examining roles in SimplePipelineHandler::generateConfiguration. In theory, software ISP could produce multiple processed streams but this is out of scope of this patch series. Hence two streams are sufficient at the moment. When software ISP is not enabled, the camera won't be able to produce multiple streams (assuming there's no hardware converter) and only single stream should be allocated as before. The simple pipeline handler assumes there's a linear pipeline from the camera sensor to a video capture device, and only supports a single stream. Branches in the hardware pipeline that would allow capturing multiple streams from the same camera sensor are not supported. We have no plan to change that, as a device that can produce multiple streams will likely be better supported by a dedicated pipeline handler. Signed-off-by: Milan Zamazal Signed-off-by: Umang Jain --- src/libcamera/pipeline/simple/simple.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index efb07051..de6b29ab 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1265,7 +1265,7 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate() */ SimplePipelineHandler::SimplePipelineHandler(CameraManager *manager) - : PipelineHandler(manager), converter_(nullptr) + : PipelineHandler(manager), converter_(nullptr), swIspEnabled_(false) { } @@ -1687,7 +1687,16 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator) } } - swIspEnabled_ = info->swIspEnabled; + if (info->swIspEnabled) { + /* + * When the software ISP is enabled, the simple pipeline handler + * exposes the raw stream, giving a total of two streams. This + * is mutally exclusive with the presence of a converter. + */ + ASSERT(!converter_); + numStreams = 2; + swIspEnabled_ = true; + } /* Locate the sensors. */ std::vector sensors = locateSensors(media); From patchwork Wed Jul 16 14:20:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 23823 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 08941C3237 for ; Wed, 16 Jul 2025 14:20:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DB55768F74; Wed, 16 Jul 2025 16:20:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="UmmJ4yqT"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1310B68F61 for ; Wed, 16 Jul 2025 16:20:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=nDVr/i+s2Bh6DsppBfogTES1E9aj8Nr+6C1Z+bEr8AE=; b=UmmJ4yqTbjpLZ9qjN/m3WG8YsL nBu0ulhOuS+DPj1SAj7kVU67YG2Gu80sfrW4DP+fGmonVRfjhNgtJo0218/MkO0qXWqobnFlPEYSk w6MRB+SWhnBW46Ogt+cxEb84Mu4r61EtbnMfBcQ/u1Gv9Xe+flySWJplZ08940ygbk+wQCQmVRQUg n/6ylst7YBZDBlsmvnm10oGlJwg0oFWfFkSkF0cM5pazP/v6eA28PbSTfWBJX8+lWGqO9V2xgmGEV MqSzEKB+zO0dwm5DLGvcmXnCz6/1lCFAw+1hlr5KviuSGx/15IE5Zs7HXhsJNK/3XLbZzqSXentlm BgznnLiQ==; Received: from [49.36.69.57] (helo=uajain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uc2zg-00HLf5-3b; Wed, 16 Jul 2025 16:20:24 +0200 From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Robert Mader , Umang Jain Subject: [RFC PATCH 2/6] libcamera: simple: Exclude raw configurations from output conversions Date: Wed, 16 Jul 2025 19:50:22 +0530 Message-ID: <20250716142027.236277-3-uajain@igalia.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250716142027.236277-1-uajain@igalia.com> References: <20250716142027.236277-1-uajain@igalia.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" From: Milan Zamazal In order to support raw streams, we need to add raw formats to software ISP configurations. In this preparatory patch, the raw formats are excluded from output configurations for conversions. Signed-off-by: Milan Zamazal Reviewed-by: Umang Jain --- src/libcamera/pipeline/simple/simple.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index de6b29ab..cadc1117 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -259,6 +260,12 @@ static const SimplePipelineInfo supportedDevices[] = { { "sun6i-csi", {}, false }, }; +bool isFormatRaw(const libcamera::PixelFormat &pixFmt) +{ + return libcamera::PixelFormatInfo::info(pixFmt).colourEncoding == + libcamera::PixelFormatInfo::ColourEncodingRAW; +} + } /* namespace */ class SimpleCameraData : public Camera::Private @@ -1388,7 +1395,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) cfg.setStream(&data->streams_[i]); - if (data->useConversion_) + if (data->useConversion_ && !isFormatRaw(cfg.pixelFormat)) outputCfgs.push_back(cfg); } From patchwork Wed Jul 16 14:20:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 23824 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 52E76C3237 for ; Wed, 16 Jul 2025 14:20:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 20EED68F7F; Wed, 16 Jul 2025 16:20:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="LzcNZuJM"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 51B5068F61 for ; Wed, 16 Jul 2025 16:20:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=etVhYdqh6LyXoRuJ2CwOvKldi5x18r3Wrrk+FbwMZFk=; b=LzcNZuJMJTiW7zjcHtEmQ1MC3h ZvLtbuBDIdAtuYWtzkmk8kmXwkeLvyJGkXc2o5oHu8/Jwa7yVfOwO56IBUTtY35W6+4Hw124u32oZ KoEahgjAvrPWqsCDCEnKLclzn5wCM0J4pCnI6p4zBiajCjaw2ke2KZTHpmwCGFjqectWhXa8lstvZ Q+PEoU78t8yzXOgE6bHdgtqrpgCvjPKJRLN4nCNGYQfEzw35T/wQUIDYgPXknC9IguBSBUO7tKVS8 B1ZgEW1lNCmMMrO99+G5JSpeuL2dg4p9vgAPdMfCQMq0cDQ6kvk6CUTE/oguH5VrXTCAJ0rdRg9uV 9OTauKWg==; Received: from [49.36.69.57] (helo=uajain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uc2zh-00HLf5-Di; Wed, 16 Jul 2025 16:20:25 +0200 From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Robert Mader , Umang Jain Subject: [RFC PATCH 3/6] libcamera: simple: Support StreamRole::Raw in generateConfiguration() Date: Wed, 16 Jul 2025 19:50:23 +0530 Message-ID: <20250716142027.236277-4-uajain@igalia.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250716142027.236277-1-uajain@igalia.com> References: <20250716142027.236277-1-uajain@igalia.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" Add stream role support for raw stream in generateConfiguration. If multiple raw streams are requested, make sure to invalidate them accordingly in validate(). Currently, only one raw stream per camera configuration is allowed. In order to get access to the raw formats supported by the sensor, one would require to iterate over SimpleCameraData::formats_ map in generateConfiguration(). This map not only include output configuration pixel formats but also the raw format configuration that can be produced (for raw roles). Signed-off-by: Umang Jain --- src/libcamera/pipeline/simple/simple.cpp | 50 ++++++++++++++++++++---- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index cadc1117..d6c92391 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1128,6 +1128,23 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate() LOG(SimplePipeline, Debug) << "Largest stream size is " << maxStreamSize; + /* Cap the number of raw stream configuration */ + unsigned int rawCount = 0; + PixelFormat requestedRawFormat; + for (const StreamConfiguration &cfg : config_) { + if (!isFormatRaw(cfg.pixelFormat)) + continue; + requestedRawFormat = cfg.pixelFormat; + rawCount++; + } + + if (rawCount > 1) { + LOG(SimplePipeline, Error) + << "Camera configuration with " + << rawCount << " raw streams not supported"; + return Invalid; + } + /* * Find the best configuration for the pipeline using a heuristic. * First select the pixel format based on the streams (which are @@ -1289,9 +1306,9 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span> formats; - for (const SimpleCameraData::Configuration &cfg : data->configs_) { - for (PixelFormat format : cfg.outputFormats) - formats[format].push_back(cfg.outputSizes); + for (const auto &it : data->formats_) { + for (const SimpleCameraData::Configuration *cfg : it.second) + formats[it.first].push_back(cfg->outputSizes); } /* Sort the sizes and merge any consecutive overlapping ranges. */ @@ -1317,14 +1334,33 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Spanfirst; - cfg.size = formats.begin()->second[0].max; + + switch (role) { + case StreamRole::Raw: + for (auto &[format, sizes] : formats) { + if (!isFormatRaw(format)) + continue; + cfg.pixelFormat = format; + cfg.size = sizes.back().max; + cfg.colorSpace = ColorSpace::Raw; + break; + } + break; + default: + for (auto &[format, sizes] : formats) { + if (isFormatRaw(format)) + continue; + cfg.pixelFormat = format; + cfg.size = sizes[0].max; + } + } config->addConfiguration(cfg); } From patchwork Wed Jul 16 14:20:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 23825 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 55190C32C8 for ; Wed, 16 Jul 2025 14:20:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D00C368F81; Wed, 16 Jul 2025 16:20:31 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="O9cJCLtD"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A6F8268F6E for ; Wed, 16 Jul 2025 16:20:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=9OZ41oDWYbu+b0piOe7uvPxGpJtW+hbDuA3SKY1xXSI=; b=O9cJCLtDDlk4NBJ2kfXVqxQSJ/ k31RTHgRVeMlEeoAFoE5VEQgNdFESlOlVC+6Bm1tWs7e0dd/PAHGzhMJS3mg1mn1ZwAyIjbXlwnot X/rk8jEQZsXCy8OjysTjXaJSqpduhuBhUTvWEla4KshhRtCHOyHZWxzVqn4DnGWjzxRIGLnzWFrtG eVW5pTWnaRUjapDQRZ7oIJuYZu/yDDEBIS0D7sVN3Gx2A0rmQDrh2HcyLoefX3/VTHryKNbPMc67z CJcp40UA6lC4DNQBYaLOZQpF3iGyGk6DnOdkD/GJIh7x/F+GFveag31qIhCU6iycO2WAzXLjCewZC fEvG7hFA==; Received: from [49.36.69.57] (helo=uajain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uc2zi-00HLf5-Nn; Wed, 16 Jul 2025 16:20:27 +0200 From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Robert Mader , Umang Jain Subject: [RFC PATCH 4/6] libcamera: simple: Validate raw streams if requested Date: Wed, 16 Jul 2025 19:50:24 +0530 Message-ID: <20250716142027.236277-5-uajain@igalia.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250716142027.236277-1-uajain@igalia.com> References: <20250716142027.236277-1-uajain@igalia.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" Validate the raw streams if requested in the camera configuration. Initially check for a raw stream request and find a [format, size] that can satisfy that. Adjust the raw stream accordingly to the pipeline configuration (pipeConfig_), if necessary. Signed-off-by: Umang Jain --- src/libcamera/pipeline/simple/simple.cpp | 44 +++++++++++++++++------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index d6c92391..1dccfbb1 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1147,19 +1147,24 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate() /* * Find the best configuration for the pipeline using a heuristic. - * First select the pixel format based on the streams (which are - * considered ordered from highest to lowest priority). Default to the - * first pipeline configuration if no streams request a supported pixel - * format. + * First select the pixel format based on the raw streams followed by + * non-raw streams (which are considered ordered from highest to lowest + * priority). Default to the first pipeline configuration if no streams + * request a supported pixel format. */ const std::vector *configs = &data_->formats_.begin()->second; - for (const StreamConfiguration &cfg : config_) { - auto it = data_->formats_.find(cfg.pixelFormat); - if (it != data_->formats_.end()) { - configs = &it->second; - break; + auto rawIter = data_->formats_.find(requestedRawFormat); + if (rawIter != data_->formats_.end()) { + configs = &rawIter->second; + } else { + for (const StreamConfiguration &cfg : config_) { + auto it = data_->formats_.find(cfg.pixelFormat); + if (it != data_->formats_.end()) { + configs = &it->second; + break; + } } } @@ -1218,8 +1223,23 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate() for (unsigned int i = 0; i < config_.size(); ++i) { StreamConfiguration &cfg = config_[i]; + const bool raw = isFormatRaw(cfg.pixelFormat); + + /* Adjust the raw pixel format and size. */ + if (raw) { + if (cfg.pixelFormat != pipeConfig_->captureFormat || + cfg.size != pipeConfig_->captureSize) { + cfg.pixelFormat = pipeConfig_->captureFormat; + cfg.size = pipeConfig_->captureSize; + + LOG(SimplePipeline, Debug) + << "Adjusting raw stream to " + << cfg.toString(); + status = Adjusted; + } + } - /* Adjust the pixel format and size. */ + /* Adjust the non-raw pixel format and size. */ auto it = std::find(pipeConfig_->outputFormats.begin(), pipeConfig_->outputFormats.end(), cfg.pixelFormat); @@ -1227,13 +1247,13 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate() it = pipeConfig_->outputFormats.begin(); PixelFormat pixelFormat = *it; - if (cfg.pixelFormat != pixelFormat) { + if (!raw && cfg.pixelFormat != pixelFormat) { LOG(SimplePipeline, Debug) << "Adjusting pixel format"; cfg.pixelFormat = pixelFormat; status = Adjusted; } - if (!pipeConfig_->outputSizes.contains(cfg.size)) { + if (!raw && !pipeConfig_->outputSizes.contains(cfg.size)) { Size adjustedSize = pipeConfig_->captureSize; /* * The converter (when present) may not be able to output From patchwork Wed Jul 16 14:20:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 23826 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 5AC5AC3237 for ; Wed, 16 Jul 2025 14:20:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EC08E68F84; Wed, 16 Jul 2025 16:20:32 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="BJjYKQCc"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C4D0C68F71 for ; Wed, 16 Jul 2025 16:20:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=e5oieVphXTG/5OXatTPAesu9MMTgwZveR+uHZ30m/vM=; b=BJjYKQCcbmKjDhaMPorI2wPyeg WB1F+QwcqlsEftbWfgl5sTmhtNHx/HjCNeKQoAjE22Fx1L8nf2v77tPriB2iPFVPq4s2eO3HFnBX+ ccSolEcQUaxgSyK70gxco5QrueYieP9k8dhu2DIb7aLpyrGOKJO78FdQT9jf/ic5aHUVjMEwy4p6i /RjkBRNYtRqqRH1nbto3DU21rpUw+IVb1A1QaKz7kQCvyZ/bKYBs+RcbN5u1EL++ZWF9FluGIESwZ +TStN5MR66hz1V0wU2eXqCd927V6JkGK5aiOFdZMHCFCsE8sez28tCrnGjvi/ME/fQgtJcit3hqLr qUqimYnQ==; Received: from [49.36.69.57] (helo=uajain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uc2zj-00HLf5-SS; Wed, 16 Jul 2025 16:20:28 +0200 From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Robert Mader Subject: [RFC PATCH 5/6] libcamera: simple: Require metadata only when software ISP is used Date: Wed, 16 Jul 2025 19:50:25 +0530 Message-ID: <20250716142027.236277-6-uajain@igalia.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250716142027.236277-1-uajain@igalia.com> References: <20250716142027.236277-1-uajain@igalia.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" From: Milan Zamazal If software ISP is enabled then metadata is required in the simple pipeline. But this doesn't apply if the software ISP is not actually used, for example when only a raw stream is produced. Then the pipeline waits for metadata that never comes. This patch fixes the problem by requiring metadata only when software ISP is used. Signed-off-by: Milan Zamazal --- src/libcamera/pipeline/simple/simple.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 1dccfbb1..75469e3a 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1600,6 +1600,7 @@ int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request) int ret; std::map buffers; + bool metadataRequired = false; for (auto &[stream, buffer] : request->buffers()) { /* @@ -1609,6 +1610,7 @@ int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request) */ if (data->useConversion_) { buffers.emplace(stream, buffer); + metadataRequired = !!data->swIsp_; } else { ret = data->video_->queueBuffer(buffer); if (ret < 0) @@ -1616,7 +1618,7 @@ int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request) } } - data->frameInfo_.create(request, !!data->swIsp_); + data->frameInfo_.create(request, metadataRequired); if (data->useConversion_) { data->conversionQueue_.push({ request, std::move(buffers) }); if (data->swIsp_) From patchwork Wed Jul 16 14:20:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 23827 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 7A5ACC32C8 for ; Wed, 16 Jul 2025 14:20:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 35C5168F7C; Wed, 16 Jul 2025 16:20:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="Xkafhuo8"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EC5F268F7B for ; Wed, 16 Jul 2025 16:20:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=TjL83E+UdIvdY2AoEcOvWpot3xCdSfPMAKLlCnsEt8o=; b=Xkafhuo83prQaEMRkv7vjkFDSA oyxYNm1IyoFCkC6pjpoeUD7/fmnOXpYdikaTPbMaBNxj6cK3Y3DE2uqOADC6hPNdPm2K2yOFUBE7f /OPc8T5ulVPmLh+S7blAR4T0J8MXyyGu6CAVt6Cb7ZHrhgU9gcfPvI6yb6TbdxKIwi52rjxcrwJS9 Zpv1ZYMDei9ZvqbO+XfGZ6xk7l69+/0ZEKrSLncr6H7YJMowB9bwXFBVKlCrWEGCHmXev3p28D8cP nYgvVZ/8ypngsOWzfsnwJwEDnEDpgIXKBuCRru/evJ6XNYwAK8xMHLfkO104Ah/8eyQ+Wi1PvyKb5 vDhgSbhg==; Received: from [49.36.69.57] (helo=uajain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uc2zl-00HLf5-0r; Wed, 16 Jul 2025 16:20:29 +0200 From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Robert Mader Subject: [PATCH 6/6] DNI: simple: Log data->useConversion_ Date: Wed, 16 Jul 2025 19:50:26 +0530 Message-ID: <20250716142027.236277-7-uajain@igalia.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250716142027.236277-1-uajain@igalia.com> References: <20250716142027.236277-1-uajain@igalia.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" From: Milan Zamazal --- src/libcamera/pipeline/simple/simple.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 4c11ac4a..c45e7c86 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1439,6 +1439,8 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) std::vector> outputCfgs; data->useConversion_ = config->needConversion(); + LOG(SimplePipeline, Error) << "Use conversion or not : " << data->useConversion_; + for (unsigned int i = 0; i < config->size(); ++i) { StreamConfiguration &cfg = config->at(i);