[{"id":21615,"web_url":"https://patchwork.libcamera.org/comment/21615/","msgid":"<cc357450-c18e-1e88-160e-f74e875d6d3c@ideasonboard.com>","date":"2021-12-06T19:10:50","subject":"Re: [libcamera-devel] [PATCH] libcamera: media_device: Skip all\n\tnon-data links during enumeration","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 06/12/2021 19:50, Laurent Pinchart wrote:\n> The MediaDevice::populateLinks() function iterates over data links by\n> skipping interface links. This isn't very future-proof, it will break if\n> the kernel adds new types of links. Fix it by only considering data\n> links instead of blacklisting interface links.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nThanks, it works like a charm :-).\nTested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\nReviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n\n> ---\n> Let's merge this ASAP to avoid bug reports when using an older libcamera\n> version with a kernel that supports the soon-to-be-added ancillary\n> links.\n> ---\n>   src/libcamera/media_device.cpp | 9 +++------\n>   1 file changed, 3 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\n> index 4df0a27fe193..0b7940182d0c 100644\n> --- a/src/libcamera/media_device.cpp\n> +++ b/src/libcamera/media_device.cpp\n> @@ -695,12 +695,9 @@ bool MediaDevice::populateLinks(const struct media_v2_topology &topology)\n>   \t\t\t\t\t   (topology.ptr_links);\n>   \n>   \tfor (unsigned int i = 0; i < topology.num_links; ++i) {\n> -\t\t/*\n> -\t\t * Skip links between entities and interfaces: we only care\n> -\t\t * about pad-2-pad links here.\n> -\t\t */\n> -\t\tif ((mediaLinks[i].flags & MEDIA_LNK_FL_LINK_TYPE) ==\n> -\t\t    MEDIA_LNK_FL_INTERFACE_LINK)\n> +\t\t/* We only care about pad-2-pad links here. */\n> +\t\tif ((mediaLinks[i].flags & MEDIA_LNK_FL_LINK_TYPE) !=\n> +\t\t    MEDIA_LNK_FL_DATA_LINK)\n>   \t\t\tcontinue;\n>   \n>   \t\t/* Store references to source and sink pads in the link. */\n> \n> base-commit: 294663eece8c067d268442724b969c9dfa081b0a\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 4DBD4BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Dec 2021 19:10:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A3219607DE;\n\tMon,  6 Dec 2021 20:10:55 +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 9887260725\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Dec 2021 20:10:53 +0100 (CET)","from [IPV6:2a01:e0a:169:7140:a87:91f2:34ef:c177] (unknown\n\t[IPv6:2a01:e0a:169:7140:a87:91f2:34ef:c177])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3E5F5EE;\n\tMon,  6 Dec 2021 20:10:53 +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=\"dltJ1F1Q\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638817853;\n\tbh=baqzhPkxABBC3qovBtRyq7ZrCElnoUQ3AuSmOoimnwk=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=dltJ1F1QtQXK/OZR199W0Fwq7pnmBpPaS5pOGuDSHi+vLvE0lXh3PWnrvJEK7oAZC\n\tVd/Jn1uQiAgX8w7jZqMQWMGcr7DFdy6ckbcjHzI2jPoj/K9RLc6hyP/jUBaZmkKjif\n\tj9K64oS5tasACETUHNVhCWGPQT0Nm04/l8yvDhj0=","Message-ID":"<cc357450-c18e-1e88-160e-f74e875d6d3c@ideasonboard.com>","Date":"Mon, 6 Dec 2021 20:10:50 +0100","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.3.1","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20211206185047.18285-1-laurent.pinchart@ideasonboard.com>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","In-Reply-To":"<20211206185047.18285-1-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH] libcamera: media_device: Skip all\n\tnon-data links during enumeration","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>"}},{"id":21617,"web_url":"https://patchwork.libcamera.org/comment/21617/","msgid":"<163882505400.1255315.5746653863123958071@Monstersaurus>","date":"2021-12-06T21:10:54","subject":"Re: [libcamera-devel] [PATCH] libcamera: media_device: Skip all\n\tnon-data links during enumeration","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2021-12-06 18:50:47)\n> The MediaDevice::populateLinks() function iterates over data links by\n> skipping interface links. This isn't very future-proof, it will break if\n> the kernel adds new types of links. Fix it by only considering data\n> links instead of blacklisting interface links.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n> Let's merge this ASAP to avoid bug reports when using an older libcamera\n> version with a kernel that supports the soon-to-be-added ancillary\n> links.\n\nLooks fine to me.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/libcamera/media_device.cpp | 9 +++------\n>  1 file changed, 3 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\n> index 4df0a27fe193..0b7940182d0c 100644\n> --- a/src/libcamera/media_device.cpp\n> +++ b/src/libcamera/media_device.cpp\n> @@ -695,12 +695,9 @@ bool MediaDevice::populateLinks(const struct media_v2_topology &topology)\n>                                            (topology.ptr_links);\n>  \n>         for (unsigned int i = 0; i < topology.num_links; ++i) {\n> -               /*\n> -                * Skip links between entities and interfaces: we only care\n> -                * about pad-2-pad links here.\n> -                */\n> -               if ((mediaLinks[i].flags & MEDIA_LNK_FL_LINK_TYPE) ==\n> -                   MEDIA_LNK_FL_INTERFACE_LINK)\n> +               /* We only care about pad-2-pad links here. */\n> +               if ((mediaLinks[i].flags & MEDIA_LNK_FL_LINK_TYPE) !=\n> +                   MEDIA_LNK_FL_DATA_LINK)\n>                         continue;\n>  \n>                 /* Store references to source and sink pads in the link. */\n> \n> base-commit: 294663eece8c067d268442724b969c9dfa081b0a\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 451CBBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Dec 2021 21:11:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3539F6086C;\n\tMon,  6 Dec 2021 22:10:59 +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 3E3ED60725\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Dec 2021 22:10:57 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C2834D89;\n\tMon,  6 Dec 2021 22:10:56 +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=\"LCEv1bXL\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638825056;\n\tbh=1odZl3hr827RwJvg+WzwyhOzU6jAWLs5azC4D3H1dpI=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=LCEv1bXLzsvrXvz80BzumhMD/xdcsloNWfDsUupC1l9cFFybFc6eyx2pG7fliiXMZ\n\t4N+xG+vxIkw5+LzH+qNlf1Ba9I6QP7vvfgM0V5ifzpqCYjP2VrUGZcC1PwW/8bCSvC\n\t9ZehHt2iX/jt2rhDqIghjFFvegZnchcie24rzwfI=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211206185047.18285-1-laurent.pinchart@ideasonboard.com>","References":"<20211206185047.18285-1-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 06 Dec 2021 21:10:54 +0000","Message-ID":"<163882505400.1255315.5746653863123958071@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH] libcamera: media_device: Skip all\n\tnon-data links during enumeration","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>"}}]