Patch Detail
Show a patch.
GET /api/1.1/patches/14785/?format=api
{ "id": 14785, "url": "https://patchwork.libcamera.org/api/1.1/patches/14785/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14785/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20211126003118.42356-3-djrscally@gmail.com>", "date": "2021-11-26T00:31:15", "name": "[libcamera-devel,2/5] libcamera: media_device: Handle ancillary links in populateLinks()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "24e4ede8d54441079bb3e54277a69c08691f51c6", "submitter": { "id": 90, "url": "https://patchwork.libcamera.org/api/1.1/people/90/?format=api", "name": "Daniel Scally", "email": "djrscally@gmail.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/14785/mbox/", "series": [ { "id": 2757, "url": "https://patchwork.libcamera.org/api/1.1/series/2757/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2757", "date": "2021-11-26T00:31:13", "name": "Enumerate CameraLens by following sensor's ancillary links", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2757/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14785/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14785/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 48A61C324F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Nov 2021 00:31:34 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F39D460490;\n\tFri, 26 Nov 2021 01:31:32 +0100 (CET)", "from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0893C6011D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Nov 2021 01:31:29 +0100 (CET)", "by mail-wm1-x32e.google.com with SMTP id 137so6826287wma.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Nov 2021 16:31:29 -0800 (PST)", "from localhost.localdomain\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161])\n\tby smtp.gmail.com with ESMTPSA id\n\tb188sm4381455wmd.45.2021.11.25.16.31.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 25 Nov 2021 16:31:28 -0800 (PST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"DkrA1GMp\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=aemq21Ri5fdhqriXaF8QcTIZVoJtSLB/xFzBO4uxDmg=;\n\tb=DkrA1GMpPAsPY8fqANUNBP0sLDXrxNVoAOKBubxBokPKd/lytFc6w7E1sy38McXf25\n\terRvKmh9WDjzX6L7NIeNnAsmw+T1NsXGzb8I8sFNf3zjQu+Il5dAs0c4U6H2fJnTdHXI\n\tE+dQ2w42Md8vZ/SNxTmkQdIh4wvYPDD2COcedFodHThEpUYnLEbsxYeFzUhou6ZrVjq/\n\tSHOKK3xZSSn9KYCeBAYMRBmeBIolecoWt/VuLRfhMI6xpNCChPAZq6imYr7J7XgjFdOZ\n\toWtjlnlt/Rxe5IYlFA/96Hl+KovwhdIql8usY+3dEfeIYVP2WASg5+6AVPAO5jZ2ai3x\n\t5v7w==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=aemq21Ri5fdhqriXaF8QcTIZVoJtSLB/xFzBO4uxDmg=;\n\tb=gqNQ8DUhM/DD90V/SjO7lBxd6C/rcnyfNwTQZIf3D/0dQkbGuXrzoEUtkskFmU3ewA\n\tLH9bPUd0oN9VuekNCa4cXcNQTdKb/jB8Ut/AWVU/FpGUp9mW3rrNkGkT3l3feCQSCQ2g\n\tTmykp1Frk+41bIF3jGBdbezIguTgdT+nTaxPu1QO3+/lflbiQlViTFTm1vZxwFNLwrcU\n\t2bq/dC+UwV8E5Hi+NKuzxfsWImA3MqN+OSwVkdQ/Cgc+m1SZV/CljRMPu8kc9oo2PAyq\n\tUEvndaIvRMG/v4OFPIZuliRMefLlLGgOc8CbHMoZLg5Gni5A6DBl56jrSQOpSpQ7OC0+\n\tFzIw==", "X-Gm-Message-State": "AOAM532m9zfWCgQdOc4jxvPYFc37dqp+E/dfmByAh/PboAxceqRpiqSr\n\tc0Cur0h8qNDMM18FhZUqcAIdbAc6mIY=", "X-Google-Smtp-Source": "ABdhPJwO4ZEO0HcV/cvWw9t5QPJ6AI7x0UGlk84rhKoIJBxss4Rxyx/aQp0wBLpLdFP8fi3KHFBtbA==", "X-Received": "by 2002:a7b:cf18:: with SMTP id\n\tl24mr12085405wmg.145.1637886688820; \n\tThu, 25 Nov 2021 16:31:28 -0800 (PST)", "From": "Daniel Scally <djrscally@gmail.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 26 Nov 2021 00:31:15 +0000", "Message-Id": "<20211126003118.42356-3-djrscally@gmail.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20211126003118.42356-1-djrscally@gmail.com>", "References": "<20211126003118.42356-1-djrscally@gmail.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 2/5] libcamera: media_device: Handle\n\tancillary links in populateLinks()", "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>" }, "content": "The populateLinks() function can't currently handle ancillary links\nwhich causes an error to be thrown in process() when the MediaObject\ncannot be cast to a MediaPad.\n\nAdd explicit handling for the different link types, creating either\npad-2-pad or entity-2-entity versions of a MediaLink based on the\nlink type in the link's flags.\n\nSigned-off-by: Daniel Scally <djrscally@gmail.com>\n---\n include/linux/media.h | 1 +\n src/libcamera/media_device.cpp | 52 ++++++++++++++++++++++++----------\n 2 files changed, 38 insertions(+), 15 deletions(-)", "diff": "diff --git a/include/linux/media.h b/include/linux/media.h\nindex 17432318..e3123d1a 100644\n--- a/include/linux/media.h\n+++ b/include/linux/media.h\n@@ -222,6 +222,7 @@ struct media_pad_desc {\n #define MEDIA_LNK_FL_LINK_TYPE\t\t\t(0xf << 28)\n # define MEDIA_LNK_FL_DATA_LINK\t\t(0 << 28)\n # define MEDIA_LNK_FL_INTERFACE_LINK\t\t(1 << 28)\n+# define MEDIA_LNK_FL_ANCILLARY_LINK\t\t(2 << 28)\n \n struct media_link_desc {\n \tstruct media_pad_desc source;\ndiff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\nindex aa93da75..8133c534 100644\n--- a/src/libcamera/media_device.cpp\n+++ b/src/libcamera/media_device.cpp\n@@ -699,45 +699,67 @@ bool MediaDevice::populateLinks(const struct media_v2_topology &topology)\n {\n \tstruct media_v2_link *mediaLinks = reinterpret_cast<struct media_v2_link *>\n \t\t\t\t\t (topology.ptr_links);\n+\tunsigned int link_type;\n+\tMediaLink *link;\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 * about pad-2-pad and entity-2-entity 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\tcontinue;\n \n-\t\t/* Store references to source and sink pads in the link. */\n+\t\t/* Store references to source and sink objects in the link. */\n \t\tunsigned int source_id = mediaLinks[i].source_id;\n-\t\tMediaPad *source = dynamic_cast<MediaPad *>\n-\t\t\t\t (object(source_id));\n+\t\tMediaObject *source = object(source_id);\n \t\tif (!source) {\n \t\t\tLOG(MediaDevice, Error)\n-\t\t\t\t<< \"Failed to find pad with id: \"\n+\t\t\t\t<< \"Failed to find MediaObject with id: \"\n \t\t\t\t<< source_id;\n \t\t\treturn false;\n \t\t}\n \n \t\tunsigned int sink_id = mediaLinks[i].sink_id;\n-\t\tMediaPad *sink = dynamic_cast<MediaPad *>\n-\t\t\t\t (object(sink_id));\n+\t\tMediaObject *sink = object(sink_id);\n \t\tif (!sink) {\n \t\t\tLOG(MediaDevice, Error)\n-\t\t\t\t<< \"Failed to find pad with id: \"\n+\t\t\t\t<< \"Failed to find MediaObject with id: \"\n \t\t\t\t<< sink_id;\n \t\t\treturn false;\n \t\t}\n \n-\t\tMediaLink *link = new MediaLink(&mediaLinks[i], source, sink);\n-\t\tif (!addObject(link)) {\n-\t\t\tdelete link;\n-\t\t\treturn false;\n-\t\t}\n+\t\tlink_type = mediaLinks[i].flags & MEDIA_LNK_FL_LINK_TYPE;\n+\n+\t\tswitch (link_type) {\n+\t\tcase MEDIA_LNK_FL_DATA_LINK:\n+\t\t\tlink = new MediaLink(&mediaLinks[i],\n+\t\t\t\t\t dynamic_cast<MediaPad *>(source),\n+\t\t\t\t\t dynamic_cast<MediaPad *>(sink));\n+\t\t\tif (!addObject(link)) {\n+\t\t\t\tdelete link;\n+\t\t\t\treturn false;\n+\t\t\t}\n+\n+\t\t\tlink->source()->addLink(link);\n+\t\t\tlink->sink()->addLink(link);\n \n-\t\tsource->addLink(link);\n-\t\tsink->addLink(link);\n+\t\t\tbreak;\n+\t\tcase MEDIA_LNK_FL_ANCILLARY_LINK:\n+\t\t\tlink = new MediaLink(&mediaLinks[i],\n+\t\t\t\t\t dynamic_cast<MediaEntity *>(source),\n+\t\t\t\t\t dynamic_cast<MediaEntity *>(sink));\n+\t\t\tif (!addObject(link)) {\n+\t\t\t\tdelete link;\n+\t\t\t\treturn false;\n+\t\t\t}\n+\n+\t\t\tlink->primary()->addLink(link);\n+\t\t\tlink->ancillary()->addLink(link);\n+\n+\t\t\tbreak;\n+\t\t}\n \t}\n \n \treturn true;\n", "prefixes": [ "libcamera-devel", "2/5" ] }