[{"id":15450,"web_url":"https://patchwork.libcamera.org/comment/15450/","msgid":"<YD+jtTd7NmNK6JSe@pendragon.ideasonboard.com>","date":"2021-03-03T14:56:53","subject":"Re: [libcamera-devel] [PATCH] libcamera: pipeline: simple: walk the\n\tpipline by following the first link","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Dafna,\n\nThank you for the patch.\n\ns/pipline/pipeline/ on the subject line.\n\nOn Wed, Mar 03, 2021 at 03:16:44PM +0100, Dafna Hirschfeld wrote:\n> When walking the pipeline, follow the first link of each\n> source pad.\n> This patch removes a redundant condition for choosing the link:\n> \n> \"(link->flags() & MEDIA_LNK_FL_ENABLED) ||\n>  !(link->flags() & MEDIA_LNK_FL_IMMUTABLE)\"\n> \n> since it always returns true.\n> \n> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n> \n> Note, I could only make sure that the patch compiles, but I don't have\n> the hardware to test it.\n\nTested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n:-)\n\n> \n>  src/libcamera/pipeline/simple/simple.cpp | 23 ++++++-----------------\n>  1 file changed, 6 insertions(+), 17 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 7fba495c..1aeabcf7 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -279,12 +279,17 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n>  \t\tif (source->function() == MEDIA_ENT_F_IO_V4L)\n>  \t\t\tbreak;\n>  \n> -\t\t/* Use the first output pad that has links. */\n> +\t\t/*\n> +\t\t * Use the first output pad that has links and follow its first\n> +\t\t * link.\n> +\t\t */\n>  \t\tMediaPad *sourcePad = nullptr;\n> +\t\tMediaLink *sourceLink = nullptr;\n>  \t\tfor (MediaPad *pad : source->pads()) {\n>  \t\t\tif ((pad->flags() & MEDIA_PAD_FL_SOURCE) &&\n>  \t\t\t    !pad->links().empty()) {\n>  \t\t\t\tsourcePad = pad;\n> +\t\t\t\tsourceLink = pad->links().front();\n>  \t\t\t\tbreak;\n>  \t\t\t}\n>  \t\t}\n> @@ -292,22 +297,6 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n>  \t\tif (!sourcePad)\n>  \t\t\treturn;\n>  \n> -\t\t/*\n> -\t\t * Use the first link that is enabled or can be enabled (not\n> -\t\t * immutable).\n> -\t\t */\n> -\t\tMediaLink *sourceLink = nullptr;\n> -\t\tfor (MediaLink *link : sourcePad->links()) {\n> -\t\t\tif ((link->flags() & MEDIA_LNK_FL_ENABLED) ||\n> -\t\t\t    !(link->flags() & MEDIA_LNK_FL_IMMUTABLE)) {\n> -\t\t\t\tsourceLink = link;\n> -\t\t\t\tbreak;\n> -\t\t\t}\n> -\t\t}\n> -\n> -\t\tif (!sourceLink)\n> -\t\t\treturn;\n> -\n>  \t\tentities_.push_back({ source, sourceLink });\n>  \n>  \t\tsource = sourceLink->sink()->entity();","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 DE8F8BD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Mar 2021 14:57:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AC94868A9A;\n\tWed,  3 Mar 2021 15:57:23 +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 079BA68A7E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Mar 2021 15:57:23 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 81E768CA;\n\tWed,  3 Mar 2021 15:57:22 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"wDF85Mze\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1614783442;\n\tbh=7b60avDr0Ak3eqrTjlnfrSg+3fsng0p/2ne19Mb16tk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=wDF85MzeJNr4DVsUesg0OVhpkLlWR0Rhn8rwy3WSSpTXqh+mUgUzkknJI0s9FYSeC\n\tvmdyAii0Sn5hA5SCI0LzlC5y/szDas7ru6veHd6gbzHHfmwClWB/yKUAxzvN8q1GSH\n\tqRrspkiar8n1jR8dUu+to6x+vX/hFxvbNNaEfQRk=","Date":"Wed, 3 Mar 2021 16:56:53 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Dafna Hirschfeld <dafna.hirschfeld@collabora.com>","Message-ID":"<YD+jtTd7NmNK6JSe@pendragon.ideasonboard.com>","References":"<20210303141644.10873-1-dafna.hirschfeld@collabora.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210303141644.10873-1-dafna.hirschfeld@collabora.com>","Subject":"Re: [libcamera-devel] [PATCH] libcamera: pipeline: simple: walk the\n\tpipline by following the first link","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>","Cc":"libcamera-devel@lists.libcamera.org, kernel@collabora.com","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]