From patchwork Thu Mar 3 23:49:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15408 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 B1617BE08A for ; Thu, 3 Mar 2022 23:50:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B8DAE61171; Fri, 4 Mar 2022 00:50:14 +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="QhhSFEjN"; dkim-atps=neutral Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8CE2F601FF for ; Fri, 4 Mar 2022 00:50:12 +0100 (CET) Received: by mail-wr1-x42e.google.com with SMTP id x15so10119435wru.13 for ; Thu, 03 Mar 2022 15:50:12 -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=47iMjV3sq46sbjD6g6+N774t/fs+Sb4CTlcnefiJ+sI=; b=QhhSFEjN5gmRUsFpAyEzVOV3JS8w7Or3fAnbGrgC7uEo33wVxa8wFkR9/mEpmTyNoI QNLGwiVeWw8cC8GEaAsaLNB+ZR2/9ZbNLB04qb1LUZcQEO5zfm101ztdcx9bJA4OcI4G qkrZhfazN4F2QEp6oy9MqRiCMKG+LflxPmyDgbkAnVKqgE/6CgFmY66MtMdZTIMGEpaw AzrfdAm5F9ob39Byiv4T5toMvS/lifTqTfrT8ouGQVHrkjen0u+O5z3lP7psiOWEdpk5 30gCZI2VtkF9kIxMN6Ht1VEX41HMF0g23J9JmLAKScOAMni5S7OfCue5xL+no37GdV1x I7Ew== 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=47iMjV3sq46sbjD6g6+N774t/fs+Sb4CTlcnefiJ+sI=; b=AVdNLhM5alFmkhoGswqfw6zW80Lj66qds018RP25A87RZqfQjk8U4odXx6ggSv1/Ez mWK6cspRgsxWJk6uuF6ICyaxAjywIi9Ki5sbYoC+jIh0MFtYbxw9x5aX509PSFFIbVOe vvZmxLUE+LmlKVqlDPMcZZYVPNRjcpL2fZH8KNHIhhgFh0P2j0AOwIHDO7n5Cc03Gozp HJdpSzMe6Wo2Y+5XqmNAl7kOJU/Q3QJHry+gQmCKDUH424DY/pkiTtXda0+CJouwWNZ5 9HddCEAxEkAjCzzpenQnQq1h7OqmL0XC4AWrow0AnOUVfgOHVb6T2OemgT/mS+fa1rM2 JhhA== X-Gm-Message-State: AOAM5339oqSS0i8sNYctCeaWp2wDWK1NBc3iYU/43f3BjwB2Z/7HQW3B vcwWll1HqpG8gCqPbIS2BcpIyI56ZY4s4w== X-Google-Smtp-Source: ABdhPJylcY8FNLxAE3eDHI/0WZceqQ3YsyulVvU7wO2ke0VUKmlpOXzyKa9baypyJKWvKuGeIZ9gRA== X-Received: by 2002:a05:6000:1a52:b0:1f0:2d62:2bbb with SMTP id t18-20020a0560001a5200b001f02d622bbbmr7595440wry.614.1646351412234; Thu, 03 Mar 2022 15:50:12 -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 y4-20020adff144000000b001f022290737sm3079779wro.6.2022.03.03.15.50.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 15:50:11 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Thu, 3 Mar 2022 23:49:48 +0000 Message-Id: <20220303234956.1463551-2-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303234956.1463551-1-djrscally@gmail.com> References: <20220303234956.1463551-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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. Reviewed-by: Laurent Pinchart Signed-off-by: Daniel Scally Reviewed-by: Jean-Michel Hautbois --- Changes in v5: - None Changes in v4: - Reordered addAncillaryEntity() in the .cpp to match the .h 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..c78f4758 100644 --- a/src/libcamera/media_object.cpp +++ b/src/libcamera/media_object.cpp @@ -423,4 +423,19 @@ void MediaEntity::addPad(MediaPad *pad) pads_.push_back(pad); } +/** + * \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); +} + +/** + * \fn MediaEntity::ancillaryEntities() + * \brief Retrieve all ancillary entities of the entity + * \return The list of the entity's ancillary entities + */ + } /* namespace libcamera */ From patchwork Thu Mar 3 23:49:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15409 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 EA3F4BE08A for ; Thu, 3 Mar 2022 23:50:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5563F61179; Fri, 4 Mar 2022 00:50:15 +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="pNXseTOJ"; dkim-atps=neutral Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5951D6047A for ; Fri, 4 Mar 2022 00:50:13 +0100 (CET) Received: by mail-wr1-x42c.google.com with SMTP id t11so10159337wrm.5 for ; Thu, 03 Mar 2022 15:50:13 -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=QnXdcX18Y/j92doHibglgqw3HiQlI30jPX9vGitTXG8=; b=pNXseTOJOh+3rvhNeTi9e+UH8FCAImsnHjH8HepO0Nrq3jjNbpi7qTKMgPNyQseMu6 d98ylz9C45NXV2arRTu5HzsHFHZSIyThV9ZymBxVQecq45WWCVLa7M8jqucpyGWRhZdX vDPjTOwL2sWGXR8b5ybK+Lbus5rUBWzbvVDGJLjLu2kHyVg/0jqo8vc+Fevo2NXtKqUo OxyzgXv+4DP3B40fyNhSvebk7zMwgROVgIAA+3ebwlKSsodRu5N9oEUujnOBKbAvcMmW zz/AIa7Tm8T2eALuy//ro/fqKNAGGLuozyvomZcelCK3DK9ZsqJ7Necww/bDk1H+VFIu ywfQ== 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=QnXdcX18Y/j92doHibglgqw3HiQlI30jPX9vGitTXG8=; b=rNIbevlAoL5kP/uGmPzTbyXfgP7XYyvCUqk/VqZqrcPCTWjzw2yMGCQFprVZ2D3qCM FT/tyZW8tLsB/NJoD4b3X0langoQ1db48agIbUWFGZmrT/tHgqln9GOu7NaKERMHn3k1 slsGBY+JNs2rSP6UEFId4TQUv2iweidtxmsMZNZwEIZNNUlF1nYZtph0Ae7R/gOlMHjz zO19nH5vMsgB6Jk2T2qN+Qm5yYUg+Ib3PhT+f8pK4ef9xOXbQh2+k982dKQWHPXVtkDl Xf1r9RyZcfNZ0msURFXvtkkruL2cb9LX4ejdMxH7UyKOKNyXeYdJ/uqRiYjLar3UCOU0 XCSA== X-Gm-Message-State: AOAM530K860MGNWF5uNTHeUOmgnkgukX8yNJr2VMOIpWZ77NTmcZojzA jLLubCPK2LhpBbrloJlNIhXhfwP/qgBi1g== X-Google-Smtp-Source: ABdhPJyVsyCnUI+nVPj14xExTMwUY/IHmLHs/fP0TlMBqxhNNv3YKApkd8QZ9IyyiiXM8Ui1h2VOPA== X-Received: by 2002:a05:6000:2a5:b0:1f0:2e57:82ab with SMTP id l5-20020a05600002a500b001f02e5782abmr7519951wry.515.1646351413101; Thu, 03 Mar 2022 15:50:13 -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 y4-20020adff144000000b001f022290737sm3079779wro.6.2022.03.03.15.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 15:50:12 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Thu, 3 Mar 2022 23:49:49 +0000 Message-Id: <20220303234956.1463551-3-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303234956.1463551-1-djrscally@gmail.com> References: <20220303234956.1463551-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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. This isn't handled as a sync to the upstream header because the macro is not yet upstream itself. The latest series attempting to add it being found here: https://lists.libcamera.org/pipermail/libcamera-devel/2022-March/029120.html Reviewed-by: Laurent Pinchart Signed-off-by: Daniel Scally Reviewed-by: Jean-Michel Hautbois --- Changes in v5: - None Changes in v4: - None 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 Thu Mar 3 23:49:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15410 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 E0D0BBE08A for ; Thu, 3 Mar 2022 23:50:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CE4F361176; Fri, 4 Mar 2022 00:50:17 +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="pdagp9Qx"; dkim-atps=neutral Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7F37B61166 for ; Fri, 4 Mar 2022 00:50:14 +0100 (CET) Received: by mail-wr1-x434.google.com with SMTP id u10so8512640wra.9 for ; Thu, 03 Mar 2022 15:50:14 -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=bytZg0LZdg13NuH+aLz5Hfv65SKmuD+2gMC0l8UtcCI=; b=pdagp9QxbQdh4oZbOEcMRi148KelyNBhJRvFDQFWXzkoedUVRJp14SrqYa1UyL1jA0 RctAyNuChhKZF0XHfc/qK3UJa/2rb6fVVpBkSXmJWYdK36L/kz9ANCuifO/BpNabUajb kOddIaUB6QNlv7pbK5P8iNWzpDxcEKkazBLZhj4TIzumcfewul7btXh2a2WV/iNUK84K MvTjqTAXii7bmMErmp5/EylX+TW7c6z4xBFpCovUisoSF5JDm8JhKJYZrue8EJxuyJpi KKO4JkpXamKoaD4QZnsCtLaQZ2LTOIk9uLFe8hPm/JrVq7/A/UhtqzGMIbvkg5ZnuX5j 9Weg== 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=bytZg0LZdg13NuH+aLz5Hfv65SKmuD+2gMC0l8UtcCI=; b=hTAD2VUB4uTDOJPgUBcjukoqGIQNp4jXTG46WVYNQ67iGH8NgrTFSQnabr+g5Qxid7 PF66vY3gNtRvTXaZvYZ3QO3boa1AZ0s5Vl6B851yS2nPGEpe+Usettmj9Y9UmNY75LwS ZmGZgv1XvPyfuhh+j+4yxG1X+jr3lSi+Zll5a6+L5ms/P9pXk+s8ECcbEOw/IoCvrT7S seGZrGOOL2J5QiNINfO5PlXtB6jWQYtxUo96NWrmSonblJVKtcw0zEewVIx+N79sfqdE kofyjuleBOwNpciUawR1quHdf8ciGi/EOYBP8zcXnQ5uKXKKog72kOl6BSpos67lnJ8c Eugw== X-Gm-Message-State: AOAM531rTHLDmxYIoVfrTVVEFqKCM/Majv/Bd0quCqollJZ5K1J1myd7 jBMEsN/6GE6pLL4T951D6MvmRcffdkS/1A== X-Google-Smtp-Source: ABdhPJxc3Mk24QXDC2PfJPGzY7H/AiRGAjAWU03fT0L+D5sPXyVLaPMRcGob+tOji8a2YpxDwXc+gw== X-Received: by 2002:a5d:6d88:0:b0:1e3:37c1:3633 with SMTP id l8-20020a5d6d88000000b001e337c13633mr29122338wrs.484.1646351413966; Thu, 03 Mar 2022 15:50:13 -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 y4-20020adff144000000b001f022290737sm3079779wro.6.2022.03.03.15.50.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 15:50:13 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Thu, 3 Mar 2022 23:49:50 +0000 Message-Id: <20220303234956.1463551-4-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303234956.1463551-1-djrscally@gmail.com> References: <20220303234956.1463551-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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. Reviewed-by: Laurent Pinchart Signed-off-by: Daniel Scally Reviewed-by: Jean-Michel Hautbois --- Changes in v5: - Fix some formatting and comments (Laurent) Changes in v4: - Added some error checking to confirm that the casts to pad or entity return valid pointers (Laurent) Changes in v3: - Split out the new macro - Fixed some style errors and comments - Added a default case src/libcamera/media_device.cpp | 64 +++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp index 941f86c2..7c94da9e 100644 --- a/src/libcamera/media_device.cpp +++ b/src/libcamera/media_device.cpp @@ -683,40 +683,72 @@ bool MediaDevice::populateLinks(const struct media_v2_topology &topology) (topology.ptr_links); for (unsigned int i = 0; i < topology.num_links; ++i) { - /* We only care about pad-2-pad links here. */ - if ((mediaLinks[i].flags & MEDIA_LNK_FL_LINK_TYPE) != - MEDIA_LNK_FL_DATA_LINK) + 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: { + MediaPad *sourcePad = dynamic_cast(source); + MediaPad *sinkPad = dynamic_cast(sink); + if (!source || !sink) { + LOG(MediaDevice, Error) + << "Source or sink is not a pad"; + return false; + } + + MediaLink *link = new MediaLink(&mediaLinks[i], + sourcePad, sinkPad); + if (!addObject(link)) { + delete link; + return false; + } + + link->source()->addLink(link); + link->sink()->addLink(link); + + break; } - source->addLink(link); - sink->addLink(link); + case MEDIA_LNK_FL_ANCILLARY_LINK: { + MediaEntity *primary = dynamic_cast(source); + MediaEntity *ancillary = dynamic_cast(sink); + if (!primary || !ancillary) { + LOG(MediaDevice, Error) + << "Source or sink is not an entity"; + return false; + } + + primary->addAncillaryEntity(ancillary); + + break; + } + + default: + LOG(MediaDevice, Warning) + << "Unknown media link type"; + + break; + } } return true; From patchwork Thu Mar 3 23:49:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15411 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 8211CC3261 for ; Thu, 3 Mar 2022 23:50:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5639B61182; Fri, 4 Mar 2022 00:50:18 +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="Rm9zDpkt"; dkim-atps=neutral Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1FB0E61176 for ; Fri, 4 Mar 2022 00:50:15 +0100 (CET) Received: by mail-wr1-x433.google.com with SMTP id bk29so10163872wrb.4 for ; Thu, 03 Mar 2022 15:50:15 -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=128dFyAg2PNBEd0fhzKmD9q8NNW0ZCeVDo9P+9Rq/4c=; b=Rm9zDpktK7Ias0l7VjZ7Bdz1EtYai+HxVR3h7S4v1daWHz3pJ2e7rdB6Z9fpyVeo5N 7CPU6oQYNpSBkRVHZY5kEKu1mmQQIypmQbBN+fzbLUKoNDks7oWB5Qw3gAOs29pzMACt BLvBl7AS6vAm1n/vcEMFAdfFqojriQXYFYnIzLkFCyRsf6WYvtIS6+Ckj1rLIZYAZvO7 IREdVkItqFB+P/e9Yw69gaJwoz106A9VCIu5/rXR5HQePHScmfELvS1KYUWdsfFHsUaD smNM0tRCSGcqjkHTpLXnSwESJi/35keqEstohSPJeEMygJtfno/BjDQmVjS0k93Jtzpm uqgg== 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=128dFyAg2PNBEd0fhzKmD9q8NNW0ZCeVDo9P+9Rq/4c=; b=Ar0Z8y8lm5pdT52fxUaJqRSq9VEZx31o+tvIsHdZcAGOjIFBNXRcEcuiXwaERs7nQz qBiNBwxGyTgSx78jZp0xOh+0tHw7qtVFWK14ITMDUzMlCBiknsf1L8o/Zr11FUBFUGmV qXq1ExXDbKCpRNfQ5BkeO4JijWHVBSgXOsL5O4PDUcM625vwVLHKSipvDwefzaHpJS+Q 0mFIIh109jp/HVlOaG+S68Hf9NzxAowAicDYVZjjBiWG4eJGmRYb3Wlnv0EHpsUzImOR mvGFNC9y7++C1EIIOzgxqXZ/WtmK8DyedsN9OaA+qkaxzx5zaRS/Kh1hD5AoT0BMKgRK 8APw== X-Gm-Message-State: AOAM531fT3LSGlIuUjSnhIaLgMfNPWFdJUKXkHkfZhdokCn3jd01RIql a3tcO3nYG4PpPnOO9ArBX311SIEHXjPAgg== X-Google-Smtp-Source: ABdhPJwjffwdFySYzQElizKhQ2O5qmZhT79Kklg2SZ+wB09F4tvok3AOFQfVEb2A65av+t1pCAfXKA== X-Received: by 2002:a5d:584d:0:b0:1f0:48d9:692f with SMTP id i13-20020a5d584d000000b001f048d9692fmr5555003wrf.566.1646351414835; Thu, 03 Mar 2022 15:50:14 -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 y4-20020adff144000000b001f022290737sm3079779wro.6.2022.03.03.15.50.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 15:50:14 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Thu, 3 Mar 2022 23:49:51 +0000 Message-Id: <20220303234956.1463551-5-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303234956.1463551-1-djrscally@gmail.com> References: <20220303234956.1463551-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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(). Reviewed-by: Laurent Pinchart Signed-off-by: Daniel Scally Reviewed-by: Jean-Michel Hautbois --- Changes in v5: - Add a break to the default case Changes in v4: - Fixed typo (Laurent) 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 | 40 ++++++++++++++++++++++ 2 files changed, 41 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 64f7f12c..8b4406fe 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -172,6 +172,10 @@ int CameraSensor::init() if (ret) return ret; + ret = discoverAncillaryDevices(); + if (ret) + return ret; + return applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff); } @@ -443,6 +447,42 @@ 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(); + break; + } + } + + return 0; +} + /** * \fn CameraSensor::model() * \brief Retrieve the sensor model name From patchwork Thu Mar 3 23:49:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15412 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 1795CBE08A for ; Thu, 3 Mar 2022 23:50:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B749E6117D; Fri, 4 Mar 2022 00:50:21 +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="qiX+h+Ic"; dkim-atps=neutral Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DFBEF6115E for ; Fri, 4 Mar 2022 00:50:15 +0100 (CET) Received: by mail-wm1-x330.google.com with SMTP id i66so4061253wma.5 for ; Thu, 03 Mar 2022 15:50:15 -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=twowYbzifRY45WIFOEBJ8E7Wqy3IcerLbWOdfwHLE5A=; b=qiX+h+IcAFN0A3D19EfFx99ui4fN9Vm3Cd0KnV4Iv/mjIdAAPktaxbxc+q/mudw2aG G/vMqzum95RruyA/caF4Ha2FxRsF9swU7jzKVkSpGM3AKn1nN8/XY9JlohUDue8kjS1u 48tyb7GHzETKvDbo8pmU0vlz0oAQYgijmW/bg3x+YEsWdSJktCwCpoh4Zj6tr6I2dufw 0CwCGVOfI3fLNUBCZo8k3xgFYYAEbygzgvnPUgVYcFb0x2Ee49RNlDKrGOTuV+UFAlnh Xy4wiXIJAl//k0rq/WuRQEYkOdsKXBVPHswshNduL3BBa/mqrMMOb0oxDjXX6mG+0ISn lMIg== 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=twowYbzifRY45WIFOEBJ8E7Wqy3IcerLbWOdfwHLE5A=; b=vhJ9QLeRGQAkGcgqnptfsE8mkd+ejNsT7U/fpSaH1z67vcaIq0OEsbm7OVbjqxImHE pwQXMIEs+yTZZ6K48HVXOgpciAU7VOKLqWQbljJrZ3+VYoXtiRLdveewrijP6hz/nBhr FtABgLaZ3sBl4+qAvkktkVBnuVKsVrRhUxojFwI/EvShMHW5B5Q5wBhezqX1Mm9cKVvF jgi6RKFgEj3QiBRa5SWRbVfIRugZ7uX1GlCeD0wuUXdVLrqJHNoJyirNv5edpWRctyfr OMlg/xvKQsksH+OwmqVkxtZnOqIBkrta593vG3oPfpbmwppn4dghk2BXXpjpwAgOd0Av B2xg== X-Gm-Message-State: AOAM532Y8KwClHYrbqNqb45aGF+jKL5NLi7E3zlAkymiWMKBdGHOAykF K0dCFnIMcGH9ayb5Ix54e46kWvwmwWQLhA== X-Google-Smtp-Source: ABdhPJyq6mKQZ2Q6hfkreeOJqQGO8RsMt5o73LfdkZ6vJ1XQGWjlsf9A9LjTUguowUSk9fJJqpLLUQ== X-Received: by 2002:a05:600c:4401:b0:387:1bcb:af41 with SMTP id u1-20020a05600c440100b003871bcbaf41mr5191796wmn.101.1646351415695; Thu, 03 Mar 2022 15:50:15 -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 y4-20020adff144000000b001f022290737sm3079779wro.6.2022.03.03.15.50.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 15:50:15 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Thu, 3 Mar 2022 23:49:52 +0000 Message-Id: <20220303234956.1463551-6-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303234956.1463551-1-djrscally@gmail.com> References: <20220303234956.1463551-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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 Reviewed-by: Jean-Michel Hautbois --- Changes in v5: - None Changes since v4: - None 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 Thu Mar 3 23:49:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15413 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 A3015C3261 for ; Thu, 3 Mar 2022 23:50:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3EA0661191; Fri, 4 Mar 2022 00:50:22 +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="iSE2M/RI"; dkim-atps=neutral Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BAF286116B for ; Fri, 4 Mar 2022 00:50:16 +0100 (CET) Received: by mail-wr1-x434.google.com with SMTP id d3so10170062wrf.1 for ; Thu, 03 Mar 2022 15:50:16 -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=WoqbY1BZWhs2mt4/JE/+3IHD5MvVw0hkaOsxP+mksXM=; b=iSE2M/RI6UXXOtAT0qriNzJViwbwHCJtrnNUVFZPmcPq2gqGF2y4R9qvmJDYehIiZl 5irWq+80qZSmZQHIZNhBqbO1tBQK7HEsYHwkxeiaY6c5SrDPblrRXJRpdqganmld+VOH zNL6u0pBo2yNg8e1CTWgBfXLlHDvblqIRJQbGlPTXaDR5NSedLiriprORYP6KpzZGnE5 b0eqoWB4NmH5XkUkuh4wOxBPiDbXKGoRpBUlxomZC594QxnrsJDhcKS2GUcUE/yLWgZ8 azMbFlFqC4v4SyK/a9xvnnXR2Y7FuKw04nENGzxssrMjo65OZc1KDR281T4jL/weatqT yDJg== 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=WoqbY1BZWhs2mt4/JE/+3IHD5MvVw0hkaOsxP+mksXM=; b=Cy1X7oDuFRCq7yA5BXrskxoIwApFwQikAt5cH7FbNB4uRyPMzGJNOJD4iqZvGMYqmO ASsOhwmVbTKHQIuaHOoGYb4hydd8Kj9efhkJkSY2FHsPTCDRXBJhoBtnSORP7iAsn41q ilBeR8mallrCepQjG5zT/L/ywWxjDHtC3ApvNUXCJFIGuddY+ffV2yUtbJK9YVtRTkW1 FXGp8WyporkJyCEebVh/7kIPGxsUcbbjsCzYJSXSRLIrcVN/uddyVqWhzmF3zoqnS95H dF0x+t3MX3GNm7/cAkrC+wVUvQw4k0Nu5nBx1vFyeyv6pcS7k/MhOr8k/88PrWsdN2iY HlTw== X-Gm-Message-State: AOAM5310HQ4RNre5yLMLm3WBCTahNtbzFd1pP2qtE/wdIEEW7CD3z6YT g0RE1Wk/RjNdLnMTmOSb3RxpBHI3bhCKag== X-Google-Smtp-Source: ABdhPJza977agO6u47q/dnxseFn17+15gwlAx/FOVSYxNySJZuGmaBhSUAPuAX7Qoqjxph+pMn4kNQ== X-Received: by 2002:a5d:6d4e:0:b0:1e3:3636:b104 with SMTP id k14-20020a5d6d4e000000b001e33636b104mr28480437wri.605.1646351416558; Thu, 03 Mar 2022 15:50:16 -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 y4-20020adff144000000b001f022290737sm3079779wro.6.2022.03.03.15.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 15:50:16 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Thu, 3 Mar 2022 23:49:53 +0000 Message-Id: <20220303234956.1463551-7-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303234956.1463551-1-djrscally@gmail.com> References: <20220303234956.1463551-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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 Reviewed-by: Jean-Michel Hautbois --- Changes in v5: - None Changes since v4: - None 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 b5149bcd..008f93a7 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -163,6 +163,7 @@ private: std::map buffers_; ControlInfoMap ctrls_; + ControlInfoMap lensCtrls_; IPACameraSensorInfo sensorInfo_; @@ -450,6 +451,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 Thu Mar 3 23:49:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15414 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 A4162BE08A for ; Thu, 3 Mar 2022 23:50:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4B9FB6116E; Fri, 4 Mar 2022 00:50:23 +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="hElCWrVd"; dkim-atps=neutral Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9318261184 for ; Fri, 4 Mar 2022 00:50:17 +0100 (CET) Received: by mail-wm1-x333.google.com with SMTP id m42-20020a05600c3b2a00b00382ab337e14so5072104wms.3 for ; Thu, 03 Mar 2022 15:50:17 -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=ddSe0HKy7Vddk2WXwI75i30bm3UafMYEjd1HK05iugs=; b=hElCWrVdQCzC1j9oFf7jSRC5rRqt+ttTCiGHHbMCaEcSibtDRYnTnWshQsJY/tVNSo qrbwyraLQHvZNqn+DpTuQbT4W+wGTwAd5jexcOMeJoOAAkuFV7nWfTWMD4Tg9GKuVID4 EYGvH/BIQPVVmbwR/eEiCCTeFmAIpXOgwaxNOl91YwD3v/fw5coREjQ/VPn8dgVk+zpB Dt/hveFPQCi5Q6DFQTBg+40fzroWpcun0PmmsR0cOmx02KWpZljGY/zGEei3V6tpbU3V MztpitE0tvBmWvnnr6ChLzKdNnDibYrNs/C0B/RJLqSf/TykxFrnFgD9RGup7cmZbM++ W9EQ== 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=ddSe0HKy7Vddk2WXwI75i30bm3UafMYEjd1HK05iugs=; b=epNu+OX1Ho5SvjLcmhK7yCOEqK9SuzE5ZolEomQXSMmbr57wDSnxkyd1545bqJB08o 1BS+Bs1Ek/t3XV5NP3bQoIlz/I/X/OOFPHFxjqm4bx9CuwVyIuH7ocPQUaHT8GCfnIV7 yI6WNVxlw3SOr7PqN7AUCvJV05oc1DmpSl887GgGxlVflFTPdttPc8n0o23IK9w23q98 BLgbyYw+ZxUQI9QN8PCBJfcPHWoJq0YzPwK3wA7TwgWn51vmAaR2oPeSH1SSYA/8G1y/ L1k03i3TgOpngExNi5h1Po5CkSP6nUpiuBV/CKXw7KdXq9gGffTzdCKL59cBqY9tZb2P lIcw== X-Gm-Message-State: AOAM533CI7OSqC0hRVsUhhaOIyZu3WGjRXjfZ+wwA9oNJkXePjPFNDEj P3vFv0QX6Oxiz1RCb8OkTcs8wU4n5ada1g== X-Google-Smtp-Source: ABdhPJxgXXS9SyNDkqikeu185KnyxK3L4mOXDVL29jCIAa2kM6sZwPK83dNigq7uU2mj4DwmNYppQg== X-Received: by 2002:a05:600c:1d13:b0:389:7a40:56e2 with SMTP id l19-20020a05600c1d1300b003897a4056e2mr695216wms.69.1646351417317; Thu, 03 Mar 2022 15:50:17 -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 y4-20020adff144000000b001f022290737sm3079779wro.6.2022.03.03.15.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 15:50:17 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Thu, 3 Mar 2022 23:49:54 +0000 Message-Id: <20220303234956.1463551-8-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303234956.1463551-1-djrscally@gmail.com> References: <20220303234956.1463551-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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. Reviewed-by: Laurent Pinchart Signed-off-by: Daniel Scally Reviewed-by: Jean-Michel Hautbois --- Changes in v5: - None Changes since v4: - None 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 008f93a7..e539d875 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -162,7 +162,7 @@ private: std::map buffers_; - ControlInfoMap ctrls_; + ControlInfoMap sensorCtrls_; ControlInfoMap lensCtrls_; IPACameraSensorInfo sensorInfo_; @@ -457,22 +457,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; } @@ -497,10 +497,10 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo, initAfGrid(configInfo.bdsOutputSize); /* 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); @@ -699,7 +699,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 Thu Mar 3 23:49:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15415 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 37762C3261 for ; Thu, 3 Mar 2022 23:50:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D219D6118A; Fri, 4 Mar 2022 00:50:23 +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="R6w+3yMG"; dkim-atps=neutral Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 573626118A for ; Fri, 4 Mar 2022 00:50:18 +0100 (CET) Received: by mail-wr1-x42f.google.com with SMTP id u10so8512792wra.9 for ; Thu, 03 Mar 2022 15:50:18 -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=+daEI5+GW8ZpSPL+i4m+9fBs1QBP6dqnssl9Ql77R8Q=; b=R6w+3yMGeyLDx1eYKAGv4i88527ewRrXR4SOt5sFEfAwjjBePqBac8uinj5+X/+s11 3r1X0O+8y/H6vneD6mtnEP+3AluNzlrweKB++FKv5fdKAAd6jSAJ4b+N7MRNDSJtNRYd tkee4eSZCai17Q1JawiNLY1+RHKyIkiIIO6hFIYDzkiGH8X+EROJxZNgpVAGwQOcVGRQ 78IzizntuMS/3wPF87556D71C/179nSCljKjO+0WXr4vfIjmCpXLmehYpwt9ZHTZya9n 7P6AyeJgVczc7VGiqbM7Zdg7GTLcTpWfIk2hI0V6L7q5sKRKhPpkftkA5rNO2nv4wGTq gohw== 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=+daEI5+GW8ZpSPL+i4m+9fBs1QBP6dqnssl9Ql77R8Q=; b=DuWdo3nP2xkNgOWaEPd4fAe6bvQWkJVv8XjA53fq+PCOqKgJgfp0MhRsZUa4yfmTh9 uxxrmtjdIoq9A5vAORkvST6uzAHWlGpoflD5MPGNQbhfA6InKG8VWmoA7blWF55S5GuG CDdIms0MsrtlcNsANRvYja2+Vi9DVpAvA8AIUM5Eo+6NA1fCiRiOSh+cnVtTnvjJNqCC AQBSmI4SR67o/zbcw9TMfgnss9fnVaDxlxBUgZ3YEcwEWPD6YlgMCGF564MDE+4lnWrv YIO9g8OI7+jRbHd5TwhU+r8m3qIWS9XBXEVb+MsygudbjG6fmjoUt9ZOr4sgkbrt4RZK Rq0w== X-Gm-Message-State: AOAM53246h/PWbpVo7B9790INNFWRAR1f1oJuV78wambgv0wrnNmLGKL C0iIYgtLnjFcqwMyVS/Z5Q6KkvsEB676+Q== X-Google-Smtp-Source: ABdhPJxo1zLyH/LqNLukmKP7KvzndkeaaibTn6Le85J46YHUR9iMcTOjBUHrvyO6Zv9gQJj9Ub5nkw== X-Received: by 2002:a05:6000:1c01:b0:1ef:95c5:4dd6 with SMTP id ba1-20020a0560001c0100b001ef95c54dd6mr19178732wrb.671.1646351418114; Thu, 03 Mar 2022 15:50:18 -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 y4-20020adff144000000b001f022290737sm3079779wro.6.2022.03.03.15.50.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 15:50:17 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Thu, 3 Mar 2022 23:49:55 +0000 Message-Id: <20220303234956.1463551-9-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303234956.1463551-1-djrscally@gmail.com> References: <20220303234956.1463551-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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 Reviewed-by: Jean-Michel Hautbois --- Changes in v5: - None Changes in v4: - None 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 6c5617cd..b3199aec 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 Thu Mar 3 23:49:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15416 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 A166EBE08A for ; Thu, 3 Mar 2022 23:50:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 63DFD6117C; Fri, 4 Mar 2022 00:50:24 +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="noxKmMvh"; dkim-atps=neutral Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 40F7E61185 for ; Fri, 4 Mar 2022 00:50:19 +0100 (CET) Received: by mail-wm1-x332.google.com with SMTP id l2-20020a7bc342000000b0037fa585de26so4609116wmj.1 for ; Thu, 03 Mar 2022 15:50:19 -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=xyaLrzB7F7z64em4nulRSPztY9ha3Adj1IEIasZ2qeM=; b=noxKmMvhdrMvAqmOaJ4fHQaBn3HXrGsPkKlj4Eu3MmkB76t3YDbaKsWFUcV4sgxDil Rd9FWvb6teDVU8G1ic1C7WIjnLpe+J8xE+Q9XDPF5vkZkbQBTg5fqRKxtrVcA3ZtwQf2 7ZQ52Tx5CECOA4L6kcHC/aEN8IK4e5/Ppyof3EWSD9PyTHpasJQWAGW+go5y4agD7pD6 RN3YR7xX9MS+HrxLn2EC213b6NaQIhNuIjSskTPPS1kNReBBCMt7TPUUIedX8Ml6eHR9 s17J4MBIbG3VlcVIPyxSJaciY4KqAepkCQI/sxglPKxJMjk7zt8SQNReHeWViPndMreS xn5w== 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=xyaLrzB7F7z64em4nulRSPztY9ha3Adj1IEIasZ2qeM=; b=5UUnWlc59Zo6zdNwCr/giwaU1lmQXd6c4tbOLMrAOQ+2YzyzJQJm6AZxU/McJszLMY 9xdXWT2+HOOA+ofmipcl24xwGQxUndZQ8W8XMkxt1G1i4iDmTGln/6dokvcXZr4/krOC +7rMEbNJAlahC/fHtOsacXZ+27IQedV4JjrGHQxKzZFpVreSdEKeY1YR5avOmXDUQkZA joDCujoALNvJzIwKswJUTuJ08hNGOTVXRy58GYGkeVYWuE+dvQbK/QpW5l2wjEf6EMUz hv9D/Rx5sbnla9KiPKkK9UzBOaO4q0Awh1wxeOgjIAJXUaZGaSuSXmt8R/uMyt2ZgILP wiHg== X-Gm-Message-State: AOAM532z4Z1qp9eTLlJ6vKrNqnaQyNhGOrocyeFcXLSWTQwChDJY/Rs6 HRP3rnyrTdW9EKYQIcxU9in3GvfT3SbIsQ== X-Google-Smtp-Source: ABdhPJzNcCWwn+b0N6IG1TPQJPDWsUOsQALcMlY6fxNARxRmAmCng35ePn0dypDV1fwRhkvOfCdpvQ== X-Received: by 2002:a1c:1907:0:b0:380:f6ec:4daa with SMTP id 7-20020a1c1907000000b00380f6ec4daamr5821262wmz.50.1646351419039; Thu, 03 Mar 2022 15:50:19 -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 y4-20020adff144000000b001f022290737sm3079779wro.6.2022.03.03.15.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 15:50:18 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Thu, 3 Mar 2022 23:49:56 +0000 Message-Id: <20220303234956.1463551-10-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303234956.1463551-1-djrscally@gmail.com> References: <20220303234956.1463551-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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. Reviewed-by: Laurent Pinchart Signed-off-by: Daniel Scally Reviewed-by: Jean-Michel Hautbois --- Changes in v5: - None Changes in v4: - Got rid of the focus variable (Laurent) Changes in v3: - Replaced the new focus_ member with a local variable. src/ipa/ipu3/ipu3.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index e539d875..b8c4b30f 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -704,6 +704,11 @@ void IPAIPU3::setControls(unsigned int frame) ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast(gain_)); op.sensorControls = ctrls; + ControlList lensCtrls(lensCtrls_); + lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, + static_cast(context_.frameContext.af.focus)); + op.lensControls = lensCtrls; + queueFrameAction.emit(frame, op); }