[{"id":36668,"web_url":"https://patchwork.libcamera.org/comment/36668/","msgid":"<24571f93-7d97-492c-bd1a-9f47fa600335@ideasonboard.com>","date":"2025-11-03T15:54:40","subject":"Re: [PATCH v4 2/2] pipeline: imx8-isi: Delay ISI routes config to\n\tacquire() time","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. 11. 03. 15:03 keltezéssel, Antoine Bouyer írta:\n> From: Andrei Gansari <andrei.gansari@nxp.com>\n> \n> Fixes behavior when calling 'cam -l' during a live stream from a camera\n> in another process.\n> \n> Issue is that multiple process should be able to list (match procedure)\n> the camera supported. But only the unique process that lock the media\n> devices in order to be able to configure then start the pipeline should\n> setup the routes, graphs, etc.\n> \n> Thus, the setRouting() is to be moved to a PipelineHandlerISI::acquireDevice()\n> implementation to override the default Pipeline::acquireDevice() function.\n> \n> Fixes: 92df79112fb2 (\"pipeline: imx8-isi: Add multicamera support\")\n> Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>\n> Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>   src/libcamera/pipeline/imx8-isi/imx8-isi.cpp | 30 ++++++++++++++++----\n>   1 file changed, 24 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp\n> index de09431cb9b9..91541505e3ae 100644\n> --- a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp\n> +++ b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp\n> @@ -71,6 +71,8 @@ public:\n>   \n>   \tunsigned int xbarSink_ = 0;\n>   \tunsigned int xbarSourceOffset_ = 0;\n> +\n> +\tconst std::string &cameraName() const { return sensor_->entity()->name(); }\n>   };\n>   \n>   class ISICameraConfiguration : public CameraConfiguration\n> @@ -117,6 +119,8 @@ protected:\n>   \n>   \tint queueRequestDevice(Camera *camera, Request *request) override;\n>   \n> +\tbool acquireDevice(Camera *camera) override;\n> +\n>   private:\n>   \tstatic constexpr Size kPreviewSize = { 1920, 1080 };\n>   \tstatic constexpr Size kMinISISize = { 1, 1 };\n> @@ -143,6 +147,8 @@ private:\n>   \n>   \tstd::unique_ptr<V4L2Subdevice> crossbar_;\n>   \tstd::vector<Pipe> pipes_;\n> +\n> +\tV4L2Subdevice::Routing routing_ = {};\n>   };\n>   \n>   /* -----------------------------------------------------------------------------\n> @@ -950,6 +956,23 @@ int PipelineHandlerISI::queueRequestDevice(Camera *camera, Request *request)\n>   \treturn 0;\n>   }\n>   \n> +bool PipelineHandlerISI::acquireDevice(Camera *camera)\n> +{\n> +\tISICameraData *data = cameraData(camera);\n> +\n> +\tLOG(ISI, Debug) << \"acquireDevice \" << data->cameraName()\n> +\t\t\t<< \" count \" << useCount();\n\nI think this should be moved into `PipelineHandler::acquire()`\nif you want to log this. I suppose it probably makes sense to\nadd a similar message to `PipelineHandler::release()` as well.\n\n\n> +\n> +\tif (useCount() == 0) {\n> +\t\t/* Enable routing for all available sensors once */\n> +\t\tint ret = crossbar_->setRouting(&routing_, V4L2Subdevice::ActiveFormat);\n> +\t\tif (ret)\n> +\t\t\treturn false;\n> +\t}\n> +\n> +\treturn true;\n> +}\n> [...]\n\n\nRegards,\nBarnabás Pőcze","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 36FAFBDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Nov 2025 15:54:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5AD74609D8;\n\tMon,  3 Nov 2025 16:54:46 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7C925606A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Nov 2025 16:54:44 +0100 (CET)","from [192.168.33.39] (185.221.140.239.nat.pool.zt.hu\n\t[185.221.140.239])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4EAC4C73;\n\tMon,  3 Nov 2025 16:52:51 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"au3ESpdG\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762185171;\n\tbh=T9ussUp1pk0pIGrZNl0BGhhbZZ3hIP+cJqaQ/t6U474=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=au3ESpdGBd2B9BcU67MJsfAok9ntQP08rSjNroZzKb/xdMIvLNiEKZ+8b0b9cXzTZ\n\tFf4NbdErAzBZs7mU+RRg2CPyp3UMnYHHWLY2EJv36qx/mS8eVPwW3ELTnRlfAjuKQK\n\ttFbs5fIRBlSMEzV4tP5mOIfjGBjN7SrwwTInpWEM=","Message-ID":"<24571f93-7d97-492c-bd1a-9f47fa600335@ideasonboard.com>","Date":"Mon, 3 Nov 2025 16:54:40 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v4 2/2] pipeline: imx8-isi: Delay ISI routes config to\n\tacquire() time","To":"Antoine Bouyer <antoine.bouyer@nxp.com>,\n\tlibcamera-devel@lists.libcamera.org","Cc":"julien.vuillaumier@nxp.com, Andrei Gansari <andrei.gansari@nxp.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20251103140325.88535-1-antoine.bouyer@nxp.com>\n\t<20251103140325.88535-3-antoine.bouyer@nxp.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20251103140325.88535-3-antoine.bouyer@nxp.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>"}}]