From patchwork Fri Dec 3 22:42:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15031 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 D0ED4C3250 for ; Fri, 3 Dec 2021 22:42:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6EC1060862; Fri, 3 Dec 2021 23:42: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="M4COUbxM"; 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 7F254607DE for ; Fri, 3 Dec 2021 23:42:37 +0100 (CET) Received: by mail-wr1-x42c.google.com with SMTP id o13so8618338wrs.12 for ; Fri, 03 Dec 2021 14:42:37 -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=V8oNqs2fQXGNzt40Dlu2QmXDBCzO4AairuuGrc097UE=; b=M4COUbxMyihwfX93+D8EfKXLwgcPac18fxKqE6/Ccvpoq8+azyOKPwuGhT4leU4qFr ydOofa/APIXJ9v22F/Ma0uPuF5W0AXj/0jTm0vwFQIZVPUE7fsP+cuScNLkFm48i8rhj v7+wQTYpqLVg7u60PoOenNNRN9vqGfG9CRq6MMm+s5+UEFtbQp+lRN/BmWf9su4KXerR ggCNXC3ARdKx1dW6YFi21oTSy8HfSRks1rb3ytyDSqIjZCb2nYNF0RTzkFXwkGDSYpiE pPxrT0yRlxaocFzoZEFTHMyHXOSVANqFGuQ73JZFY0zR52i2jlTCkWakBGjybfSt+x+D T9MQ== 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=V8oNqs2fQXGNzt40Dlu2QmXDBCzO4AairuuGrc097UE=; b=zdEICjv1EmepwHEs/qajHfX/fWIz376IGLafARwV/pIx0SzePMwJIPbJUJ+RF9lh+h p1SeiV/TOi6dRgYMTfoMEf5yIgkMlyp0A+E5NfmwSLaUHtqQUIpMdNaipyJzgbLxYmTG kVgCehENssGJm4UrVkm8ynVfopttsj12K+nXQ0yBn2pL3tZgKbYaDUUg2RjzW+dZAzZ9 RDiVrIUXuyHpoOAzJHxw5sgsVqHOc7ojUNAZzDLT3E/m2wHJxHqTKLq54u2Yk45ys4N4 yovyOMvOzglk5w/jSpZxJ3lAcQ5m96/pE5kmwXOCmZ/15bCIwhZvMtK6+EJ1m+hGLRax FQ4g== X-Gm-Message-State: AOAM532f4Mg6dNhsIk6KB8+P1+0i+3en1lGJ1UI/oHbZRzIQ9bspSb00 O69hujJ5hyEKDeuDZnyf1DvfAc+bcTk= X-Google-Smtp-Source: ABdhPJzO5K/0k1gCsQe6cu3ZWtCBR5TQXlQ7gyGKYIDWG29t8nz0PcM2tTN4+IAGwlDs85SitTDeYQ== X-Received: by 2002:adf:eece:: with SMTP id a14mr24112323wrp.333.1638571357302; Fri, 03 Dec 2021 14:42:37 -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 o25sm3939919wms.17.2021.12.03.14.42.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 14:42:36 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Dec 2021 22:42:24 +0000 Message-Id: <20211203224230.38700-2-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211203224230.38700-1-djrscally@gmail.com> References: <20211203224230.38700-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/7] 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 --- Changes in v2: - Switched from additional members against MediaLink pointing to the primary and ancillary entity to a vector against MediaEntity holding pointers to the ancillary entities linked to that MediaEntity (Laurent) include/libcamera/internal/media_object.h | 4 ++++ src/libcamera/media_object.cpp | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h index 90c63598..48616a43 100644 --- a/include/libcamera/internal/media_object.h +++ b/include/libcamera/internal/media_object.h @@ -104,6 +104,9 @@ public: unsigned int deviceMinor() const { return minor_; } const std::vector &pads() const { return pads_; } + const std::vector ancillaryEntities() const {return ancillaryEntities_; } + + void addAncillaryEntity(MediaEntity *ancillaryEntity); const MediaPad *getPadByIndex(unsigned int index) const; const MediaPad *getPadById(unsigned int id) const; @@ -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..42b26b07 100644 --- a/src/libcamera/media_object.cpp +++ b/src/libcamera/media_object.cpp @@ -326,6 +326,22 @@ 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 + * \return void + */ +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 Fri Dec 3 22:42:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15032 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 32EB6BF415 for ; Fri, 3 Dec 2021 22:42:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E8FB06086C; Fri, 3 Dec 2021 23:42: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="Tb9x/VUQ"; dkim-atps=neutral Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D7F8607DE for ; Fri, 3 Dec 2021 23:42:38 +0100 (CET) Received: by mail-wr1-x429.google.com with SMTP id d24so8825999wra.0 for ; Fri, 03 Dec 2021 14:42:38 -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=wP5Mk610fVyffoaymXg9kkRA0t99CmQnxwVpbCNOf7Y=; b=Tb9x/VUQBtlaNVLKp5EJLibqmDco3vTZeYCyS4mE6YEcX6+BXbahLzAw1RnV7E96DD gpJGLQbyn/kGE8itT+R7D1B2qB9PgudoObhmv4X7LeChpr5IRG5xqU/JKc8UwJtA/36W YHdH2EXbPPnPoadV1IxY44fW4s0nxI8kq9KUj7d6giDftnaK9voK4ClUCk3jcAdQ7L2W YCrUzPrNkSA7p4NLDeNYV8TCn03CTBsmXxMJNpaUjm9CsnMk6Ix3Ren1uYEkX/6NF4QU 3QOgtrlqC6fxQpE2/N3bzdKimbx4PUllrQv9HEg3hwjcZhPLNT3Te4iw7XbBX3iIg5TF VRjg== 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=wP5Mk610fVyffoaymXg9kkRA0t99CmQnxwVpbCNOf7Y=; b=jHXz3Zey1xX/IUqHq6+N4N6OHJ090kZoXa8C5bnYe1CvVJ9MBfE3AiaAqfIixoIQTr lI5gYhOF3eK9iGavteL49+1Xy79KN7cGsuNKp2l4/b58tgSR/yHpUI+popnkOHay5DCv GUxb7/oWb6FrAWiEAMMP1iAUvewt7uQ1E0PKOG1u7AFnj7+ebwB4QBtdNsF6dZpqVI5A pi5zaxnPMwkVBg0/Wql7jYcDXoNE6kseHSTTP0JORLu5iKTjuAWa8KsMWAAYpRrfaEpM XDTtSFHG63nAg4TaBQEyuo9Ces7pbQCM/q7jwmiAQC+Ga5UgzOvFddpZPQypfotbeHhW opMw== X-Gm-Message-State: AOAM531kh42as7ZXScRaVKuD7HE4bj2zolMQxa1AkolF0zf4CcxANy/v RhGixINpdaHh0eKQwmb5i1N98DCUXDQ= X-Google-Smtp-Source: ABdhPJx6ndwDfg6t88v4bUhLdjH8MtofNAIN2rdWuT5sXOHGC/rfY/aaUgdARio4tbFD2vcTa+TV6Q== X-Received: by 2002:a5d:522e:: with SMTP id i14mr24166634wra.43.1638571358133; Fri, 03 Dec 2021 14:42:38 -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 o25sm3939919wms.17.2021.12.03.14.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 14:42:37 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Dec 2021 22:42:25 +0000 Message-Id: <20211203224230.38700-3-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211203224230.38700-1-djrscally@gmail.com> References: <20211203224230.38700-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/7] 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 v2: - Storing pointer to the sink entity in the new ancillaryEntities_ vector of the source entity where in case MEDIA_LNK_FL_ANCILLARY_LINK rather than creating a MediaLink (Laurent) include/linux/media.h | 1 + src/libcamera/media_device.cpp | 46 +++++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 15 deletions(-) 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; diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp index aa93da75..6eddb5a0 100644 --- a/src/libcamera/media_device.cpp +++ b/src/libcamera/media_device.cpp @@ -699,45 +699,61 @@ bool MediaDevice::populateLinks(const struct media_v2_topology &topology) { struct media_v2_link *mediaLinks = reinterpret_cast (topology.ptr_links); + unsigned int link_type; + 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. + * about pad-2-pad and entity-2-entity links here. */ 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. */ + /* Store references to source and sink objects in the link. */ 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; - } + link_type = mediaLinks[i].flags & MEDIA_LNK_FL_LINK_TYPE; + + switch (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); - source->addLink(link); - sink->addLink(link); + break; + case MEDIA_LNK_FL_ANCILLARY_LINK: + MediaEntity *primary = dynamic_cast(source); + MediaEntity *ancillary = dynamic_cast(sink); + + primary->addAncillaryEntity(ancillary); + + break; + } } return true; From patchwork Fri Dec 3 22:42:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15033 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 902CABF415 for ; Fri, 3 Dec 2021 22:42:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5AF0760868; Fri, 3 Dec 2021 23:42:42 +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="hs147ox7"; 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 1FD4460832 for ; Fri, 3 Dec 2021 23:42:39 +0100 (CET) Received: by mail-wr1-x433.google.com with SMTP id c4so8639695wrd.9 for ; Fri, 03 Dec 2021 14:42:39 -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=b67B6PydBk9/XDflw+3N/GXguKDJd77sJVZ13CnMHl0=; b=hs147ox7cTI8S9DJKLAWxPUDqrAZ60rlp8gM4Ny1Hw9IxSSvgbxMxD/uB20qbGiJlV 0ByW5B8VVe102EtGsAst1OtB8/e+kuXG2ezTyDsVtCCKUurrljW3/YVmJMxnIPMdzHu9 CPJC8+Ig0RpaxCGyOf5IzODlrXxuLYNqdESG3LIOLp0VcWaiK2ZjqQUaMyVrWAetB8j8 mm0SB0db6nLMLNanipOcHzKgIOgpNFgx2qkwE5tnOVw9xpMko5YZW3/k0oVHoLFz/MxN nxwXlA0q2ElWcwox9Tc0+Ct+pLy73ujOX3J8zavW7Y4SbTuyPFp494GtHzbrj6ZMC3XL 18QA== 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=b67B6PydBk9/XDflw+3N/GXguKDJd77sJVZ13CnMHl0=; b=iDu6EtB5K594l1Fk5QY3FP2AKxXwpmj5jdueUL/cgNrXZjHHWCYXfhyUMPCH0BOmpI PRjem2yQakluiG8xbTBEs0gkzirZt1yVUbXEuvj5Fkte2iqrbWyvYLNNXTwFbKcYVFkq PcT20TlQbus9KG1m7P4fCMzNfggpIjdU0gGkJTAc5QYo9ML9aJWGBSG2wlvB/apn5+yM DHqgmm0a4PCBsb+j47edygVB1kqnYaGOfFfS3KnB+37OvcYQ+1sYfynRA1doRW8R4eB5 0sKXf2hBbUK+AzjEhAHMHX89eX64TnYQfessyEKQj6kf9axEqDc17SaoYhFLTDXOpE8d tFcA== X-Gm-Message-State: AOAM533V5TksIuPYtuGOPbYiOfng0FRdIFy7Dqzt1eHylNWTG3B7sGi/ zqJkakpBOMq4BwrAgs/P/ctgL4twjGk= X-Google-Smtp-Source: ABdhPJwmI/CfF5hPEW9xOZmf7yRIZItsw3/1dxOEX1Dk4UpVDbCtcvRXmnVfnOyzSb3s+nMee50VJA== X-Received: by 2002:adf:fd90:: with SMTP id d16mr24124093wrr.385.1638571358903; Fri, 03 Dec 2021 14:42:38 -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 o25sm3939919wms.17.2021.12.03.14.42.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 14:42:38 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Dec 2021 22:42:26 +0000 Message-Id: <20211203224230.38700-4-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211203224230.38700-1-djrscally@gmail.com> References: <20211203224230.38700-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/7] 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 --- Changes in v2: - Moved this functionality to CameraSensor::init() instead of the pipeline's ::configure() (Laurent) include/libcamera/internal/camera_sensor.h | 1 + src/libcamera/camera_sensor.cpp | 42 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index 788c2fa3..d329c512 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -76,6 +76,7 @@ private: void initTestPatternModes( const std::map &testPatternModeMap); int initProperties(); + int discoverAncillaryDevices(); const MediaEntity *entity_; std::unique_ptr subdev_; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 4c142a58..e1d4d424 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 0; } @@ -423,6 +427,44 @@ 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) + << "Error during CameraLens init"; + return ret; + } + break; + case MEDIA_ENT_F_FLASH: + LOG(CameraSensor, Warning) + << "Flash devices not yet supported"; + break; + default: + LOG(CameraSensor, Warning) + << "Unsupported ancillary entity function"; + } + } + + return 0; +} + /** * \fn CameraSensor::model() * \brief Retrieve the sensor model name From patchwork Fri Dec 3 22:42:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15034 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 383E2C3250 for ; Fri, 3 Dec 2021 22:42:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B36AB60839; Fri, 3 Dec 2021 23:42:42 +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="ZF4FovKS"; dkim-atps=neutral Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CBD8A60839 for ; Fri, 3 Dec 2021 23:42:39 +0100 (CET) Received: by mail-wr1-x431.google.com with SMTP id u17so1356889wrt.3 for ; Fri, 03 Dec 2021 14:42:39 -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=eUYEpbXyFsFKyKfSIdfaLFVI3cENzDs1rMMecgrfghk=; b=ZF4FovKSbtLK4mr6hJqr5lsxqdR/eYNoCN3DIep/lJRuD8Ci2G/4M6yVDKgP88lvvS iJ22EM/ozjNBBhGnWz8GYE10vgMOSqSneN4gBb+gze+6eniMFQuufjQlD0G1Gu3JWiHB FRCI0TWr35ma8fgEvZii1uH5btHJqtRoqDMuq5L4IalGZB8Rf6dL0lER6OCEF4ca/Y0V S7nJsbymqFVTRY1SbFICflm9J2Qb3V/o2zQPuZhhXyNpAycP8Gn3gfZwvXJW+8i4DyPr yHtW452p728+kL7xdKE6FMfwpdSxj9rUlyZKEX/QDZD0D0SdV4uPhoyFY25BFc5s14rj 5ezQ== 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=eUYEpbXyFsFKyKfSIdfaLFVI3cENzDs1rMMecgrfghk=; b=h8fpT4bKO9mYVNo5THBfDBsj4E30wOeIOdqmiDAo5QYjAfaB1hDPHzaLMJNUcxIMFt e0zxLHaTJ/C36fX9ZtbCskHZMeUc3oCPP60g2ff8IhSzvCLpIUyVakF4Y+YRZPUAbv9y OQTQSALva5cme0BLAJLyx/pbjCaLMU0Bu+DDDaX/6cTMiCk3BIfYN3ZXOuaO/BjgEY/y EYVhzTOkWMyogehSowVOlXn95YaKI2L0l33z3I505qJXTyL5eq2Kb7Yy0ZYkU2B+owSw o3HuZAbqdKIRcVBwo8S6xCc1HNFeodOpystxm96qY/yjmydsg4/2KoG2xeDzUvPrBKTl r8Xg== X-Gm-Message-State: AOAM533TBro/o6GrT2Gmq415XOQYERojjYs7vmLqCo/yCPZI5L3MtCle QMFSdteFz9wr+qe6TAaNcimrAh4h73U= X-Google-Smtp-Source: ABdhPJz2jgdmikadLUSy7ELyNpmlAkflZ+rlCKcM+llUmjYGejAF0d3C2dFvSp2yJj+5Q7yWCWhvHQ== X-Received: by 2002:adf:cf05:: with SMTP id o5mr24787322wrj.325.1638571359600; Fri, 03 Dec 2021 14:42:39 -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 o25sm3939919wms.17.2021.12.03.14.42.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 14:42:39 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Dec 2021 22:42:27 +0000 Message-Id: <20211203224230.38700-5-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211203224230.38700-1-djrscally@gmail.com> References: <20211203224230.38700-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/7] 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 Signed-off-by: Daniel Scally Reviewed-by: Laurent Pinchart --- Changes in v2: - New patch 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..7b3b9c24 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 sensor + */ +const ControlInfoMap &CameraLens::controls() const +{ + return subdev_->controls(); +} + } /* namespace libcamera */ From patchwork Fri Dec 3 22:42:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15035 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 EB743BF415 for ; Fri, 3 Dec 2021 22:42:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7EDF46087A; Fri, 3 Dec 2021 23:42:43 +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="XhKs6tSm"; 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 B07B16084B for ; Fri, 3 Dec 2021 23:42:40 +0100 (CET) Received: by mail-wm1-x331.google.com with SMTP id d72-20020a1c1d4b000000b00331140f3dc8so3304246wmd.1 for ; Fri, 03 Dec 2021 14:42:40 -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=qy80IB0hj+30GZcpPcUaOto0eNpJ4OUHDMk3aW6OLKQ=; b=XhKs6tSmg2MXyBPhjn8639AKxNQy93bDSPNfIfru1sRGuHuZym1dDy8p26/RplpbvD AOqBBR/lwFfFVYpNMw4xRohMMPmbA2ckB9Mm6Vk2IDZXYnKjfSu+SFCuICSQQ80XDbQX mkjUE8/ifL2+8EEHl7EtrYsz5XdTstYAS9FkHJPHXDR0TL66iHn+Dl2+UwGs+sAOhPxK e9zYhbd7KXSNw+4zMg5C5okZjM9pLrLPZI9dgb44bf9GvC1i7h/fcgh7fUjibPhGkoaf 1ebHEwx9iP7UxTWT4vFXLVboN4ljR8cP179pIffP3mvdKzBiwNe25/1nmr/vws3qi7u3 LYMQ== 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=qy80IB0hj+30GZcpPcUaOto0eNpJ4OUHDMk3aW6OLKQ=; b=w+bFsGdYpGLL65cNYllnzF0DFyPkWnBPmiEiTgmt4orZhmh0y0JVXJVDWcSJZGBEMS bta6qbbSSPuUhWdFyHlyKyd37uOFIcKIjisD9/ubZAz7/6cc/NYde3esnPPddwrXDKeX 4BeMcgvab1tBX6O95AGM00olq1BKKs1VY51uvU5QWEvdeefkXIGxDeq0+5AscaK07s/q PPdldgRIwgeCHu4aHbMEYWX8F1pRBwKRdOOh0AU54KD5gJ11vSQmQ69U098wnvUf47aE JR4ro51GlpzrjitEm/3UvKsnCF5QTilVIe0mIjNoMRgxtpkXmn07eoxUmdVpxjmFivbR il1g== X-Gm-Message-State: AOAM5318H900N1nCG6G5KVWeztNZqlLXFfv1WhzP+kxu5Q1lwegmSHLQ +lH22SG8calrARZkNPUsfpWa0N8yxqM= X-Google-Smtp-Source: ABdhPJwyUnMt8+wgl91HT9R00s5F2yv61mmzdlzvkiAcxDkbnqaINJRjcQMfdAxgXWXjsfRo1TK8AQ== X-Received: by 2002:a1c:7517:: with SMTP id o23mr18232950wmc.172.1638571360508; Fri, 03 Dec 2021 14:42:40 -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 o25sm3939919wms.17.2021.12.03.14.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 14:42:40 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Dec 2021 22:42:28 +0000 Message-Id: <20211203224230.38700-6-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211203224230.38700-1-djrscally@gmail.com> References: <20211203224230.38700-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 5/7] 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 Signed-off-by: Daniel Scally Reviewed-by: Laurent Pinchart --- Changes in v2: - New patch 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 Fri Dec 3 22:42:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15036 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 AF9BBC3251 for ; Fri, 3 Dec 2021 22:42:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6DBF560866; Fri, 3 Dec 2021 23:42:44 +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="hntaFjft"; 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 7178560868 for ; Fri, 3 Dec 2021 23:42:41 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id y196so3473513wmc.3 for ; Fri, 03 Dec 2021 14:42:41 -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=0WKidYMr4tP1cU3yTOjjBxaWyBicoAkXnprcx/zLHpo=; b=hntaFjft40kN1aAwgi8HsmqxwqYqKXFP8HoYTxNl/IV1FEuTmKYrHx8ciuiHQHlQEH 1INeBs/SzdFtgf8aNwmU2TzwnX878k63VH/ceLSSFmZKhojD7c5E+nKvCw/p/BLEljYJ zD4+U38tFbx3tkWJzuNIjurNPjQuUH7bZWB2bgryoQZFCoMDi7zBOk95B96k/06ruMkx e0oZgJ+CkKJtZyJdmZhWBWPAX8avn/r9r/9C24SNZD8v5StYnvLcx3q4g4oM9X1GLsrp K73s1g5yKKWCVKROmTjpj6pqwnqVHo8/jcBCvxWfU9MY0DKlV9KwNaGLPBL8VGBwIU9a VcgA== 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=0WKidYMr4tP1cU3yTOjjBxaWyBicoAkXnprcx/zLHpo=; b=02ZbgkcH0pnUd9RZ2A5CiSksTOcRuCcPdmBcdgIP8SPGArh2F87qTJCeguR9j5YT+e aeHIUmnqWYcihDUMV++Yi5Jivc338SX2wUuNqWkvacGfwv9xXExi/KxbE7IGSIaEtBTg qnZWj5GmwS4UO2ZH3oACcJD1wZD4Es8t+FrC/fOS0pjm8R3xjsBzBDUASTeRUilHu95h ZOa8IHH1lnnVFEegB7CpHuBVl/KkrbR/A8Q93aJAasW9DMkt5NZiFvsYhjaVmYoG+AEn aViVM7YZKMMu0Ms9Q51CQYpzwGiJSyCgiJ9364mFk4N8TPYhZ4FLyHS/T01awMOzNLw4 ir5w== X-Gm-Message-State: AOAM530QcSXL2hz4NOrw1lm6w3vKq3LXVzhslzahNQ952ZGgJgR34wFa f9Mtvsp47xcI+JxTbVd0Gtl7+DPYZcs= X-Google-Smtp-Source: ABdhPJwOciNIXK0LpdHONw0KrpGVgLHjMSOVMgvXcRpabNiRlKXtYUKCXg35gIL3idfPDxykYV37rQ== X-Received: by 2002:a05:600c:2e46:: with SMTP id q6mr18440188wmf.6.1638571361264; Fri, 03 Dec 2021 14:42:41 -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 o25sm3939919wms.17.2021.12.03.14.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 14:42:40 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Dec 2021 22:42:29 +0000 Message-Id: <20211203224230.38700-7-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211203224230.38700-1-djrscally@gmail.com> References: <20211203224230.38700-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 6/7] 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 Signed-off-by: Daniel Scally Reviewed-by: Laurent Pinchart --- Changes in v2: - New patch 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 1215bdb8..4386d3e9 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -656,6 +656,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 Fri Dec 3 22:42:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15037 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 399D8C3250 for ; Fri, 3 Dec 2021 22:42:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D3B876086A; Fri, 3 Dec 2021 23:42:44 +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="Z/doEwo/"; 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 8463360866 for ; Fri, 3 Dec 2021 23:42:42 +0100 (CET) Received: by mail-wr1-x434.google.com with SMTP id o13so8618705wrs.12 for ; Fri, 03 Dec 2021 14:42:42 -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=8BMguWwxIullLZL6opZ6tb3+ZmbY4ZCvkD3EpDSeXO8=; b=Z/doEwo/bl9xYnpCTSTEZcgkROPPqcH07AfsOmzAcgJBDJQxvFq8g/HUdCIIa8ihyC 0gxoQTuhNcF0TBmf/F6U47lMQv9pBk3fWQPt+4p+xjJtW600tFPE+YpNHI1ylApmKYau OMatZrfQU/GV0Z0Pj1802XW7w9bL1KlYrCHHPODCFWwfDS15RqmEFpI5OdnWPqmAlv3x 6o2Byg7yYObJLTIGsB1wIcTJABhbJh2dU0o2Fnhs8m7jfyQGgnxKrhtiAUM4cPAqFQN/ aE3ML1RcDMMEJiXFLo3oAjQaYZGRl3x4HNXzEDefZjn6Hi7WxHPrG8zoFsZ2SeswlTHM iDww== 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=8BMguWwxIullLZL6opZ6tb3+ZmbY4ZCvkD3EpDSeXO8=; b=JtLmlwNNovX12nPOIEdaaj5PvcQfBrVHeIPYfnB25G9eCCuXvWXml1VqronGyVFBtT ISFU7GwHUb9fg9V8VQi8PMC+MDSm05XNrI7GChLLWhTth0Km4/5MKbp/TvWz60irqZD/ dYtZUo4Ko5WVPu7wiR75WYH6c+QlmhBT201y1X3NioonMQhLlJ580G4RbstMf1TLj5Ts 1FimWKzYoBvml6SHUFMH9gXiAoTSej72NDFrMnJz+pChqR0bpRoRGrzFvF1ccEupMypt 6BK9ECvMLk8PIn1WZuxWUSLnuvDDjoUvsWTbGrJWtaMQ24WFy7dysDsm7pMVfGjMEIy+ UPiw== X-Gm-Message-State: AOAM531t21cxG0COMoA/eKS8WhMX36ftUNXr1znAwhSDr5VCgk8tB4h6 AF6BdQK10yH4ypz0vsKcw75Fuz563YU= X-Google-Smtp-Source: ABdhPJymWeBDgFT0MXZvq8FD53tCHvLK6Dfl3lI677TU7FU2ze0rJTgyctqFCjMiQLQa7cm0/0B0qg== X-Received: by 2002:a5d:59ab:: with SMTP id p11mr24757159wrr.340.1638571362247; Fri, 03 Dec 2021 14:42:42 -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 o25sm3939919wms.17.2021.12.03.14.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 14:42:41 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Dec 2021 22:42:30 +0000 Message-Id: <20211203224230.38700-8-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211203224230.38700-1-djrscally@gmail.com> References: <20211203224230.38700-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 7/7] 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 --- Changes in v2: - Created a ControlList to hold the lensCtrls (Laurent) 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 3828650d..5c57797d 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -174,6 +174,7 @@ private: uint32_t gain_; uint32_t minGain_; uint32_t maxGain_; + uint32_t focus_; utils::Duration lineDuration_; @@ -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); }