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 From patchwork Tue Dec 7 22:45:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15068 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 BC0B7BDB13 for ; Tue, 7 Dec 2021 22:45:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6F1736088C; Tue, 7 Dec 2021 23:45:33 +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="QASlzDhr"; dkim-atps=neutral Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F14E76087E for ; Tue, 7 Dec 2021 23:45:29 +0100 (CET) Received: by mail-wr1-x436.google.com with SMTP id a18so741822wrn.6 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=B1WxVvmYOxvVBIcKvtwZ3HXKjK2l2dof/9nJ8aC1rkw=; b=QASlzDhrqK7uNKu26oKJtauXE8cOsmrx6HV1Y6yYAwgl1DHn7lMgdL9TaCjj3GEMKj BPmq5l5D9YzlOBaEdP5JZ55A4+RA03MASxMDX91n8WETpO7C8KHfiJQz1vs8ZMkTwEU1 /GBh3mCaiAEDKRRCAjeV9mzRK9nOj5Eck1Sf509iteDnMOEcd8Q+gBdg8xcyWl42fVi8 N+/kO3o4LFZcMabjeZ0fGPMz5KDez169dUvKvnhCoFCFMsXiXHFWs6n5J/GMWoWEc9gu az3ZXQEuZIbQ8UlvB/+mo0SAX3G7wSiSPzxxbAFiYdgWrG4xUZnET1K1w2Nh1GkNrC8v N4xQ== 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=B1WxVvmYOxvVBIcKvtwZ3HXKjK2l2dof/9nJ8aC1rkw=; b=TTz7RXfzCS3leOAetuJUWB9/xqWvqVhry+mWnPdXxbm44OLPD4SPxveFtK3OsaT0Qc cIIfFUI+fgipCeSse0UcpTJuDNb0wIR97jxYbvdIfGhic6IqSPnED6sSEWh7hxVt4pLc 6YxUcQgjOD+HqW3oITlxgcEaejVWMIcIu7c/DAtCT+pDn+sSjBAi0vCXem3oGmy58WKl 8p2HF2wK6ropQCiTKgt/8LoElmoiDaZdKian56PpEAf6b45fFqJyX6OL+I8Cmzju/mbl 2dYnBObtjkx9lvhWrqcwef7Ryk3qWF4rZO0kgedEf2u+2m7wuShtKWMUDx19tXkHcD8v K6yg== X-Gm-Message-State: AOAM5329vaqz4yT2mBns37I4rrSB2QrRMSWAnIG8oH1vIApWxijvGgf5 pWj3kJy2dAR0S3KeBxv2T2YahPiNsOc= X-Google-Smtp-Source: ABdhPJwpT/geZTSPZeLNoqqsdytJ9NmvRS4g7g+RnGNPsUinMFF03xVOihC3rfO8eHoR37JryeYfVA== X-Received: by 2002:a05:6000:2ca:: with SMTP id o10mr54347012wry.244.1638917129654; Tue, 07 Dec 2021 14:45:29 -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:29 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Dec 2021 22:45:05 +0000 Message-Id: <20211207224512.753979-3-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 2/9] include: linux: Add MEDIA_LNK_FL_ANCILLARY_LINK 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" Add the new media link type macro to the header so we can use it to identify the new links. Signed-off-by: Daniel Scally Reviewed-by: Laurent Pinchart --- Changes in v3: - New patch include/linux/media.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/media.h b/include/linux/media.h index 17432318..e3123d1a 100644 --- a/include/linux/media.h +++ b/include/linux/media.h @@ -222,6 +222,7 @@ struct media_pad_desc { #define MEDIA_LNK_FL_LINK_TYPE (0xf << 28) # define MEDIA_LNK_FL_DATA_LINK (0 << 28) # define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28) +# define MEDIA_LNK_FL_ANCILLARY_LINK (2 << 28) struct media_link_desc { struct media_pad_desc source; From patchwork Tue Dec 7 22:45:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15069 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 6EF8EBDB13 for ; Tue, 7 Dec 2021 22:45:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2505860890; Tue, 7 Dec 2021 23:45:36 +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="ILc8EsU0"; dkim-atps=neutral Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A70EB60868 for ; Tue, 7 Dec 2021 23:45:30 +0100 (CET) Received: by mail-wr1-x435.google.com with SMTP id c4so715640wrd.9 for ; Tue, 07 Dec 2021 14:45:30 -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=ntCMpvdJQK9Bdi2smBtYSqjYv78X3g5csArMHbVTPCg=; b=ILc8EsU0ZVMVxPxkBFRJQmg3mzzjedvMdyO5P/7Cb3hEF9eVThi+vBzpyzQc05W9qR FijHX6t7GMI8ovfeqWifZQLUYC9KfOAjXHlXy3uw9np6KCEXJkQb/CgPO9LWHTcrQc75 p1/AKIqze0OKM3OVALTYRAtOjTmCC5K+6ySSNhWe6hm8W7b9hNKaKF+lF9FkbXPfmRa8 0Ai2a1P0P9l4KDt7JFJT6YnuPDwFjXs0Uh1qRrWGQSFQCfutpBocZNCRJ6jObmi94/MW D0D4+pJvk1P0b6WmjLcy4U2AII5E8AAXQ0+l2EPx02YwvoGgAjb15fTDnWY4guF4b4W6 nQ9g== 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=ntCMpvdJQK9Bdi2smBtYSqjYv78X3g5csArMHbVTPCg=; b=e/5IqKDNGqEdVEvAamVdHnVg1SX00n+FS6B9YywQPYvfIz3q5Z2G9fWdEt9DT6wfRV b47PgT42eCrOeJpa7A3MbLAhx6kSkPpMhcyFpF9VVHXQwoRJ2AdZG+pwThSEObowUAZA WTwZkMno8WPihxlDbOLrF6ltY3aN9d2RmCRA5cZB2ZWJ0PDfPgmuD+epacLaqpS7S9dI hUYxYDMmIYGCEgHScbO8FNm4htdTngVUbdKbqCmbDhsNB84H2nP2UZxm3MprcNPUS7AT h7k9CRdWHkkFKeq/5znm8ejAQl2qPcfGA6JKUtXUcX3lSk/t68ColW5SKM+GlC5wsggd IZ9g== X-Gm-Message-State: AOAM533x1fsmVmn6T5Kk9vzEMWYnd1fPm/cvAGeRp6K0U27WugbgtsG9 JAs4YXFbqKSdRttKO67/XgRFzoQaf9Y= X-Google-Smtp-Source: ABdhPJzdXmv9i1n72fJcSi8tSoyo084TQceBOu+xODVdAxgirW5oDdpeE0GKm1NmZrN1Uef35qCdxQ== X-Received: by 2002:adf:e484:: with SMTP id i4mr56152368wrm.49.1638917130465; Tue, 07 Dec 2021 14:45:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 14:45:30 -0800 (PST) From: Daniel Scally 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 Subject: [libcamera-devel] [PATCH v3 3/9] libcamera: media_device: Handle ancillary links in populateLinks() 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" The populateLinks() function can't currently handle ancillary links which causes an error to be thrown in process() when the MediaObject cannot be cast to a MediaPad. Add explicit handling for the different link types, creating either pad-2-pad links or else storing the pointer to the ancillary device MediaEntity in the ancillaryEntities_ member of the primary. Signed-off-by: Daniel Scally --- Changes in v3: - Split out the new macro - Fixed some style errors and comments - Added a default case src/libcamera/media_device.cpp | 55 ++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp index 4df0a27f..fb332445 100644 --- a/src/libcamera/media_device.cpp +++ b/src/libcamera/media_device.cpp @@ -693,45 +693,68 @@ bool MediaDevice::populateLinks(const struct media_v2_topology &topology) { struct media_v2_link *mediaLinks = reinterpret_cast (topology.ptr_links); + MediaEntity *ancillary; + MediaEntity *primary; + MediaLink *link; for (unsigned int i = 0; i < topology.num_links; ++i) { /* - * Skip links between entities and interfaces: we only care - * about pad-2-pad links here. + * Skip links between entities and interfaces: interfaces are + * not created as MediaObjects at this time, so the source and + * sink pointers would never be found. */ if ((mediaLinks[i].flags & MEDIA_LNK_FL_LINK_TYPE) == MEDIA_LNK_FL_INTERFACE_LINK) continue; - /* Store references to source and sink pads in the link. */ + /* Look up the source and sink objects. */ unsigned int source_id = mediaLinks[i].source_id; - MediaPad *source = dynamic_cast - (object(source_id)); + MediaObject *source = object(source_id); if (!source) { LOG(MediaDevice, Error) - << "Failed to find pad with id: " + << "Failed to find MediaObject with id: " << source_id; return false; } unsigned int sink_id = mediaLinks[i].sink_id; - MediaPad *sink = dynamic_cast - (object(sink_id)); + MediaObject *sink = object(sink_id); if (!sink) { LOG(MediaDevice, Error) - << "Failed to find pad with id: " + << "Failed to find MediaObject with id: " << sink_id; return false; } - MediaLink *link = new MediaLink(&mediaLinks[i], source, sink); - if (!addObject(link)) { - delete link; - return false; - } + switch (mediaLinks[i].flags & MEDIA_LNK_FL_LINK_TYPE) { + case MEDIA_LNK_FL_DATA_LINK: + link = new MediaLink(&mediaLinks[i], + dynamic_cast(source), + dynamic_cast(sink)); + if (!addObject(link)) { + delete link; + return false; + } + + link->source()->addLink(link); + link->sink()->addLink(link); + + break; + + case MEDIA_LNK_FL_ANCILLARY_LINK: + primary = dynamic_cast(source); + ancillary = dynamic_cast(sink); - source->addLink(link); - sink->addLink(link); + primary->addAncillaryEntity(ancillary); + + break; + + default: + LOG(MediaDevice, Warning) + << "Unknown media link type"; + + break; + } } return true; From patchwork Tue Dec 7 22:45:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15070 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 DF461C324B for ; Tue, 7 Dec 2021 22:45:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8A1E36089D; Tue, 7 Dec 2021 23:45:36 +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="FSqsqDfY"; 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 5F57360592 for ; Tue, 7 Dec 2021 23:45:31 +0100 (CET) Received: by mail-wr1-x432.google.com with SMTP id o13so687623wrs.12 for ; Tue, 07 Dec 2021 14:45:31 -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=moWXhDYYHDTxZgKoZg+f4F5npDP4+tmfBJEX072EnMU=; b=FSqsqDfY9G9DAXBhNPIUhGytmWe+NmMaoE+PRW3yO9c8CfR8hp+A7AjsD9NvLe1o0v qxwFIZcOWESxicTYGqtPM929vwBZBNWoSwnM74nOA0CKMdqlJnGguSVxsrimmN6IWD5o AQAdTvVBcmGgWP7g6p2DVrxo//5t/ncBIDvA06m7eV9Nng0mArNmcXPdWE2tllDa57pJ VSSHmN6XzDYhdu2Rhup7qkQccAmZeKnHk+dymSZut/uZpAI+SBq1QA4kDa5dFEL3xhOa I/rPbPIUpCuiabqYfNDoUIjBWJbfENGx6Q/9CRRh03ubCURotmIs5nL0jnpLSdS6xSpB rFvA== 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=moWXhDYYHDTxZgKoZg+f4F5npDP4+tmfBJEX072EnMU=; b=DIrBRqb9l01aiM3RL4moLcE5CPOfVFdNqc4BSWBq1jfaSv/w0VThV7F4sz5qk2N4fu +g30I4aPD4WokiRQFBLtiSoPHusDe+zqEmif6KTM/+x3nVGjKvn+st1icxwugawir+ke toQfgX3te1xvuMcpWcUVy0uYzzRlSqc1oDX5KUslCb8L4kmoAgJQw3PpkUKAOh3HtHgG yLE09EHUNykRo9/WwSNitUaSjarMGOk8kB2iDCf4pd+mOHtianwT3J2ksKkMhxMGgFIK tqqnj06aE0YGJJv4bBcloqwc/hsEq4mSkt2Ne7XWAcLpmH6gcmF5xS2yyxClpJdtP6sm 7C2A== X-Gm-Message-State: AOAM530cCfslyr5kNiFDVbbIpa/3DCN06Icym+za1XyAKK+j1wL+1OlE aD1LUN8fnvFKMObctz52PNtndlcgbaQ= X-Google-Smtp-Source: ABdhPJx6lzMT2DbMnF703JtARko0XVa45U6zKPfxd7/nM4AdeVQyrZPZXIK53s6Mi4w/oiQnERE62g== X-Received: by 2002:a5d:6da5:: with SMTP id u5mr56498929wrs.374.1638917131191; Tue, 07 Dec 2021 14:45:31 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 14:45:30 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Dec 2021 22:45:07 +0000 Message-Id: <20211207224512.753979-5-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 4/9] libcamera: camera_sensor: Discover VCMs through ancillary links 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" Add a function to check for and initialise any VCMs linked to the CameraSensor's entity by ancillary links. This should initialise the lens_ member with the linked entity. Call the new function during CameraSensor::init(). Signed-off-by: Daniel Scally Reviewed-by: Laurent Pinchart --- Changes in v3: - Fixed some style errors - Replaced the flash case by printing the entity function in the default case. include/libcamera/internal/camera_sensor.h | 1 + src/libcamera/camera_sensor.cpp | 39 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index 2fa11567..7fb4eded 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -81,6 +81,7 @@ private: void initTestPatternModes(); int initProperties(); int applyTestPatternMode(controls::draft::TestPatternModeEnum mode); + int discoverAncillaryDevices(); const MediaEntity *entity_; std::unique_ptr subdev_; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 7bb39b1e..1cfb1781 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -161,6 +161,10 @@ int CameraSensor::init() if (ret) return ret; + ret = discoverAncillaryDevices(); + if (ret) + return ret; + return applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff); } @@ -432,6 +436,41 @@ int CameraSensor::initProperties() return 0; } +/** + * \brief Check for and initialise any ancillary devices + * + * Sensors sometimes have ancillary devices such as a Lens or Flash that could + * be linked to their MediaEntity by the kernel. Search for and handle any + * such device. + * + * \todo Handle MEDIA_ENT_F_FLASH too. + */ +int CameraSensor::discoverAncillaryDevices() +{ + int ret; + + for (MediaEntity *ancillary : entity_->ancillaryEntities()) { + switch (ancillary->function()) { + case MEDIA_ENT_F_LENS: + focusLens_ = std::make_unique(ancillary); + ret = focusLens_->init(); + if (ret) { + LOG(CameraSensor, Error) + << "CameraLens initialisation failed"; + return ret; + } + break; + + default: + LOG(CameraSensor, Warning) + << "Unsupported ancillary entity function: " + << ancillary->function(); + } + } + + return 0; +} + /** * \fn CameraSensor::model() * \brief Retrieve the sensor model name From patchwork Tue Dec 7 22:45:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15071 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 92EC3C3258 for ; Tue, 7 Dec 2021 22:45:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0E7C36088B; Tue, 7 Dec 2021 23:45:37 +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="QE2gnC0+"; dkim-atps=neutral Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1A5F4605C4 for ; Tue, 7 Dec 2021 23:45:32 +0100 (CET) Received: by mail-wr1-x436.google.com with SMTP id v11so708378wrw.10 for ; Tue, 07 Dec 2021 14:45:32 -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=s40Qz5XU25p4IgxDODpNYrDcHg3dsmQPysJpPQyJVNo=; b=QE2gnC0+MAV1TCRswDFTd52LSM5G1Um9QeQGC4+Efm4M6At0QDk73SaXfJ6X7SXbr8 NIO70OXoNm+iddP/2xlkeVZiB84N5pPRuj/CXhV6/3MtzzXBXgnsJfToEFFZ20sgt5aX NX51ZK5QVTEf78NKIMov95tap21ir+dcBrtOgGhukDrcsgnj79lpPL4uU92HXoTMm90r eR/Dm8HDY6EgtgJMG8GJKZYgFe7sgyJ+OBhVSnYSyTlk9P/tzew+UVoeQxxMeW23SpR8 nVL/u9tCt+9Ac2otqog1r4KnhdWhsxOrierwtGUpHhnf7sHuvcLzaGAF1CreCBJyB6BN lgmQ== 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=s40Qz5XU25p4IgxDODpNYrDcHg3dsmQPysJpPQyJVNo=; b=CV8E9fN8Ify7PX4x6FRwV9QxV0jhvyNQzsNjvNyz1QUsN3RYu8Aoet55udUAYnxtyZ vqaGjdgVzMXmgZYUG40sqJCwygdkWvKUU/v1aPl6ULjMOxVq+5O6p85zNNCoJ3ZMj91Q 4ae+HCd4m2GLvDhqTdc8wGW16OFWaTAYmx9ft0eIo+WXjbhqEq84qfmMBO6fD5oA2o1k tO1qLLTFezQW/5vnJ7uCUYaUVO+MB8eXb7jS6nVMFa5N/YCRyV70oyxPwFdpq2j6WFr2 LsWm39soY6qLD6xNC1kpKj3EfojMSzxqriCdPw9Hs9ZXVyF+XD4wB90Jze1CbFzFfIXe SEgQ== X-Gm-Message-State: AOAM532Qpusli6lyPjWsFdWIxfv1GRilg26f5EUO+JWqoYafVQ9E3m4Z 2EfKnwWXMSEhd378zYU+Hnwc5tm8W8g= X-Google-Smtp-Source: ABdhPJwemRCn6JPGWRNo5r1CrC2ZQvW/WRxHfPnr4f00xlmax9eiiaGnhr3C0ZE8C0lvQo8dp2wZCA== X-Received: by 2002:adf:e5c7:: with SMTP id a7mr55542706wrn.318.1638917131917; Tue, 07 Dec 2021 14:45:31 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 14:45:31 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Dec 2021 22:45:08 +0000 Message-Id: <20211207224512.753979-6-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 5/9] libcamera: camera_lens: Add function to fetch subdev controls 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" Add a function to the CameraLens class to fetch the V4L2 controls for its V4L2 subdev Reviewed-by: Laurent Pinchart Signed-off-by: Daniel Scally --- Changes in v3: - s/sensor/lens include/libcamera/internal/camera_lens.h | 4 ++++ src/libcamera/camera_lens.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/libcamera/internal/camera_lens.h b/include/libcamera/internal/camera_lens.h index 6f2ea1bc..64794294 100644 --- a/include/libcamera/internal/camera_lens.h +++ b/include/libcamera/internal/camera_lens.h @@ -12,6 +12,8 @@ #include #include +#include + namespace libcamera { class MediaEntity; @@ -28,6 +30,8 @@ public: const std::string &model() const { return model_; } + const ControlInfoMap &controls() const; + protected: std::string logPrefix() const override; diff --git a/src/libcamera/camera_lens.cpp b/src/libcamera/camera_lens.cpp index 189cb025..142390ed 100644 --- a/src/libcamera/camera_lens.cpp +++ b/src/libcamera/camera_lens.cpp @@ -139,4 +139,15 @@ std::string CameraLens::logPrefix() const return "'" + entity_->name() + "'"; } +/** + * \fn CameraLens::controls() + * \brief Retrieve the V4L2 controls of the lens' subdev + * + * \return A map of the V4L2 controls supported by the lens' driver + */ +const ControlInfoMap &CameraLens::controls() const +{ + return subdev_->controls(); +} + } /* namespace libcamera */ From patchwork Tue Dec 7 22:45:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15072 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 44FABBDB13 for ; Tue, 7 Dec 2021 22:45:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D0DA06087A; Tue, 7 Dec 2021 23:45:37 +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="bfoj0YwT"; dkim-atps=neutral Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E46906088C for ; Tue, 7 Dec 2021 23:45:32 +0100 (CET) Received: by mail-wm1-x331.google.com with SMTP id n33-20020a05600c502100b0032fb900951eso2869208wmr.4 for ; Tue, 07 Dec 2021 14:45:32 -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=s1xucXj0FIt6M1+ekbMacUO71Tt4NG9sYWi0tjjPPQ4=; b=bfoj0YwT7POVSzK89JzHSh6qNi0Hi7iBqWh6HFVAeIF4T5bWEh22dI6RbC6sYk9eDZ dvEN09cu6m+Dn0lr3nZjl62Y9Vca2KNdSuhC2EXhqF5O/9zVy22CBE2SDz6UTD8ZV4d5 OobN4BQmDp7Ag3qeytLhZkst70TFmucyxaSgtFaayaOCQ+kpDPcnZCVP1rV3V1poiW3b d29YTpCGdOy6FUcDeNlCG7fLz+p+h/n7itekPgdmzpbEOoqv5sqyi2vhDU7sRLDNedOi LqwQ5+dNX0cWbUn1uFCNq1LIXfIDfQL+xnZavlXdwynWN8Sx/iV7jsFx+/DmmZHuEdxq vyQA== 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=s1xucXj0FIt6M1+ekbMacUO71Tt4NG9sYWi0tjjPPQ4=; b=IXOXA8BU8QE5hzrjeRU77qXi0p4BwTRqJPldaCjbCYsY95uEv1YT423CVT3RUzI0ya KEg65OFzPTXbIL1BT58IKz2suFxPrBcyNlBrxrUn09d88LdM9CVaq7ePd7obV7u+V/3B +os3QqTUisrps+yNNQJMiWkNeZ+LYRoUsUm1lN/LoCZLEoqlGW2d93Dwq5xXRZ5V7Hmf OeMV0tTFvGoKVQXEJlMsUt4glb8KX0FxKBV1Np37pdwxZU0wRvC+QkIP3gOLhuxj5H8p cbT1tHWxAYuOD5taZ/WbgLZflu3Yp/J3wTqbw1hBKSI5dVamhYe81Dk42xWk2O7O+lGp S4AQ== X-Gm-Message-State: AOAM530h9mJgGoNWkNVZfrcZ+lyROTPWqCeXw8Cvfnd6Eruk0TIIEs7+ wWoBwW2Qbm3xwEaiNQtikoiksVr4Bck= X-Google-Smtp-Source: ABdhPJyj3whJKuXmyCQJU1CHuHNhQ7g0HD4gdFCuBnRyBvpeSfaYc3vbYyzHy8gYE1TQ1KrLc+ylcw== X-Received: by 2002:a05:600c:4982:: with SMTP id h2mr10687207wmp.4.1638917132733; Tue, 07 Dec 2021 14:45:32 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 14:45:32 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Dec 2021 22:45:09 +0000 Message-Id: <20211207224512.753979-7-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 6/9] libcamera: ipa: Add lens control member to ipu3 ipa interface 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" Add further members to the ipu3 ipa interface that will hold lens controls passed in by configInfo Reviewed-by: Laurent Pinchart Signed-off-by: Daniel Scally --- Changes in v3: - None include/libcamera/ipa/ipu3.mojom | 1 + src/ipa/ipu3/ipu3.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom index cc0d822f..18cdc744 100644 --- a/include/libcamera/ipa/ipu3.mojom +++ b/include/libcamera/ipa/ipu3.mojom @@ -37,6 +37,7 @@ struct IPU3Action { struct IPAConfigInfo { libcamera.IPACameraSensorInfo sensorInfo; libcamera.ControlInfoMap sensorControls; + libcamera.ControlInfoMap lensControls; libcamera.Size bdsOutputSize; libcamera.Size iif; }; diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index b7b48d9a..3828650d 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -162,6 +162,7 @@ private: std::map buffers_; ControlInfoMap ctrls_; + ControlInfoMap lensCtrls_; IPACameraSensorInfo sensorInfo_; @@ -422,6 +423,8 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo, sensorInfo_ = configInfo.sensorInfo; + lensCtrls_ = configInfo.lensControls; + /* * Compute the sensor V4L2 controls to be used by the algorithms and * to be set on the sensor. From patchwork Tue Dec 7 22:45:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15073 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 05D86C3259 for ; Tue, 7 Dec 2021 22:45:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9D7E760890; Tue, 7 Dec 2021 23:45:38 +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="gk4WY0qt"; dkim-atps=neutral Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E3A860890 for ; Tue, 7 Dec 2021 23:45:33 +0100 (CET) Received: by mail-wr1-x436.google.com with SMTP id o13so687745wrs.12 for ; Tue, 07 Dec 2021 14:45:33 -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=MoUOTTwrvQhKd1EX+dNibtVZY1zAHBq/9uhUx2s5dnE=; b=gk4WY0qt3nT9UMKGtwDke85QXpHIjTSe1cDfi2E3270V64cAsp0HnJCuatLzZ75mrj +r7k7Hp7DgTbcvDPRcl/5GLLfLnjzY9SuDxQh+LOFVOcAqXJR7JUzm0nsgydU/DXh4qX F1fEZKKxTzCZTuhr8m2Ot7bfP6kU/cPlmn3cbvV+S8Oy8Wkb7/Y2MypUCuCrgQYHoj9z 8l3XsWGAPnc553kAwZUAKBQZEu4PFDF/GMGO97+JvoJMfVqCaTYGzk5Q6xopxBfiaXEZ FovGp9GOgEWmSm8yRRBDFOQFtIGB+U2Er6loH/PxGBGIGt8WN7dSn8xBqBBTmmyxDCtS 7WyQ== 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=MoUOTTwrvQhKd1EX+dNibtVZY1zAHBq/9uhUx2s5dnE=; b=HlOSy10iKAHTMc9NyxyewjvJ/nEn6/mcqusdH1ObQRM05/vyAEVdUyuM6WS56rtP+e QSEyScmT2lAcuUE/bXPxO03tIOQLoD3yA42aKvL+m9UJoHNoXGpnmN2o03Dftrq+hwbr CWhD0sQlVVq4yQPHuVayFT7/m1+nWBrm7DjOTmpxJC6qy4INUMERQN7iyzaiUmuwQKhF giRuxkvy9/THRPffgf+9SkCisfLFI6qWe7LxPlQFYXGmdbNy3CZUZhRHKYQcLhHHj2We CNYCWF55O7Q2d0OSF+SWXWKQSC2/q1VtXMEJAOZDaL4kEMRr+5rn/oAeKBqWc4p4G3eQ L1GQ== X-Gm-Message-State: AOAM5300emIbs1zDGVGkNYIyvYTtJTFvaBZxNf+enf7p+4CylF99EGQ+ iJQpQLvCOscGAGDLn2JQYpinqOZLJmQ= X-Google-Smtp-Source: ABdhPJz1ZNmMllYqrtNvZz4ZQotNp2p1s0rza6RgBZ3Ka+oc5vqkPeagk0uMG8sisMps5V/G36mi3w== X-Received: by 2002:adf:dbcb:: with SMTP id e11mr52683403wrj.575.1638917133458; Tue, 07 Dec 2021 14:45:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 14:45:33 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Dec 2021 22:45:10 +0000 Message-Id: <20211207224512.753979-8-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 7/9] libcamera: ipa: Rename ctrls_ member 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" Now that we have added lens controls, rename the existiing member of the class to clarify that it relates to the sensor's controls. Signed-off-by: Daniel Scally Reviewed-by: Laurent Pinchart --- Changes in v3: - New patch src/ipa/ipu3/ipu3.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 3828650d..fe2bc3af 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -161,7 +161,7 @@ private: std::map buffers_; - ControlInfoMap ctrls_; + ControlInfoMap sensorCtrls_; ControlInfoMap lensCtrls_; IPACameraSensorInfo sensorInfo_; @@ -429,22 +429,22 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo, * Compute the sensor V4L2 controls to be used by the algorithms and * to be set on the sensor. */ - ctrls_ = configInfo.sensorControls; + sensorCtrls_ = configInfo.sensorControls; - const auto itExp = ctrls_.find(V4L2_CID_EXPOSURE); - if (itExp == ctrls_.end()) { + const auto itExp = sensorCtrls_.find(V4L2_CID_EXPOSURE); + if (itExp == sensorCtrls_.end()) { LOG(IPAIPU3, Error) << "Can't find exposure control"; return -EINVAL; } - const auto itGain = ctrls_.find(V4L2_CID_ANALOGUE_GAIN); - if (itGain == ctrls_.end()) { + const auto itGain = sensorCtrls_.find(V4L2_CID_ANALOGUE_GAIN); + if (itGain == sensorCtrls_.end()) { LOG(IPAIPU3, Error) << "Can't find gain control"; return -EINVAL; } - const auto itVBlank = ctrls_.find(V4L2_CID_VBLANK); - if (itVBlank == ctrls_.end()) { + const auto itVBlank = sensorCtrls_.find(V4L2_CID_VBLANK); + if (itVBlank == sensorCtrls_.end()) { LOG(IPAIPU3, Error) << "Can't find VBLANK control"; return -EINVAL; } @@ -467,10 +467,10 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo, lineDuration_ = sensorInfo_.lineLength * 1.0s / sensorInfo_.pixelRate; /* Update the camera controls using the new sensor settings. */ - updateControls(sensorInfo_, ctrls_, ipaControls); + updateControls(sensorInfo_, sensorCtrls_, ipaControls); /* Update the IPASessionConfiguration using the sensor settings. */ - updateSessionConfiguration(ctrls_); + updateSessionConfiguration(sensorCtrls_); for (auto const &algo : algorithms_) { int ret = algo->configure(context_, configInfo); @@ -669,7 +669,7 @@ void IPAIPU3::setControls(unsigned int frame) exposure_ = context_.frameContext.agc.exposure; gain_ = camHelper_->gainCode(context_.frameContext.agc.gain); - ControlList ctrls(ctrls_); + ControlList ctrls(sensorCtrls_); ctrls.set(V4L2_CID_EXPOSURE, static_cast(exposure_)); ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast(gain_)); op.sensorControls = ctrls; From patchwork Tue Dec 7 22:45:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15074 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 C39D5C325A for ; Tue, 7 Dec 2021 22:45:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5460060592; Tue, 7 Dec 2021 23:45:39 +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="nOSCQctt"; dkim-atps=neutral Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6AFB16087A for ; Tue, 7 Dec 2021 23:45:34 +0100 (CET) Received: by mail-wm1-x336.google.com with SMTP id i12so482685wmq.4 for ; Tue, 07 Dec 2021 14:45:34 -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=uxWeAh8AddECwF8byMMsyWIm2E9jJoMH1ttCbZiwcMk=; b=nOSCQcttndzAk+ibs/u3xgESsN/qiCxBfybCdJk7xPVPG96Mr1T307Xw4hcYVUVRtl YSQleA/I7fv7Lz9ti9R3RWNEcRmOcVOIxz3ZOt3+OJlwNMv6jMmtICLH3BctkuVE22No 9pD0Jlh5OXX0gSuO2LwQcMbWqVhWKjKPHC6H150paLVgPraM385J9aiHGBBVX5unc6XS z4cOFlDiLmCXb5R5AdA4Knmj2VDTy6VRdW8gye4lwFBnrBwac82FRIVzhcj+HcJwrv+3 5HytAJ7+LjnT10ClGCtj3vT6f5L7P5vfTEHBzIEl+8sSRnFz3TMh/6qLVVGIu6y/RxNH dNJQ== 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=uxWeAh8AddECwF8byMMsyWIm2E9jJoMH1ttCbZiwcMk=; b=bAreTVNL4irYhRtjnWH/KVz0ua26u70HRhBuKdEgsmDYwjBwNzzjMPVxbpdrlt5PwD nZdZsJY0ZCuhq2pdxhNmkFRZ9kPUmUsdLeOn2gE9ggT2ebjIKkJCpE0ZGwDnl86YfBuf 4IWs8ExAy1rtGYsEH83JfPk35ag+6gBP/3Gt+OI1G5VP6V/TiyxNMzktU0bbuSy0aAx+ AWNFrfpGdFZU8+ebb4rwpD1NkV4WnCvdushtoULRmbR8KmN0BX/tubtIwJQ33mLo46uZ 61qBymajxXwfeRRd5GBMxT9Nk7JnplduP0gb9I6PUdCJUwBFogWRyX9a1/C4xex8ckoA /FCA== X-Gm-Message-State: AOAM532QdPe07BqY6294rXSbp601NrDjA8jVQqBqhYkPSL0mpR+OVvxZ 9diTxswWd4EGG85eKUQFrMgXqlM9iys= X-Google-Smtp-Source: ABdhPJzx8ZvVLGVQMCOb6TEL9J+nH6GezH0/CWGKWFYMdMb1TONYIcZF94PWBsxHYOxgnGxqEth3PA== X-Received: by 2002:a1c:1dd6:: with SMTP id d205mr10493453wmd.77.1638917134201; Tue, 07 Dec 2021 14:45:34 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 14:45:33 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Dec 2021 22:45:11 +0000 Message-Id: <20211207224512.753979-9-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 8/9] libcamera: ipu3: Pass lens controls to config info 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" When configuring the pipeline we want to share the controls for any VCM device against the sensor too - pass them to the lensControls member of configInfo Reviewed-by: Laurent Pinchart Signed-off-by: Daniel Scally --- Changes in v3: - None src/libcamera/pipeline/ipu3/ipu3.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 31322062..03824eee 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -660,6 +660,11 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) ipa::ipu3::IPAConfigInfo configInfo; configInfo.sensorControls = data->cio2_.sensor()->controls(); + + CameraLens *lens = data->cio2_.sensor()->focusLens(); + if (lens) + configInfo.lensControls = lens->controls(); + configInfo.sensorInfo = sensorInfo; configInfo.bdsOutputSize = config->imguConfig().bds; configInfo.iif = config->imguConfig().iif; From patchwork Tue Dec 7 22:45:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15075 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 C9CF2C324B for ; Tue, 7 Dec 2021 22:45:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 589346089C; Tue, 7 Dec 2021 23:45:40 +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="Zr+UBnCr"; dkim-atps=neutral Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8E0096087E for ; Tue, 7 Dec 2021 23:45:35 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id o19-20020a1c7513000000b0033a93202467so568724wmc.2 for ; Tue, 07 Dec 2021 14:45:35 -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=fZJMVtaiYXJNmuxHjKmiZ52CB6MxgG93UTGQsfH/49c=; b=Zr+UBnCrxA1h0oPa6SstZYxGn5KEoUWDAT+KhAAb9BKwm6cNMVENxPjzDaUg6BFMNR gWPn3rqTW+S7cxt4ZiWWzfpyqKY3tuTHD7kxR2pwZh+T1qrJ99XRH3C15ZMCeyMxqJHZ FFIl0xfKgJiFSx0q2FsCBRf7JugIa58qvfNq6mSyx/ox+QFvi3HdcKBQOjsgtSUxrA6S a08iwt+O/hITdIn6g0Vtd4mt2GGoCL3oU7ZCMrg+H8cEjm5BxWqOPT83DzlpRMz5GReC y/ha+vThQzRhIwUHfs3wTZ/crVJZB3uTdFGPGFApmRXu2mFUcIYKVQrb03LFUIZvVxBL +PBg== 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=fZJMVtaiYXJNmuxHjKmiZ52CB6MxgG93UTGQsfH/49c=; b=lJog/em1Pz8lPm2ZncK1OSV2t+k+TAtTAv4KHlUMRjeyZxPM49JA7ebD2rww/Y1LUR QR3L4dLQ4fUDWGwxYAskg5vNKdpjW9Ebdm3+Gcgd2FBN1xuCFdB9S1GTHuevEp8KmFTb jCxZGjlgwSJrThHfh4+vSJ/H1d00e1iSg4w7eKXwoSR7R/sq8MGj3kDJhbLfyznjG7TR NfzUQ42PyWS90aZaVRPVccrfZ9aqZkFONf/MPOOpiKKlhcuXm0zAWnrJ9ThREcuuoFDu 4U4GnOXx8fwdGMC0bvYS7shw43wGq/2AHD+A+e02EdNdnv0NjR0VkAfFgTeq8Sk9sllh MEKg== X-Gm-Message-State: AOAM532wpf32NsFRBi7gN4mN9yfTIOm9kJce1LIwNHkheQytti5XvncH uknYiEm31Yd16UvZRxPNb136S6rQYmg= X-Google-Smtp-Source: ABdhPJxRxeyatjVzCPM5biWtxntc9xvjAyawsHaA1dL4LR4jueAT+l10gBTbxJG8gjv5yaDDP81Jew== X-Received: by 2002:a05:600c:2156:: with SMTP id v22mr11052243wml.159.1638917135329; Tue, 07 Dec 2021 14:45:35 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 14:45:34 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Dec 2021 22:45:12 +0000 Message-Id: <20211207224512.753979-10-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 9/9] ipa: ipu3: Send lens controls to pipeline handler 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" Pick up the focus value from the AF algorithm and send lens controls along in the frame context. Signed-off-by: Daniel Scally Reviewed-by: Laurent Pinchart --- Changes in v3: - Replaced the new focus_ member with a local variable. src/ipa/ipu3/ipu3.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index fe2bc3af..9303b33a 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -663,6 +663,7 @@ void IPAIPU3::parseStatistics(unsigned int frame, */ void IPAIPU3::setControls(unsigned int frame) { + uint32_t focus; IPU3Action op; op.op = ActionSetSensorControls; @@ -674,6 +675,12 @@ void IPAIPU3::setControls(unsigned int frame) ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast(gain_)); op.sensorControls = ctrls; + focus = context_.frameContext.af.focus; + + ControlList lensCtrls(lensCtrls_); + lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, static_cast(focus)); + op.lensControls = lensCtrls; + queueFrameAction.emit(frame, op); }