{"id":11477,"url":"https://patchwork.libcamera.org/api/1.1/patches/11477/?format=json","web_url":"https://patchwork.libcamera.org/patch/11477/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210303152051.14172-1-dafna.hirschfeld@collabora.com>","date":"2021-03-03T15:20:51","name":"[libcamera-devel,v2] libcamera: pipeline: simple: walk the pipeline by following the first link","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"6b50bb43db8d20c680790fb4459d5767a816912b","submitter":{"id":46,"url":"https://patchwork.libcamera.org/api/1.1/people/46/?format=json","name":"Dafna Hirschfeld","email":"dafna.hirschfeld@collabora.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11477/mbox/","series":[{"id":1752,"url":"https://patchwork.libcamera.org/api/1.1/series/1752/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1752","date":"2021-03-03T15:20:51","name":"[libcamera-devel,v2] libcamera: pipeline: simple: walk the pipeline by following the first link","version":2,"mbox":"https://patchwork.libcamera.org/series/1752/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11477/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11477/checks/","tags":{},"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 11833BD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Mar 2021 15:21:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 97C2468A91;\n\tWed,  3 Mar 2021 16:21:02 +0100 (CET)","from bhuna.collabora.co.uk (bhuna.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8F52B68A7E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Mar 2021 16:21:01 +0100 (CET)","from guri.fritz.box\n\t(p200300c7cf3838007d25342b1528aa90.dip0.t-ipconnect.de\n\t[IPv6:2003:c7:cf38:3800:7d25:342b:1528:aa90])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits))\n\t(No client certificate requested) (Authenticated sender: dafna)\n\tby bhuna.collabora.co.uk (Postfix) with ESMTPSA id 14A421F45DD3;\n\tWed,  3 Mar 2021 15:21:01 +0000 (GMT)"],"From":"Dafna Hirschfeld <dafna.hirschfeld@collabora.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  3 Mar 2021 16:20:51 +0100","Message-Id":"<20210303152051.14172-1-dafna.hirschfeld@collabora.com>","X-Mailer":"git-send-email 2.17.1","Subject":"[libcamera-devel] [PATCH v2] libcamera: pipeline: simple: walk the\n\tpipeline 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":"kernel@collabora.com","MIME-Version":"1.0","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>"},"content":"When walking the pipeline, follow the first link of each\nsource pad.\nThis 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\nsince it always returns true.\n\nSigned-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nTested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges from v1: s/pipline/pipeline/ on the subject line.\n\n src/libcamera/pipeline/simple/simple.cpp | 23 ++++++-----------------\n 1 file changed, 6 insertions(+), 17 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 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();\n","prefixes":["libcamera-devel","v2"]}