From patchwork Wed Oct 20 13:33:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 14206 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 6EB68C324E for ; Wed, 20 Oct 2021 13:34:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 336E668F5B; Wed, 20 Oct 2021 15:34:00 +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="e4fYtOwo"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 84A2068F58 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 311F41A38; Wed, 20 Oct 2021 15:33:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1634736837; bh=futhccNphUnWLsewPAcoZBn7fTzRtXhmFwWd7pT4frA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e4fYtOwoQl+ZGmdW1I/rb9IpDpANvzR3CO94yjdnMJimvlfxUdUW0SZGKQnNo8C2d tFcHjm3g5qPVf3+Bi5tHmDOmfWmF9tI/ASiPsTiFLF66Bf4S1wPeQy+XratpU2kJIo YHRQRxvzyQh8i3EVTh/wjtfz9G1SucsUxnUzVevw= From: Kieran Bingham To: libcamera devel Date: Wed, 20 Oct 2021 14:33:53 +0100 Message-Id: <20211020133353.2500082-3-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 2/2] libcamera: request: Use external 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" Each Request is currently creating its own CameraControlValidator using the Camera instance at construction. Now that the Camera exposes its own CameraControlValidator on its private interface, use that one on all Requests. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- include/libcamera/request.h | 1 - src/libcamera/request.cpp | 10 +++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/include/libcamera/request.h b/include/libcamera/request.h index 2d361c9d97dc..d16904e6b679 100644 --- a/include/libcamera/request.h +++ b/include/libcamera/request.h @@ -71,7 +71,6 @@ private: bool completeBuffer(FrameBuffer *buffer); Camera *camera_; - CameraControlValidator *validator_; ControlList *controls_; ControlList *metadata_; BufferMap bufferMap_; diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp index f95ce4db5eaa..17fefab7ad0e 100644 --- a/src/libcamera/request.cpp +++ b/src/libcamera/request.cpp @@ -17,6 +17,7 @@ #include #include +#include "libcamera/internal/camera.h" #include "libcamera/internal/camera_controls.h" #include "libcamera/internal/framebuffer.h" #include "libcamera/internal/tracepoints.h" @@ -77,12 +78,8 @@ Request::Request(Camera *camera, uint64_t cookie) : camera_(camera), sequence_(0), cookie_(cookie), status_(RequestPending), cancelled_(false) { - /** - * \todo Should the Camera expose a validator instance, to avoid - * creating a new instance for each request? - */ - validator_ = new CameraControlValidator(camera); - controls_ = new ControlList(controls::controls, validator_); + controls_ = new ControlList(controls::controls, + camera->_d()->validator()); /** * \todo: Add a validator for metadata controls. @@ -100,7 +97,6 @@ Request::~Request() delete metadata_; delete controls_; - delete validator_; } /**