[{"id":36673,"web_url":"https://patchwork.libcamera.org/comment/36673/","msgid":"<bb4f5d3c-355b-4c40-839f-6b8c52343291@ideasonboard.com>","date":"2025-11-04T11:33:13","subject":"Re: [PATCH v5 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. 04. 8:56 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 | 26 +++++++++++++++-----\n>   1 file changed, 20 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..ce8d0b35a2a7 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\nNot needed anymore. But this can be removed while applying.\n\nOtherwise looks good to me.\n\nReviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\n\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,19 @@ int PipelineHandlerISI::queueRequestDevice(Camera *camera, Request *request)\n>   \treturn 0;\n>   }\n>   \n> +bool PipelineHandlerISI::acquireDevice([[maybe_unused]] Camera *camera)\n> +{\n> +\tif (useCount() > 0)\n> +\t\treturn true;\n> +\n> +\t/* Enable routing for all available sensors once */\n> +\tint ret = crossbar_->setRouting(&routing_, V4L2Subdevice::ActiveFormat);\n> +\tif (ret)\n> +\t\treturn false;\n> +\n> +\treturn true;\n> +}\n> +\n>   bool PipelineHandlerISI::match(DeviceEnumerator *enumerator)\n>   {\n>   \tDeviceMatch dm(\"mxc-isi\");\n> @@ -1034,7 +1053,6 @@ bool PipelineHandlerISI::match(DeviceEnumerator *enumerator)\n>   \tunsigned int numSinks = 0;\n>   \tconst unsigned int xbarFirstSource = crossbar_->entity()->pads().size() - pipes_.size();\n>   \tconst unsigned int maxStreams = pipes_.size() / cameraCount;\n> -\tV4L2Subdevice::Routing routing = {};\n>   \n>   \tfor (MediaPad *pad : crossbar_->entity()->pads()) {\n>   \t\tunsigned int sink = numSinks;\n> @@ -1104,7 +1122,7 @@ bool PipelineHandlerISI::match(DeviceEnumerator *enumerator)\n>   \t\t/*  Add routes to the crossbar switch routing table. */\n>   \t\tfor (unsigned i = 0; i < data->streams_.size(); i++) {\n>   \t\t\tunsigned int sourcePad = xbarFirstSource + data->xbarSourceOffset_ + i;\n> -\t\t\trouting.emplace_back(V4L2Subdevice::Stream{ data->xbarSink_, 0 },\n> +\t\t\trouting_.emplace_back(V4L2Subdevice::Stream{ data->xbarSink_, 0 },\n>   \t\t\t\t\t     V4L2Subdevice::Stream{ sourcePad, 0 },\n>   \t\t\t\t\t     V4L2_SUBDEV_ROUTE_FL_ACTIVE);\n>   \t\t}\n> @@ -1116,10 +1134,6 @@ bool PipelineHandlerISI::match(DeviceEnumerator *enumerator)\n>   \t\tnumCameras++;\n>   \t}\n>   \n> -\tret = crossbar_->setRouting(&routing, V4L2Subdevice::ActiveFormat);\n> -\tif (ret)\n> -\t\treturn false;\n> -\n>   \treturn numCameras > 0;\n>   }\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 937D9C3241\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  4 Nov 2025 11:33:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 753BB60A80;\n\tTue,  4 Nov 2025 12:33:17 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CAEBC6069A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  4 Nov 2025 12:33:16 +0100 (CET)","from [192.168.33.40] (185.221.140.239.nat.pool.zt.hu\n\t[185.221.140.239])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 29331C6F;\n\tTue,  4 Nov 2025 12:31:23 +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=\"bQJJtwgf\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762255883;\n\tbh=ApaNcXuZAwPOqlS4n37scUsXTe+1sbbHNM5bK+kPb6k=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=bQJJtwgfK/nWInXkIwZmKIEn4jrYPfcaSOeNzBlZ79bYKDVcxBLqS/CKYbVjf1Twq\n\tL3/qXbfnnh1iY0ZoT8ytcZQOFcBge7Ek0vx2a0X/QlknZOuYwMY5hDf/j88AffByP2\n\tEv0/Z1wCD1garn8QqKfAMOlTeyXkSlWvOaj9MpYQ=","Message-ID":"<bb4f5d3c-355b-4c40-839f-6b8c52343291@ideasonboard.com>","Date":"Tue, 4 Nov 2025 12:33:13 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v5 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":"<20251104075609.94310-1-antoine.bouyer@nxp.com>\n\t<20251104075609.94310-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":"<20251104075609.94310-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>"}}]