[{"id":34170,"web_url":"https://patchwork.libcamera.org/comment/34170/","msgid":"<970c6849-ff19-4d43-8810-82b120f1ba8b@ideasonboard.com>","date":"2025-05-09T15:21:40","subject":"Re: [PATCH v4 06/11] 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\n2025. 04. 07. 10:56 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 SimpleCameraData whether raw and/or processed streams are\n> requested.  We also check that at most one raw stream is requested,\n> 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 | 16 ++++++++++++++++\n>   1 file changed, 16 insertions(+)\n> \n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 82d7a9a5..bf9d75f4 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -345,6 +345,8 @@ public:\n>   \t};\n>   \tstd::queue<RequestOutputs> conversionQueue_;\n>   \tbool useConversion_;\n> +\tbool processedRequested_;\n> +\tbool rawRequested_;\n>   \n>   \tstd::unique_ptr<Converter> converter_;\n>   \tstd::unique_ptr<SoftwareIsp> swIsp_;\n> @@ -1305,6 +1307,20 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo\n>   \tif (roles.empty())\n>   \t\treturn config;\n>   \n> +\tdata->processedRequested_ = false;\n> +\tdata->rawRequested_ = false;\n\nI am not sure if `generateConfiguration()` should modify the state of the\ncamera. It does not seem to be compatible with e.g an application caching\nmultiple desired configurations. But crucially, the `generateConfiguration()`\nmethod, in contrast to most other similar methods, runs in the caller's thread,\nand does not run in the camera manager's private thread. (I am not sure if this\nis just an oversight or intentional.)\n\nSo these two flags should probably be stored in `SimpleCameraConfiguration`,\nand copied into `SimpleCameraData` after a successful `configure()`. Similarly\nto `useConversion_`, as far as I can tell.\n\n\nRegards,\nBarnabás Pőcze\n\n\n> +\tfor (auto &role : roles)\n> +\t\tif (role == StreamRole::Raw) {\n> +\t\t\tif (data->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\tdata->rawRequested_ = true;\n> +\t\t} else {\n> +\t\t\tdata->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 1B0EFC3200\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  9 May 2025 15:21:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2758268B4D;\n\tFri,  9 May 2025 17:21:46 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D159F617C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  9 May 2025 17:21:44 +0200 (CEST)","from [192.168.33.12] (185.221.140.100.nat.pool.zt.hu\n\t[185.221.140.100])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 977908DB;\n\tFri,  9 May 2025 17:21:31 +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=\"tQg0OwtB\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1746804091;\n\tbh=fZ0L6H9gRUwIgxMEIbhJeH4mwcMh9c0sE8As8/oNdps=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=tQg0OwtBdMtEz9+/0Vd1KB3SLCewQNa71IEPTqM2g7TLBypDR6oFFD9hXL3D59i5J\n\tvH/B/ldpMTDgySj26jUyWlyfz+wKo0YWpvB80I60opuHV9EUxZzsOp1LaMNSrX3ewK\n\tQjyxTPi6dXwceVE9Hb9WqAE9+nRixFVCp4kSjHxo=","Message-ID":"<970c6849-ff19-4d43-8810-82b120f1ba8b@ideasonboard.com>","Date":"Fri, 9 May 2025 17:21:40 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v4 06/11] libcamera: simple: Identify requested stream\n\troles","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20250407085639.16180-1-mzamazal@redhat.com>\n\t<20250407085639.16180-7-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":"<20250407085639.16180-7-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>"}},{"id":34219,"web_url":"https://patchwork.libcamera.org/comment/34219/","msgid":"<85frh8j05q.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-05-13T10:05:37","subject":"Re: [PATCH v4 06/11] libcamera: simple: Identify requested stream\n\troles","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Barnabás,\n\nthank you for review.\n\nBarnabás Pőcze <barnabas.pocze@ideasonboard.com> writes:\n\n> Hi\n>\n> 2025. 04. 07. 10:56 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 SimpleCameraData whether raw and/or processed streams are\n>> requested.  We also check that at most one raw stream is requested,\n>> there is no reason to have more.\n>> That information will be used in the followup patches.\n>> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>> ---\n>>   src/libcamera/pipeline/simple/simple.cpp | 16 ++++++++++++++++\n>>   1 file changed, 16 insertions(+)\n>> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n>> index 82d7a9a5..bf9d75f4 100644\n>> --- a/src/libcamera/pipeline/simple/simple.cpp\n>> +++ b/src/libcamera/pipeline/simple/simple.cpp\n>> @@ -345,6 +345,8 @@ public:\n>>   \t};\n>>   \tstd::queue<RequestOutputs> conversionQueue_;\n>>   \tbool useConversion_;\n>> +\tbool processedRequested_;\n>> +\tbool rawRequested_;\n>>     \tstd::unique_ptr<Converter> converter_;\n>>   \tstd::unique_ptr<SoftwareIsp> swIsp_;\n>> @@ -1305,6 +1307,20 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo\n>>   \tif (roles.empty())\n>>   \t\treturn config;\n>>   +\tdata->processedRequested_ = false;\n>> +\tdata->rawRequested_ = false;\n>\n> I am not sure if `generateConfiguration()` should modify the state of the\n> camera. It does not seem to be compatible with e.g an application caching\n> multiple desired configurations. But crucially, the `generateConfiguration()`\n> method, in contrast to most other similar methods, runs in the caller's thread,\n> and does not run in the camera manager's private thread. (I am not sure if this\n> is just an oversight or intentional.)\n>\n> So these two flags should probably be stored in `SimpleCameraConfiguration`,\n> and copied into `SimpleCameraData` after a successful `configure()`. Similarly\n> to `useConversion_`, as far as I can tell.\n\nGood point, I'll try to rework it.  As for the thread, I don't know.\n\n> Regards,\n> Barnabás Pőcze\n>\n>\n>> +\tfor (auto &role : roles)\n>> +\t\tif (role == StreamRole::Raw) {\n>> +\t\t\tif (data->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\tdata->rawRequested_ = true;\n>> +\t\t} else {\n>> +\t\t\tdata->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 1CC48C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 May 2025 10:05:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2D2F468B59;\n\tTue, 13 May 2025 12:05:44 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3EA736175C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 May 2025 12:05:43 +0200 (CEST)","from mail-wm1-f71.google.com (mail-wm1-f71.google.com\n\t[209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-640-hQgcgAYQPUuVpTAGTvGL1w-1; Tue, 13 May 2025 06:05:40 -0400","by mail-wm1-f71.google.com with SMTP id\n\t5b1f17b1804b1-43cec217977so26981125e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 May 2025 03:05:40 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb ([85.93.96.130])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-3a1f57ddfbesm15863818f8f.10.2025.05.13.03.05.37\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 13 May 2025 03:05:37 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"WOM8s2R0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1747130742;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=UF5xdi5nSgBQgScI65ZRfTXffFNDy43234CLuLUasuc=;\n\tb=WOM8s2R0+eceOZ/MbP/YQxS1CAL46DSJxEr4hNW/uhZIFRZlTwTWDdGp2JOw0N+EFG6OE9\n\t9wS60HxIP9ITAh1CKih7hMSXmxdSHEcM34RuwWiLlPt1yOcgB1AmX94NEzDkl1n5ibjhrb\n\tJSWTI7gJAyO2mBkV5SdVjRLkGuc+K+k=","X-MC-Unique":"hQgcgAYQPUuVpTAGTvGL1w-1","X-Mimecast-MFC-AGG-ID":"hQgcgAYQPUuVpTAGTvGL1w_1747130739","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1747130739; x=1747735539;\n\th=content-transfer-encoding:mime-version:user-agent:message-id:date\n\t:references:in-reply-to:subject:cc:to:from:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=h6jfR9ogxoKoiR1/6wSUG7OHXRtq7Virt2Q/niF/rIs=;\n\tb=DN4KZcRtVyMHaM9zcoSnvOqIQh/+nk8gJs2L8uipNUOV+x1v0e9tzgPn1WNZF/KlHU\n\tTUBsl7hf4aYqWJlgyRq4LAZyo5c1DmCE2BiO0EWwbK8NHrz2+AWajs/B5nFlrFuZC6Fs\n\tlIll/u+ti+mx+hyCfkl7Xign/FSWq4ZRq/oO9rHNB2bg385NrAjJUreCzMslEh32ZosH\n\tUOhFNgHI0SKftyfkq+Sl4Iok3C5gch92v6yoLMBUzqZi19tqHs5jTs24pTI/IQ30+2u3\n\tTc2U2HrSnDruPHB7Bt5BdqE/+4N66VdU7aA0JFgsV6a/iHKVuVix3Pnfaqs7wUnUWbuY\n\tDYkg==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCWNsad9LOWMIV55W6cp3WtWvfBXYvfvi3jqCr0JGXc5QLupx3KJhWs00L59CW9VPMyyc26qCzaL7T1xlxXCR94=@lists.libcamera.org","X-Gm-Message-State":"AOJu0YwdZmv/TxS4imVn0TG2fwiNDIW4yGMEG7TADcARqa+iLY8TF+Xh\n\t4tu8Qas31YyEqvtMX8KUuY8oqHuVvqGI4TIwOudzUF9Labm5JiAocfguY03Ko6D23nCBCWLEyWz\n\trsxP1PuVFeIhWho4kxt3UPKxCCVUrNVNXjAnpoYtrMRVVWrNWHlsdVnrnIeCRmt6mjpgac+YSU6\n\th/LPzH6ryFUhTANSR5+Vc23RBLPsHLXHvk+G4pLyOK4BZInMFjST+R9KM=","X-Gm-Gg":"ASbGncv5otyWC4wM6Gy8ZIUm5In44ZiuFnNLg4VgdGgGaGtGDKMBrAhAGeylH4gHlaD\n\tx0kBjHMoeDdSsZXH/uA0tKhTKycluW+C8LdfpI/k1xc6/GnUfj+U+G64NRIehq1ZG6lSELoZ4bi\n\twdBBrvJ0oyB6yTi6UZLVR20qdS1/m31M7x3/gpWX4Rldng213xgZ0883e3DDvcX8mbvIsfaUgJ+\n\te7JNuuCgVZN1K+sMW1GwSm9+8pEt8nZ/V2NRR/Khnyk1H2NxZevZlfzBRgGSIY3Vmr1wFOBz2z2\n\tcY6WkOJ5717zEvkhTBDpl6QrYPb7FN/NTQ4f","X-Received":["by 2002:a05:6000:2909:b0:391:2f15:c1f4 with SMTP id\n\tffacd0b85a97d-3a1f64f16abmr14515314f8f.55.1747130738766; \n\tTue, 13 May 2025 03:05:38 -0700 (PDT)","by 2002:a05:6000:2909:b0:391:2f15:c1f4 with SMTP id\n\tffacd0b85a97d-3a1f64f16abmr14515280f8f.55.1747130738348; \n\tTue, 13 May 2025 03:05:38 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IFaNCuU14oXbP1fj0aVLb5j2OPob+s5vhFjQZm9WWdPIdeRVP2K7NNEkdvDdyryneTywajDBg==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,  Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>, libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v4 06/11] libcamera: simple: Identify requested stream\n\troles","In-Reply-To":"<970c6849-ff19-4d43-8810-82b120f1ba8b@ideasonboard.com> (\n\t=?utf-8?b?IkJhcm5hYsOhcyBQxZFjemUiJ3M=?= message of \"Fri,\n\t9 May 2025  17:21:40 +0200\")","References":"<20250407085639.16180-1-mzamazal@redhat.com>\n\t<20250407085639.16180-7-mzamazal@redhat.com>\n\t<970c6849-ff19-4d43-8810-82b120f1ba8b@ideasonboard.com>","Date":"Tue, 13 May 2025 12:05:37 +0200","Message-ID":"<85frh8j05q.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"o9-4jagmrOV0WAajhroba-tNf6-5cvSV02sLvTCgy5g_1747130739","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","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>"}}]