Patch Detail
Show a patch.
GET /api/1.1/patches/15069/?format=api
{ "id": 15069, "url": "https://patchwork.libcamera.org/api/1.1/patches/15069/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15069/", "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": "<20211207224512.753979-4-djrscally@gmail.com>", "date": "2021-12-07T22:45:06", "name": "[libcamera-devel,v3,3/9] libcamera: media_device: Handle ancillary links in populateLinks()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "48cd3f7e1ba6b86369cd8b99e3d4c096385384e4", "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/15069/mbox/", "series": [ { "id": 2824, "url": "https://patchwork.libcamera.org/api/1.1/series/2824/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2824", "date": "2021-12-07T22:45:03", "name": "Enumerate CameraLens by following sensor's ancillary links", "version": 3, "mbox": "https://patchwork.libcamera.org/series/2824/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15069/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15069/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 6EF8EBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 7 Dec 2021 22:45:36 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2505860890;\n\tTue, 7 Dec 2021 23:45:36 +0100 (CET)", "from mail-wr1-x435.google.com (mail-wr1-x435.google.com\n\t[IPv6:2a00:1450:4864:20::435])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A70EB60868\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 7 Dec 2021 23:45:30 +0100 (CET)", "by mail-wr1-x435.google.com with SMTP id c4so715640wrd.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 07 Dec 2021 14:45:30 -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\ty12sm980332wrn.73.2021.12.07.14.45.29\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 07 Dec 2021 14:45:30 -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=\"ILc8EsU0\"; 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=ntCMpvdJQK9Bdi2smBtYSqjYv78X3g5csArMHbVTPCg=;\n\tb=ILc8EsU0ZVMVxPxkBFRJQmg3mzzjedvMdyO5P/7Cb3hEF9eVThi+vBzpyzQc05W9qR\n\tFijHX6t7GMI8ovfeqWifZQLUYC9KfOAjXHlXy3uw9np6KCEXJkQb/CgPO9LWHTcrQc75\n\tp1/AKIqze0OKM3OVALTYRAtOjTmCC5K+6ySSNhWe6hm8W7b9hNKaKF+lF9FkbXPfmRa8\n\t0Ai2a1P0P9l4KDt7JFJT6YnuPDwFjXs0Uh1qRrWGQSFQCfutpBocZNCRJ6jObmi94/MW\n\tD0D4+pJvk1P0b6WmjLcy4U2AII5E8AAXQ0+l2EPx02YwvoGgAjb15fTDnWY4guF4b4W6\n\tnQ9g==", "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=ntCMpvdJQK9Bdi2smBtYSqjYv78X3g5csArMHbVTPCg=;\n\tb=e/5IqKDNGqEdVEvAamVdHnVg1SX00n+FS6B9YywQPYvfIz3q5Z2G9fWdEt9DT6wfRV\n\tb47PgT42eCrOeJpa7A3MbLAhx6kSkPpMhcyFpF9VVHXQwoRJ2AdZG+pwThSEObowUAZA\n\tWTwZkMno8WPihxlDbOLrF6ltY3aN9d2RmCRA5cZB2ZWJ0PDfPgmuD+epacLaqpS7S9dI\n\thUYxYDMmIYGCEgHScbO8FNm4htdTngVUbdKbqCmbDhsNB84H2nP2UZxm3MprcNPUS7AT\n\th7k9CRdWHkkFKeq/5znm8ejAQl2qPcfGA6JKUtXUcX3lSk/t68ColW5SKM+GlC5wsggd\n\tIZ9g==", "X-Gm-Message-State": "AOAM533x1fsmVmn6T5Kk9vzEMWYnd1fPm/cvAGeRp6K0U27WugbgtsG9\n\tJAs4YXFbqKSdRttKO67/XgRFzoQaf9Y=", "X-Google-Smtp-Source": "ABdhPJzdXmv9i1n72fJcSi8tSoyo084TQceBOu+xODVdAxgirW5oDdpeE0GKm1NmZrN1Uef35qCdxQ==", "X-Received": "by 2002:adf:e484:: with SMTP id i4mr56152368wrm.49.1638917130465;\n\tTue, 07 Dec 2021 14:45:30 -0800 (PST)", "From": "Daniel Scally <djrscally@gmail.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 7 Dec 2021 22:45:06 +0000", "Message-Id": "<20211207224512.753979-4-djrscally@gmail.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20211207224512.753979-1-djrscally@gmail.com>", "References": "<20211207224512.753979-1-djrscally@gmail.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 3/9] 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 links or else storing the pointer to the ancillary device\nMediaEntity in the ancillaryEntities_ member of the primary.\n\nSigned-off-by: Daniel Scally <djrscally@gmail.com>\n---\nChanges in v3:\n\n\t- Split out the new macro\n\t- Fixed some style errors and comments\n\t- Added a default case\n\n src/libcamera/media_device.cpp | 55 ++++++++++++++++++++++++----------\n 1 file changed, 39 insertions(+), 16 deletions(-)", "diff": "diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\nindex 4df0a27f..fb332445 100644\n--- a/src/libcamera/media_device.cpp\n+++ b/src/libcamera/media_device.cpp\n@@ -693,45 +693,68 @@ 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+\tMediaEntity *ancillary;\n+\tMediaEntity *primary;\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 * Skip links between entities and interfaces: interfaces are\n+\t\t * not created as MediaObjects at this time, so the source and\n+\t\t * sink pointers would never be found.\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/* Look up the source and sink objects. */\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\tswitch (mediaLinks[i].flags & MEDIA_LNK_FL_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\t\tbreak;\n+\n+\t\tcase MEDIA_LNK_FL_ANCILLARY_LINK:\n+\t\t\tprimary = dynamic_cast<MediaEntity *>(source);\n+\t\t\tancillary = dynamic_cast<MediaEntity *>(sink);\n \n-\t\tsource->addLink(link);\n-\t\tsink->addLink(link);\n+\t\t\tprimary->addAncillaryEntity(ancillary);\n+\n+\t\t\tbreak;\n+\n+\t\tdefault:\n+\t\t\tLOG(MediaDevice, Warning)\n+\t\t\t\t<< \"Unknown media link type\";\n+\n+\t\t\tbreak;\n+\t\t}\n \t}\n \n \treturn true;\n", "prefixes": [ "libcamera-devel", "v3", "3/9" ] }