From patchwork Wed Oct 20 13:33:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 14205 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 C7235BF415 for ; Wed, 20 Oct 2021 13:34:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 425DC68F5F; Wed, 20 Oct 2021 15:33:59 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="h/omDgpB"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5A84868F57 for ; Wed, 20 Oct 2021 15:33:57 +0200 (CEST) Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EC8411447; Wed, 20 Oct 2021 15:33:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1634736837; bh=LRAvSNlbg6A/stOLEj+gCHTAMplXR0z/b7rJi2udFVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h/omDgpBb4uD7Xz1uG4lJd6UjA3IMtwnKQpscZhnbpIE5UaS2p2Rv/N+0iTjUbx5O RD4yPAQWa5xSsJCbIPiLOkFnB6SngrTxgwQu7VADrgG5xpMmR42Qu7JWlkvlx6Tlgz Wa+Q8EKJXJUUpy4LmI/O9xp4qAuTeDyEgE6Y1EwM= From: Kieran Bingham To: libcamera devel Date: Wed, 20 Oct 2021 14:33:52 +0100 Message-Id: <20211020133353.2500082-2-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211020133353.2500082-1-kieran.bingham@ideasonboard.com> References: <20211020133353.2500082-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/2] libcamera: camera: Create a CameraControlValidator 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" Create a Camera specific CameraControlValidator for the Camera instance. This will allow requests to use a single validor instance without having to construct their own. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- v3: - Use a unique_ptr instead of deriving from the _o/O_PTRs v2: - Use LIBCAMERA_O_PTR() instead of _o() --- include/libcamera/internal/camera.h | 6 ++++++ src/libcamera/camera.cpp | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h index 1a08da0cedc4..f0baaea07bdc 100644 --- a/include/libcamera/internal/camera.h +++ b/include/libcamera/internal/camera.h @@ -17,6 +17,8 @@ #include +#include "libcamera/internal/camera_controls.h" + namespace libcamera { class PipelineHandler; @@ -38,6 +40,8 @@ public: uint32_t requestSequence_; + const CameraControlValidator *validator() const { return validator_.get(); } + private: enum State { CameraAvailable, @@ -64,6 +68,8 @@ private: bool disconnected_; std::atomic state_; + + std::unique_ptr validator_; }; } /* namespace libcamera */ diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 71809bcd36a3..f84cdc522d0d 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -366,6 +366,12 @@ Camera::Private::~Private() * \return The pipeline handler that created this camera */ +/** + * \fn Camera::Private::validator() + * \brief Retrieve the control validator related to this camera + * \return The control validator associated with this camera + */ + /** * \var Camera::Private::queuedRequests_ * \brief The list of queued and not yet completed requests @@ -665,6 +671,7 @@ Camera::Camera(std::unique_ptr d, const std::string &id, { _d()->id_ = id; _d()->streams_ = streams; + _d()->validator_ = std::make_unique(this); } Camera::~Camera()