From patchwork Tue Dec 7 22:45:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15067 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 15071BDB13 for ; Tue, 7 Dec 2021 22:45:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1718C60882; Tue, 7 Dec 2021 23:45:30 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mO+eMjpL"; dkim-atps=neutral Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1804160592 for ; Tue, 7 Dec 2021 23:45:29 +0100 (CET) Received: by mail-wr1-x432.google.com with SMTP id t18so698069wrg.11 for ; Tue, 07 Dec 2021 14:45:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zT/Bvo+zedrE+b0lAdNXtkJ9c9PTqOCQxDuwUpjCP8Q=; b=mO+eMjpLnyUdd6qdyaSqLAqG44ZavbUbWy4D1UKjCnR73WNlruCzcq4ie2t4epGh6x jW+xCnM+IoSKCHNaeml+7Qi27wdbq3SJw0LWEjOIceI/q8o3Jth+G7jY3vQX5Li/nyaj oJZ5SyYcgAGqQGCHsK2tz2FHUaRx5tWfHwgZ66cGctp2WfZJrbWQ01hKpc4Ph8hxMqmV 5NlBYA48nPahbNM2Xn4Tq5tJUKDGYNdFAO2nGaFPvHtAC9xXzqNSsGSvmmHOlKvCL1CW ASHaFHmnW8ygE1qaZWAzGW4lTG0EdclVlBAfjmSLG3Ixgpt98oqG7hUCM48a5Q/NB2Ce P7rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zT/Bvo+zedrE+b0lAdNXtkJ9c9PTqOCQxDuwUpjCP8Q=; b=eIbTVn8SJfsK43lY5K7TujK7m5Gt/huI6VAHmkth7WPovk16Tlqn0aCmgKwPPwVls5 MdIBPQV7wZmNTZD99l6xPpDRHVnSi3GRpjJkOwH74Ec+XT7Xu3brbSOwalgkn/lYd2eX gvumVnVKwrWq5PfR1/aU80LTReHeEcvvIg9GxfdxpUZensn5DIONV7UtAJOEiLYjonp/ v/y/u3XmCnW2eF0Nct0IdtQmlOIucOSU6dtt3JqY/IpiXTghYfCvI+NcCMtoPyu+UOwK bBsEQGBgXK7bD+7nzSih0JeNgYlKb+4fQJ9n5jCsH2QaIITVLjD0yM87x8MFFdQYUWX+ qyqQ== X-Gm-Message-State: AOAM532GFDpUYhyGOHEuN3xJk4xneozrf2SV7j7rnf0vSWXykUUFUPD6 8lPc2DiRPT6cKDDjWfGkA2tKnq7DHZA= X-Google-Smtp-Source: ABdhPJzt50ioj0w0Muu/b4JQ2E0UeKN4d1YEqR+6U7wY7y5QH5MJYdZR7KcTOZ8EKt6uewCYK2aCEQ== X-Received: by 2002:a5d:5912:: with SMTP id v18mr53183862wrd.144.1638917128902; Tue, 07 Dec 2021 14:45:28 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id y12sm980332wrn.73.2021.12.07.14.45.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 14:45:28 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Dec 2021 22:45:04 +0000 Message-Id: <20211207224512.753979-2-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 Subject: [libcamera-devel] [PATCH v3 1/9] libcamera: Add members to MediaEntity to support ancillary entities X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" With kernel support for ancillary links, we can describe the relationship between two devices represented individually as instances of MediaEntity. As the only property of that relationship is its existence, describe those relationships in libcamera simply as a vector of MediaEntity pointers to the ancillary devices. Signed-off-by: Daniel Scally Reviewed-by: Laurent Pinchart --- Changes in v3: - Fixed some style issues - Made addAncillaryEntity() private include/libcamera/internal/media_object.h | 4 ++++ src/libcamera/media_object.cpp | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h index 90c63598..b1572968 100644 --- a/include/libcamera/internal/media_object.h +++ b/include/libcamera/internal/media_object.h @@ -104,6 +104,7 @@ public: unsigned int deviceMinor() const { return minor_; } const std::vector &pads() const { return pads_; } + const std::vector ancillaryEntities() const { return ancillaryEntities_; } const MediaPad *getPadByIndex(unsigned int index) const; const MediaPad *getPadById(unsigned int id) const; @@ -120,6 +121,8 @@ private: void addPad(MediaPad *pad); + void addAncillaryEntity(MediaEntity *ancillaryEntity); + std::string name_; unsigned int function_; unsigned int flags_; @@ -129,6 +132,7 @@ private: unsigned int minor_; std::vector pads_; + std::vector ancillaryEntities_; }; } /* namespace libcamera */ diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp index f425d044..dbcf10e2 100644 --- a/src/libcamera/media_object.cpp +++ b/src/libcamera/media_object.cpp @@ -326,6 +326,21 @@ void MediaPad::addLink(MediaLink *link) * \return The list of the entity's pads */ +/** + * \fn MediaEntity::ancillaryEntities() + * \brief Retrieve all ancillary entities of the entity + * \return The list of the entity's ancillary entities + */ + +/** + * \brief Add a MediaEntity to the list of ancillary entities + * \param[in] ancillaryEntity The instance of MediaEntity to add + */ +void MediaEntity::addAncillaryEntity(MediaEntity *ancillaryEntity) +{ + ancillaryEntities_.push_back(ancillaryEntity); +} + /** * \brief Get a pad in this entity by its index * \param[in] index The 0-based pad index