From patchwork Mon Jan 31 22:33:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15306 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 32CFABF415 for ; Mon, 31 Jan 2022 22:33:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DB24F609E2; Mon, 31 Jan 2022 23:33:45 +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="fEO6xrvb"; 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 DE54F609AF for ; Mon, 31 Jan 2022 23:33:42 +0100 (CET) Received: by mail-wr1-x432.google.com with SMTP id s18so28228913wrv.7 for ; Mon, 31 Jan 2022 14:33: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=kR6FDelfycjqbXUHFAs0pKqRKAejjwQRsAXvRMXiUww=; b=fEO6xrvbdTIvnUbUOllWymRbVOlf6+EuK4cR+Jhct/ufygPXuQ/eMfqOQ0oRFRNLuA SJCaSTSc67lzjZ8BAKSCD2CvaZv6fes4+dtQkEiD6Yslv65Clb274PDs9HwcAFvJN4gi Aza6PAKegWdWn3d2y5jSscRxxkDCnb2qu/jr+WuZx0rOfgTo3oP9O/tfsqk/yaMLmuPj EXCmHP2UbGjkqZr1s48LK8MFFe9te+vFyKH4GMscrR+r7nRbUhaLjiFheJfHv64rlnqF nsKxufFze+9SI4TjhjXiE8bGp8YjEu1FpgGrz/72ekbyNZ9qW0A8bfej39v3wvQoXZiL etew== 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=kR6FDelfycjqbXUHFAs0pKqRKAejjwQRsAXvRMXiUww=; b=8CemlZgKqRERhhLG6BmqYXlG0/EKby+FgepKC07Qp2VpWRMKGuaII7kyjg4IDakJdh ypUM2lIPAk3i2EoxOjFGS8ZT0mw8s/k+2e7QIEmXYOVj1N5GvG6n6xgHRw8GvuJV3QAf fwS/yRYnwoKyVLejb82Rc2TqnMIdp4SH58pLAYnSITRe8PaMGAUg9K9tG7v/IIgDDyJS Gx8+RxoWDyKDAVvFMom1DcyS80MUXH51uuoHigmX8yuiRzcSuM5+jMsHwRtpc/guzgN8 MrV0LGWuRdnnM4EhCSQFooiOkSXm+Bdd1+AD7Sm6w6NyG6Gr7n+vKlyP3cE+edqEG/13 p7zw== X-Gm-Message-State: AOAM532jXYJD2trqhh98z0RXot23HBU2ZdtKSmhmyNUEO27e3G4hjF/i YKh2WWJHofvpldc3y3uy4SUN434Lq+c= X-Google-Smtp-Source: ABdhPJw1p0fAA/X0+wFMXPyKDkbVkysUM8xeqZLFM8eyiWfDdNVr/fq50SeiIxbZ4XGXpAQmFguW0w== X-Received: by 2002:a5d:6e12:: with SMTP id h18mr19269583wrz.674.1643668422705; Mon, 31 Jan 2022 14:33: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 q2sm6986740wrw.14.2022.01.31.14.33.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 14:33:42 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Mon, 31 Jan 2022 22:33:22 +0000 Message-Id: <20220131223330.61563-2-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220131223330.61563-1-djrscally@gmail.com> References: <20220131223330.61563-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 --- 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 Mon Jan 31 22:33:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15307 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 00B5ABF415 for ; Mon, 31 Jan 2022 22:33:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A4633609E3; Mon, 31 Jan 2022 23:33:46 +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="UKrwvxyp"; dkim-atps=neutral Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BC2B8609C3 for ; Mon, 31 Jan 2022 23:33:43 +0100 (CET) Received: by mail-wr1-x42b.google.com with SMTP id e8so28326343wrc.0 for ; Mon, 31 Jan 2022 14:33:43 -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=RLz+Cbyz3ajt5SvJ7TpoTQLuzbG5xQOjWLQ9MMiMDm8=; b=UKrwvxypg0h2pvOyPFvNWPsjhjjCPJGDt83Ma6bSZ0PIDzDnYcGEJ6nJjzQgETAwsz lJmv9PAKubjwb2FiRloirBGrhLdWZzN48R3bOzVMySJoA+p+XZw53uqvtYAZZcwvZizD ePV/lBI4UJacxAkZFI0zR8rdI94jkR6oXH2KnSJTqLd7RE8TzinnjUzyFlxKDfXsBnVs BxPEhU7s7zzAYs3VDO8cVNz7iHfTEETbULiayI3M7XOvSrCRZLKfIoZaOYCXKg0QhHCv MCK98YZKJZ17cAVZf8dR4lArO8ohlPndC6K7OJ3dpmgUll5XPRZyrllyqzwGVCr+mo5t /pgQ== 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=RLz+Cbyz3ajt5SvJ7TpoTQLuzbG5xQOjWLQ9MMiMDm8=; b=4GmhyPMLbbhNwXWGjsEReCE6PtjM5xFWf/RbxFZS4e/6/ExUDY54TNT0E7BHFVesdv 7VV5dWWuk7uNC/ltDfuhJw7+1fuMwkZHoB1nBZV5obx7AXuzCUOmoolEtmsEBJ7HsQmf oFxXbLruPMBR8QUjbfLaFyErqYLLeholNqULewphIOp+WshTLJyIYQAEn+07OtGq8CCt gcSRQGpHhO+jjFCljVcEGMuYgpt3FMjBYULxI0QfrjEMwICMBALiwxAikKC8lR/YTJcF hbLIN4pFxor6fwrTYCwWg7sBtATIM1nIqWM7kGYX8zrggTsE36a/XkyDW4HlGqngdT17 A65A== X-Gm-Message-State: AOAM5303Cn/F5i+jdGdA4P5lfqAjIMy6zeBBX3LjOOU3tRuPcT/KndFi YpMCtgP0BreTpaE05mvHYmNoo0wFe9o= X-Google-Smtp-Source: ABdhPJxQUlYlIho9OiepNegH7+ZK01A3Xf6f3HG6oGLUf1/Ack+v9M18yrSP1s1BdAVxbRUoOUEQ1w== X-Received: by 2002:a05:6000:1107:: with SMTP id z7mr19104929wrw.189.1643668423487; Mon, 31 Jan 2022 14:33:43 -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 q2sm6986740wrw.14.2022.01.31.14.33.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 14:33:43 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Mon, 31 Jan 2022 22:33:23 +0000 Message-Id: <20220131223330.61563-3-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220131223330.61563-1-djrscally@gmail.com> References: <20220131223330.61563-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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://lore.kernel.org/linux-media/20220130235821.48076-1-djrscally@gmail.com/ Reviewed-by: Laurent Pinchart Signed-off-by: Daniel Scally --- 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 Mon Jan 31 22:33:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15308 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 9230EBF415 for ; Mon, 31 Jan 2022 22:33:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0BD19609DF; Mon, 31 Jan 2022 23:33:47 +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="mn+YxDR9"; 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 953E6609C3 for ; Mon, 31 Jan 2022 23:33:44 +0100 (CET) Received: by mail-wr1-x434.google.com with SMTP id w11so28233005wra.4 for ; Mon, 31 Jan 2022 14:33:44 -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=MLw8XqYeW+4rASHT8E3MhoWoR6/A/q1gRfKWOUu+JEA=; b=mn+YxDR9kPorHx2ga/gPs4RxhA2jHMUOEEKrZkb5H6pts2Xk9p7ESo82lPk5qD6+th 75O86Pm8p6vmQsE0WTFsS2mXW4OGHKoA1IzwyGuHbDGK5wuJ/xPtVae2GjRBrbimcaVn aQmB8JvKkK/y/XgrxduYqDe7IZyZ1uVAOPmyjQLEhgYsP6JfqPaICeY65JQxq4xh/O7q JvWBr9vQ6wvZ+5ljbf5FphG3URzNeBxIrmb6cxv1HKS8iiFgYw5gvgsDJ+d5ao19UKo4 CwJPL2YLQE5hmeyW2sdvIBTCvBXVk3bsYQUXD+07N1shPx0xKgJEivN1q/MnqpZ9jtzp 4qCg== 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=MLw8XqYeW+4rASHT8E3MhoWoR6/A/q1gRfKWOUu+JEA=; b=1zggPbzYwAJttFVSYKwKNkebHasZC3833daT9sS6H+durikPE5RbbGeEj5m9qh/zuF fOR9XoOaQ55ggmgWPvb2/WFv13Tr22cR9kT/EGKRkCXLI0eyBibJzn3DH6rM5R8vJdpr BGsFvfnhIQS3VW4dmidsLFji8DH/DMcue9HAkFfEpC0CSVew80xucVZDWdhBSVPybgAZ r1Wr1q0ffFya3s1AKSrm77a14Vf4PvLwXhw97Mcg6QRE0IAWK90KEviphWvKxvVhTcGy kD+m654gJFzsjDCP5L6kJuZz78FGaHRWe3UNJmyRiQ02xGqv6uAzBZzrP+I6QtrxH6ip sC6w== X-Gm-Message-State: AOAM531aGoI7iwjAqbbMP89FHx6bVey8Q5giMeOe4BVfmWJEa6yGrDIx kphrtLgBgDeYaMXXGDynQIbhdq1YKAk= X-Google-Smtp-Source: ABdhPJzYUydD4H2mlGVBAHlxQ8pE5At1Bb9LWWPfCEzH293Fn1WjiGp/tJCsDItcyIltcr7Cm9eHag== X-Received: by 2002:a5d:64e5:: with SMTP id g5mr11419465wri.541.1643668424398; Mon, 31 Jan 2022 14:33:44 -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 q2sm6986740wrw.14.2022.01.31.14.33.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 14:33:43 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Mon, 31 Jan 2022 22:33:24 +0000 Message-Id: <20220131223330.61563-4-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220131223330.61563-1-djrscally@gmail.com> References: <20220131223330.61563-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 Reviewed-by: Laurent Pinchart --- 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 | 67 ++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 16 deletions(-) diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp index 941f86c2..a008383a 100644 --- a/src/libcamera/media_device.cpp +++ b/src/libcamera/media_device.cpp @@ -683,40 +683,75 @@ 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) + /* + * 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: { + 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; + } + 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"; - source->addLink(link); - sink->addLink(link); + break; + } } return true; From patchwork Mon Jan 31 22:33:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15309 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 4A93DBF415 for ; Mon, 31 Jan 2022 22:33:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0E28B609D6; Mon, 31 Jan 2022 23:33:48 +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="UWFLZmzS"; 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 684D3609C9 for ; Mon, 31 Jan 2022 23:33:45 +0100 (CET) Received: by mail-wr1-x431.google.com with SMTP id u15so28289166wrt.3 for ; Mon, 31 Jan 2022 14:33:45 -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=NlysUB6FBhVB8yavInpASF7jF/JylVh3ZMvCc4z37Yc=; b=UWFLZmzScSLwcK0xM1JgyBU5raDsjFAa433mDHU6b7vIUnwkcwrDKizz/m+aqIRdtf 3cZN3qUKlE0XvrFW3c7DcAG/CydC90clBq4A5wywpn/iba2HoTOYkFaheUta4IeR5uNS zfLymiPWofW4rI/79yTGjjXkoARjQuPCsEnjb6wMLm8ezG8O/InEgGptMy9tS8ivzYq3 iUgy24FgdM8oApRimZhA3opKdoovLC34QGtWm5M+ox5MzbTE03XQwO8v581Z+D4O94oe DbHji206E538tI6nH7Jecl2UsnJrQoz58wPqOLkHSe+m9dXp1iy4ld9I4AD0WZZN1EvG 8qEQ== 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=NlysUB6FBhVB8yavInpASF7jF/JylVh3ZMvCc4z37Yc=; b=h3RO7f6/dY5pEujnji2zAT7UjnhNeY62WIRDrd/UGnBeF9GrTi+9Wi4ZbujqNzTlKi Qxr1/NEochF2T99UBSvZPUtGBd0KeJxtcnun+p/yl9+yoo9oenpXIF0GwFXuz6GwJiCB OlHjY0Gamptu9eaaJtdc/raGonB8QCvst/S1UsPkZVQjUcvd/NdX7e1Zu1U/Y7s7Z1U1 RTkPPtvrg4Hb0vbyeYypIjC5yy+L6NXle+yXgul2yAotNkkdiQodWdf4lN4aOrO2nKdi nqaCLQGy5HTPb0SW8OdL8Wlu+KvMCpwb70IDdwOWI2LQU0DapOIiaW3KWX+8VkmKXi2v ePKg== X-Gm-Message-State: AOAM5311Pek2hNWIryyGrb4U33/HbKvPy01gq2epOI672t6C/I1Vf5B9 VwKGnwrb14lcc6uWkMwW/uM8jFzwJl0= X-Google-Smtp-Source: ABdhPJwvNHMo+lzyhw7f2P6N/fZhsxR6yfIJNJ/q/Y3rzIsJzXzb0vtMOJf1G/Kq9Nh6/X4Sn9VLgg== X-Received: by 2002:a05:6000:c2:: with SMTP id q2mr19255937wrx.85.1643668425221; Mon, 31 Jan 2022 14:33:45 -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 q2sm6986740wrw.14.2022.01.31.14.33.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 14:33:44 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Mon, 31 Jan 2022 22:33:25 +0000 Message-Id: <20220131223330.61563-5-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220131223330.61563-1-djrscally@gmail.com> References: <20220131223330.61563-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 --- 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 | 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 64f7f12c..f00c0aca 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,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 Mon Jan 31 22:33:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15310 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 9FF5DBF415 for ; Mon, 31 Jan 2022 22:33:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5C8FB609E8; Mon, 31 Jan 2022 23:33:49 +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="qWSnFyBJ"; 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 81A6B609D6 for ; Mon, 31 Jan 2022 23:33:46 +0100 (CET) Received: by mail-wr1-x432.google.com with SMTP id e8so28326509wrc.0 for ; Mon, 31 Jan 2022 14:33:46 -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=yFC5s+Pzgarvt9s+APTlL0sMrtYNwNCuu7nzx0YKnEQ=; b=qWSnFyBJEVRAbITvVhOQr2q7FS0USxZ9/MSMHeZVYmsxe7G96FL+ZsgDV5KrcRISZ3 YjvPOgLaY2j7Lv+kMbFaIttUfKdS+92b6uH09XP95p3TOwE3XJtfu3kc2BGtaPyW9WEt LMALMCIy4aS7tU8cPh/uxleHK3I7JeYMXXh0beH9oheN9KPIguikZesZFdPedGQcjQld dZ4N8DlEysvV5q1Oi0FPmTL027dbaO0s1vu5EwXKG/6BiLbdAV+2cjjBAOAlZKaPbP8U MkGxLZAcB+N/NmyIvNjNN0SEP5SieyYNc6spU7aVsucX2PTxCFkV3aiw7P9rEQlLxoB2 sASQ== 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=yFC5s+Pzgarvt9s+APTlL0sMrtYNwNCuu7nzx0YKnEQ=; b=tEehKVhGpuqzkSO7udg4d3ecx2X0PvMw337xtXAliPz8cTD6WhXsrbQ1w7eas/wRBp H4257Z5GjCudD8ZdynBmP2ojTmvph4cOy1xwqtsJzsO6zcb7IaU9UtEC58C4N/gv1Mf4 RMiou18fqYkdc/6nQXSAKwpmmD9dLYrlYwjjf2aQ+EaaV5apKQeX9oraFQJVBuDwAxKG FFaJ1Cu/CI0pBy15SRYTEY0eKRVPmzaqjbZTsN/1m90fvQXHQ47bW56pH1Y15+WRbwqZ K/HWFfB1C2hPbHdEbC8gp5mxVdhr8tme14mYhT1xzBEVDf3DJKN8AFlQemtq9vfuSnEA ymoQ== X-Gm-Message-State: AOAM533TIP/hhZ33+uj7PhZ60hw5lRLREWHCg2kI42KV4jHes/446hZ+ 9C0SclosKV0pMfRjC5pkZ7VZF+L4Fcg= X-Google-Smtp-Source: ABdhPJz0qFROFTUn+CWhFu0uQD7PSehdYFYqZZrA0Go2FSPjdI14BP2Na+neXTg5fm/kdJqy3J3jAg== X-Received: by 2002:adf:f8c6:: with SMTP id f6mr19286877wrq.290.1643668426330; Mon, 31 Jan 2022 14:33:46 -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 q2sm6986740wrw.14.2022.01.31.14.33.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 14:33:45 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Mon, 31 Jan 2022 22:33:26 +0000 Message-Id: <20220131223330.61563-6-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220131223330.61563-1-djrscally@gmail.com> References: <20220131223330.61563-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 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 Mon Jan 31 22:33:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15311 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 06C58C325A for ; Mon, 31 Jan 2022 22:33:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BEC48609C7; Mon, 31 Jan 2022 23:33:49 +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="AUx+Q5nX"; 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 5C743609EA for ; Mon, 31 Jan 2022 23:33:47 +0100 (CET) Received: by mail-wr1-x433.google.com with SMTP id e8so28326548wrc.0 for ; Mon, 31 Jan 2022 14:33:47 -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=CN2Z8QoM3E2akRLSrUKptfBqOnf/BP1kVA/6OXokjQk=; b=AUx+Q5nXySVdD//PUByhv5+KXPIYkGbfnhmf0gaXEp4gRkwO7ZVjDWzfPi2Um9baxh E5INLdblY4b1GhxfSLts+zdYf1Tmi2edaQxANE4jX1MNKBSI55umd1i12X8QfunSnQRQ AaI2+OjUwoxWq//jCi3YDNZBXyJlWfKIHBlQoGPteHf2qNzccQIX8JqyETHLPbyr8Wwx DcUyru0WUrqAfTWx/C5Xqwfp5+wZ4943jh6kZ58so5waFQrPU1eQVQCif68tel7PY/yk ai6gBKevlYw6EotBNEJirIXNxVFpAhlnMqQuYgFviR5kJnFXPvBvjv0tiVC5ZWb800of SHsA== 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=CN2Z8QoM3E2akRLSrUKptfBqOnf/BP1kVA/6OXokjQk=; b=wc38vD2wnmlZTAoTx+MVI7PtDpeLCbdlktsjQx1U4puROUn6bQeSZI789Konh4tUtv ctpfUuAtlO+mm6Yza1k+5xDCdhyM4kz8nvU9ApkeDugOZNPiqnhYJB1KWfau2I6+H4AU e7oIuhIJcMWxG6YWPKxxwsgQOSSi+Ad6CUHv7wnSSvqhdAhdcCZuQk4flBWRX4ZJax65 RbhsfnJUHpBgiYrdoXsFTRcCyhDTN4EOUVYuq9lodjIw3br9JRlylCvxGDrmo8yHsIJ0 2UxfTbeQCZS0MnK6Xo3c8BLdVFidPF4wsWUTrUaJGHCkoTMUZXrk7MlcbJnKedTFq3kK vX0Q== X-Gm-Message-State: AOAM532bWVTH7kDFq3bSCJ0hpeLnT4bIbBl//iWaM8WfxZXfR4K1QKGf oXYWZHx1Mh6s8CZbbb5QQVw2FOg30Ag= X-Google-Smtp-Source: ABdhPJxI4vS48z3J226RzuF927nG6HB7WDSpMRu3/iNE+9xVKPT+5G7DWBohfXT9qYokvp8Ze9N8YA== X-Received: by 2002:adf:ee8b:: with SMTP id b11mr19482283wro.430.1643668427171; Mon, 31 Jan 2022 14:33:47 -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 q2sm6986740wrw.14.2022.01.31.14.33.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 14:33:46 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Mon, 31 Jan 2022 22:33:27 +0000 Message-Id: <20220131223330.61563-7-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220131223330.61563-1-djrscally@gmail.com> References: <20220131223330.61563-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 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 Mon Jan 31 22:33:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15313 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 294D4BF415 for ; Mon, 31 Jan 2022 22:33:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D43CC609FA; Mon, 31 Jan 2022 23:33:51 +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="EeLoXCdX"; 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 2F39C609F1 for ; Mon, 31 Jan 2022 23:33:48 +0100 (CET) Received: by mail-wr1-x436.google.com with SMTP id c23so28257136wrb.5 for ; Mon, 31 Jan 2022 14:33:48 -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=a0eL5HQHRoXB9E/Y6c0MyKFED1EQZfQMYgzFLROVJnM=; b=EeLoXCdXuUjKR++R3tcaGkO4LSaF83wJkKPFYgzoZaEQwAZVIHpjh3SULybCm3ByJz kB8ApqJxVtdZTAmGt/OgHzFqx3a2ilJO57b4wvfFfAuLDzdrkuEowYLAkDnsbEHERu4R BWKS1G/38I0kCUf6QSBS4U941aHe5byujLAO1QjooqIu1OXrfUB2eC4r7mHr0vCAXI4E 3xCghQq3P7XW3VevixmhrwV8M/hxfmHcwsFH6sPCXI23TExlvtOzPZoBuxF518N1Tv4w oTv9unqpQzlGhfG4KJMWB+wBXIhrBnZEv/ZUtKVKdbCJNOGPuF6iYy0z34sABqzb/cnA tg8g== 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=a0eL5HQHRoXB9E/Y6c0MyKFED1EQZfQMYgzFLROVJnM=; b=T/c672u3CHXaUjg/mqaxwjVuF5NUAN/C65Nllv00T11+4heUweY9jEP02d1woZTbNg eVpr7Fn3ePTCqRSQ5k32GxS6zq2FzobCH1ZYGcXwNQSBg7E2nJburDkylPDc6PNWj4GT mJlDyn7duFppqlToiZcx7SBRiQzE9knagyikV9sADNTabz99fItvkAQH8yGdci35Qr+T wvNB3/HogpqfwWszD+V/m0+hwWe2Ygx+A2HPOaSw2xcSCt80SamZAf4sIBXJcREyP1yh WNz31SOBEHTelpLSQtBa54q2ZsQ+yTO+pTX6FiNiST69oDQQ4I80gri7J+z3jcnazPEV g/KQ== X-Gm-Message-State: AOAM530aomsZ4odZil6LbbTtpj2+crSqMpIYmrUrXOojbct6xYhiBxQg OEGHXjpOc3ru8TbBW4PAP8YhglM9i9o= X-Google-Smtp-Source: ABdhPJyPLYvdq2eDIWp15pxmuu5Q5yJyjvjCIQLTuxE9pkmDrh3VyCl3goXmWQJNXg/TUzqroW3r3Q== X-Received: by 2002:adf:d849:: with SMTP id k9mr18722791wrl.366.1643668427962; Mon, 31 Jan 2022 14:33:47 -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 q2sm6986740wrw.14.2022.01.31.14.33.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 14:33:47 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Mon, 31 Jan 2022 22:33:28 +0000 Message-Id: <20220131223330.61563-8-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220131223330.61563-1-djrscally@gmail.com> References: <20220131223330.61563-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 --- 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 Mon Jan 31 22:33:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15312 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 75E55BF415 for ; Mon, 31 Jan 2022 22:33:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2207F609AF; Mon, 31 Jan 2022 23:33:50 +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="VofqH9fL"; 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 E6396609C3 for ; Mon, 31 Jan 2022 23:33:48 +0100 (CET) Received: by mail-wr1-x42e.google.com with SMTP id h21so28264904wrb.8 for ; Mon, 31 Jan 2022 14:33:48 -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=7/ZhzXiT0UrOoXPUWRn+76ynSQgMauvrXLRXPurs0UM=; b=VofqH9fL7enCJPuvFWUyCnecI0iys1XJltcnWgH+r6U0nki4f8SLAwxQX/rbHbrO32 SoaS2MrFTvjhRR3k8ZFP8RCoaI5Xge2u9xDEvezSZPXVi4CPReuLNiV1IoELYUAJ8GCh F+Zqb8KA+CXJmRGu111GTG27V4LpYcX8Dp3JOq6ZC+8e091KK9AeVMN3HFunaCpOzubJ jrRApjkys7q1Sp6iK7e4SmFTOCFHjwmykxnpsMjKqW6qT1nCNoO+GnGfSwqF0tUTFJeL dg4VotEbm0BdmWyfxSDoSwN1BtJxhwI10IYO0nTcIY+8rHGbyjUe1NvdY1BqBFGV6YjC gfLQ== 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=7/ZhzXiT0UrOoXPUWRn+76ynSQgMauvrXLRXPurs0UM=; b=07SGnw8tFvFkl13CdwJqmn2Cul1RuHpeP0cMLRGTEuWl86inMPwv6Eq6qSrml0QuBr U0TA+ok82ZvfglTwoyTLHsm7u5jp8doz7SXNsX51WjNFMY6fUV1Dkst5h+yIQo9jcIlC fBBNDiKKLlUiDOzQYChC+v+L5AGkwAMopoqNE8ViOm+iXAL0aKQmkwuxVAkCZKkS1fiL FIfn95kaQ5RH34uJZevmICTGG0wS45viL1iARSBLZ60TTQKuymtJuEUL5CEFWix0/5/C 1mhvMJGKVtMQGKs5mYUL9rq8UeZEzulm6nhb7RLNWw54CTQmwwzuERHJDoXSYt+jWFjA aHZA== X-Gm-Message-State: AOAM531kG74/SgBDXIU48hTeawxCeZ7HKyvM+fcKr23EucDeQMlbYXMA fKZ4WFZhGknx9+ScbCxEE6dkkgDuCF8= X-Google-Smtp-Source: ABdhPJy5YC3jI5KqOGfeIQy9wtZLMK0hU3hePxkChXsTOErwqPGOe8oW6ad0XmQmpI2WZDQITbnmFg== X-Received: by 2002:a5d:56cc:: with SMTP id m12mr18593297wrw.157.1643668428765; Mon, 31 Jan 2022 14:33:48 -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 q2sm6986740wrw.14.2022.01.31.14.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 14:33:48 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Mon, 31 Jan 2022 22:33:29 +0000 Message-Id: <20220131223330.61563-9-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220131223330.61563-1-djrscally@gmail.com> References: <20220131223330.61563-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 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 Mon Jan 31 22:33:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15314 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 9445BBF415 for ; Mon, 31 Jan 2022 22:33:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 51A51609F1; Mon, 31 Jan 2022 23:33:52 +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="dQ5aFXyz"; dkim-atps=neutral Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B9724609C6 for ; Mon, 31 Jan 2022 23:33:49 +0100 (CET) Received: by mail-wm1-x32e.google.com with SMTP id m13-20020a05600c3b0d00b00353951c3f62so249044wms.5 for ; Mon, 31 Jan 2022 14:33:49 -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=H1K4rh3XrDJdstO3mn49jQZawu6BU349Dkl3P/8gIu8=; b=dQ5aFXyzsFf3fyIzko8eP0KPZbMUlcVzA4b7O4i6nC7aKdxfPzzNdTa4XjJEzVm7QI s6v5j51Uc0lsM49UbXBiQcpU0r+MWhvC2Tex+gOz9Pt3cwCJgRgN4DfqQl0ZDoYoI1w7 5vnIZdQGCAwakhSYI1U49hYpTONVh2xT17b7GJtkE+9JkR3N6zHFkox+SbI6mTcK4swg MHTklXR2UFeiP2q6iK2CGnGkAzzyTCTl6QXscQzpFwUbE/L+IUKG5X3QbTyQ5mFoZqLf KPJagKj82tFnQwRf+Eo0QhQZusuVRMMaVYlxQgvxLmQKJcwzFWvdYQy+Ok+wyroDWsow zQEQ== 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=H1K4rh3XrDJdstO3mn49jQZawu6BU349Dkl3P/8gIu8=; b=QRwDltn0SKxh5OTo4YdliLoGMgRT6AKs47RQT+0EQpe0akF2OtbmOTUDkB/munkckO D5o0yxOqhx1Rk8KdkjcSFNuR2lbMPfuTbdPeJCEoNToomLyFNV7j9d3OFqFm91H1jjW/ i9Sy+de4xuV/RjmMqSxJmdI/LwOVdvw4hFtR37F1dwtFSBvga3Pej6grU9Tg38/ntoMf XEk34Tc1hfVfDZ8sKmr9zaaLHPOz3pIxH6cklbcPRDjScjMJyMEGJegeUYSPTsb743UA nOcXZC70qTiDB8to16La2lCULnzV67gXBaacXL8gaKs+pWSbgu38Wnueu/dj2n5MfU7D B7Gw== X-Gm-Message-State: AOAM5306iHLdk1apjBNAXcpUE4BNI8u4woxUqxzGhMNC0XOTIHD7uBqV lMQ2/fZjHKN3O5mD0TZX+GAguHcg/Sc= X-Google-Smtp-Source: ABdhPJwPg9o5MNj3SC3CQKlKpQ77l5y8Swvi0aqeAGDTEXFc8FPBIlfPaPjOIyEl85toDTgpny8ZXQ== X-Received: by 2002:a05:600c:4fc7:: with SMTP id o7mr9979519wmq.184.1643668429506; Mon, 31 Jan 2022 14:33:49 -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 q2sm6986740wrw.14.2022.01.31.14.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 14:33:49 -0800 (PST) From: Daniel Scally To: libcamera-devel@lists.libcamera.org Date: Mon, 31 Jan 2022 22:33:30 +0000 Message-Id: <20220131223330.61563-10-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220131223330.61563-1-djrscally@gmail.com> References: <20220131223330.61563-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 --- 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); }