[{"id":34316,"web_url":"https://patchwork.libcamera.org/comment/34316/","msgid":"<0375abba-52f1-400b-b6d5-ff5b0a31ee84@ideasonboard.com>","date":"2025-05-22T09:00:45","subject":"Re: [PATCH v5 07/12] libcamera: simple: Identify requested stream\n\troles","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n\n2025. 05. 20. 14:31 keltezéssel, Milan Zamazal írta:\n> Currently, raw streams don't work in the simple pipeline and the\n> requested stream roles are ignored.  In order to support raw streams, we\n> now track in SimpleCameraConfiguration whether raw and/or processed\n> streams are requested.  We also check that at most one raw stream is\n> requested, there is no reason to have more.\n> \n> That information will be used in the followup patches.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>   src/libcamera/pipeline/simple/simple.cpp | 19 ++++++++++++++++++-\n>   1 file changed, 18 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index d0f44c7d..78a76f34 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -378,6 +378,9 @@ public:\n>   \tbool needConversion() const { return needConversion_; }\n>   \tconst Transform &combinedTransform() const { return combinedTransform_; }\n>   \n> +\tbool processedRequested_;\n> +\tbool rawRequested_;\n> +\n>   private:\n>   \t/*\n>   \t * The SimpleCameraData instance is guaranteed to be valid as long as\n> @@ -1299,12 +1302,26 @@ std::unique_ptr<CameraConfiguration>\n>   SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRole> roles)\n>   {\n>   \tSimpleCameraData *data = cameraData(camera);\n> -\tstd::unique_ptr<CameraConfiguration> config =\n> +\tstd::unique_ptr<SimpleCameraConfiguration> config =\n>   \t\tstd::make_unique<SimpleCameraConfiguration>(camera, data);\n>   \n>   \tif (roles.empty())\n>   \t\treturn config;\n\nIn this case the new booleans are left uninitialized. There is also another potential\nissue: applications are allowed to call `generateConfiguration()` with an empty list of\nroles, and in that case I believe they are supposed to use `CameraConfiguration::addConfiguration()`\nto add the streams manually. I think you'll have to update these two in `validate()`,\nthe same way `needsConversion_` is updated there.\n\n\nRegards,\nBarnabás Pőcze\n\n>   \n> +\tconfig->processedRequested_ = false;\n> +\tconfig->rawRequested_ = false;\n> +\tfor (auto &role : roles)\n> +\t\tif (role == StreamRole::Raw) {\n> +\t\t\tif (config->rawRequested_) {\n> +\t\t\t\tLOG(SimplePipeline, Error)\n> +\t\t\t\t\t<< \"Can't capture multiple raw streams\";\n> +\t\t\t\treturn nullptr;\n> +\t\t\t}\n> +\t\t\tconfig->rawRequested_ = true;\n> +\t\t} else {\n> +\t\t\tconfig->processedRequested_ = true;\n> +\t\t}\n> +\n>   \t/* Create the formats map. */\n>   \tstd::map<PixelFormat, std::vector<SizeRange>> formats;\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 8F100C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 May 2025 09:00:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 188F168D92;\n\tThu, 22 May 2025 11:00:51 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5BF6B68D7A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 May 2025 11:00:49 +0200 (CEST)","from [192.168.33.22] (185.221.141.78.nat.pool.zt.hu\n\t[185.221.141.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C45ADC59;\n\tThu, 22 May 2025 11:00:26 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"uy6Tabpx\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1747904427;\n\tbh=5RjhFrwf3y9IptnPsUG3LYSlqMSQL/MhUY/2yRnxzTc=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=uy6TabpxxcbrLjmMXjFxKGD808WrjOOH+WA3zypAjTh8cNmx8OSiG/DC1nwD58+1k\n\tPXRdKk1IJj9JmcJdKsp3tAE6IEl0Psofcv3lWM/GbcXeKLgFf897bLdA+prFRP1WGI\n\tmgWuq05iLcKpOxSIKT13xEbsV6+6yV93o3iQBuiE=","Message-ID":"<0375abba-52f1-400b-b6d5-ff5b0a31ee84@ideasonboard.com>","Date":"Thu, 22 May 2025 11:00:45 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v5 07/12] libcamera: simple: Identify requested stream\n\troles","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Cc":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","References":"<20250520123158.44237-1-mzamazal@redhat.com>\n\t<20250520123158.44237-8-mzamazal@redhat.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20250520123158.44237-8-mzamazal@redhat.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]