[{"id":24342,"web_url":"https://patchwork.libcamera.org/comment/24342/","msgid":"<20220803120546.34gyjzwayjfpn3ic@uno.localdomain>","date":"2022-08-03T12:05:46","subject":"Re: [libcamera-devel] [PATCH v1.1 12/13] libcamera: pipeline:\n\tsimple: Don't disable links carrying other streams","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent\n\nOn Tue, Aug 02, 2022 at 01:34:10PM +0300, Laurent Pinchart via libcamera-devel wrote:\n> If a subdev supports the internal routing API, pads unrelated to the\n> pipeline for a given camera sensor may carry streams for other cameras.\n> The link setup logic is updated to take this into account, by avoiding\n> disabling links to unrelated pads.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n> ---\n> Changes since v1:\n>\n> - Simplify a condition\n> - Fix author\n> ---\n>  src/libcamera/pipeline/simple/simple.cpp | 26 +++++++++++++++++++++---\n>  1 file changed, 23 insertions(+), 3 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 2a8811183907..0e169fbec1b5 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -221,6 +221,11 @@ public:\n>  \tstruct Entity {\n>  \t\t/* The media entity, always valid. */\n>  \t\tMediaEntity *entity;\n> +\t\t/*\n> +\t\t * Whether or not the entity is a subdev that supports the\n> +\t\t * routing API.\n> +\t\t */\n> +\t\tbool supportsRouting;\n>  \t\t/*\n>  \t\t * The local sink pad connected to the upstream entity, null for\n>  \t\t * the camera sensor at the beginning of the pipeline.\n> @@ -404,9 +409,13 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n>  \t\t */\n>\n>  \t\tstd::vector<const MediaPad *> pads;\n> +\t\tbool supportsRouting = false;\n>\n> -\t\tif (sinkPad)\n> +\t\tif (sinkPad) {\n>  \t\t\tpads = routedSourcePads(sinkPad);\n> +\t\t\tif (!pads.empty())\n> +\t\t\t\tsupportsRouting = true;\n> +\t\t}\n>\n>  \t\tif (pads.empty()) {\n>  \t\t\tfor (const MediaPad *pad : entity->pads()) {\n> @@ -421,7 +430,9 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n>  \t\t\t\tMediaEntity *next = link->sink()->entity();\n>  \t\t\t\tif (visited.find(next) == visited.end()) {\n>  \t\t\t\t\tqueue.push({ next, link->sink() });\n> -\t\t\t\t\tparents.insert({ next, { entity, sinkPad, pad, link } });\n> +\n> +\t\t\t\t\tEntity e{ entity, supportsRouting, sinkPad, pad, link };\n> +\t\t\t\t\tparents.insert({ next, e });\n>  \t\t\t\t}\n>  \t\t\t}\n>  \t\t}\n> @@ -435,7 +446,7 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n>  \t * to the sensor. Store all the entities in the pipeline, from the\n>  \t * camera sensor to the video node, in entities_.\n>  \t */\n> -\tentities_.push_front({ entity, sinkPad, nullptr, nullptr });\n> +\tentities_.push_front({ entity, false, sinkPad, nullptr, nullptr });\n>\n>  \tfor (auto it = parents.find(entity); it != parents.end();\n>  \t     it = parents.find(entity)) {\n> @@ -617,6 +628,15 @@ int SimpleCameraData::setupLinks()\n>  \t\t}\n>\n>  \t\tfor (MediaPad *pad : e.entity->pads()) {\n> +\t\t\t/*\n> +\t\t\t * If the entity supports the V4L2 internal routing API,\n> +\t\t\t * assume that it may carry multiple independent streams\n> +\t\t\t * concurrently, and only disable links on the sink and\n> +\t\t\t * source pads used by the pipeline.\n> +\t\t\t */\n> +\t\t\tif (e.supportsRouting && pad != e.sink && pad != e.source)\n> +\t\t\t\tcontinue;\n> +\n>  \t\t\tfor (MediaLink *link : pad->links()) {\n>  \t\t\t\tif (link == sinkLink)\n>  \t\t\t\t\tcontinue;\n> --\n> Regards,\n>\n> Laurent Pinchart\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 9C9FFC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Aug 2022 12:05:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4548B63310;\n\tWed,  3 Aug 2022 14:05:50 +0200 (CEST)","from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D8C22603E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Aug 2022 14:05:48 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 35E0A1BF206;\n\tWed,  3 Aug 2022 12:05:47 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659528350;\n\tbh=Ol9rkqkViqorBts8TkCyP79hE3Nxm9x0hRuljrjrqKI=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=tuP0/FZVT4xOfQSAKmwbWwQo/3ytqLpPjDdPbxPQyIilwDgpq8yI3NLmOnkYMNPSC\n\t6hqOfm5e1jWbw45VLN4aybXuiTGwqmbfJV5fBJINDPyvC22+mTSa9mdq2pU2kuuhuX\n\tj2rCJD1jNhnL/a9ux82aY6LCeWIDAvq7vBiL03jdZHTJAR84MO2Vd2LtnA5rV6H8zK\n\ttiCeWfsryWgmnoI8Si+U2jzFJYc9f0mSg3Ytgnpf89I8r4ny7xLqFJ41QZ8GIvQz/f\n\tgPUNxEmg6gUSVxJo3yD8yUe97PCKZ1ph/P+NJTj+1etFclRJZikYfKh3jO0aYirExz\n\tEJgnTl9AhQHCw==","Date":"Wed, 3 Aug 2022 14:05:46 +0200","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20220803120546.34gyjzwayjfpn3ic@uno.localdomain>","References":"<20220801000543.3501-1-laurent.pinchart@ideasonboard.com>\n\t<20220802103410.2735-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220802103410.2735-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v1.1 12/13] libcamera: pipeline:\n\tsimple: Don't disable links carrying other streams","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>","From":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]