From patchwork Sun Jul 4 23:36:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12806 X-Patchwork-Delegate: laurent.pinchart@ideasonboard.com 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 5055CBD794 for ; Sun, 4 Jul 2021 23:37:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AD49968505; Mon, 5 Jul 2021 01:37:06 +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="gN4EVPlL"; 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 7B28D60285 for ; Mon, 5 Jul 2021 01:37:05 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 030B1E7 for ; Mon, 5 Jul 2021 01:37:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1625441825; bh=XivCoNKTWVaT/INeuUZM0xn9Pp5F12dY5WHcylk+o9c=; h=From:To:Subject:Date:From; b=gN4EVPlLq125Ka1wHCK2fUuBshl2y5RUNNU8HkpeYig1uHUQYWTTz4JPogEktfnV8 X+2vKQ+Vhruk4no9nayOVxhCDOMyBSp4t3tPOJ4HnZyHutgXMcTB7wCxi4KXMJsk/+ +1TKS0pD0dSrvouMbLYjN3NWYdb8QszeDjqR6iVE= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 5 Jul 2021 02:36:19 +0300 Message-Id: <20210704233620.9145-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] android: Disable copy and move for CameraHalManager 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 CameraHalManager should be instantiated once only, and never copied or moved. Disable copying and moving. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Umang Jain --- src/android/camera_hal_manager.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h index db9354a73140..ee3fb3ad48e9 100644 --- a/src/android/camera_hal_manager.h +++ b/src/android/camera_hal_manager.h @@ -18,6 +18,7 @@ #include #include +#include #include "camera_hal_config.h" @@ -40,6 +41,8 @@ public: void setCallbacks(const camera_module_callbacks_t *callbacks); private: + LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraHalManager) + using Mutex = std::mutex; using MutexLocker = std::unique_lock; From patchwork Sun Jul 4 23:36:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12807 X-Patchwork-Delegate: laurent.pinchart@ideasonboard.com 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 E6D1EC3222 for ; Sun, 4 Jul 2021 23:37:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 38AAF68501; Mon, 5 Jul 2021 01:37:07 +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="RhsqPtms"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B4E4168500 for ; Mon, 5 Jul 2021 01:37:05 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 55D952E4 for ; Mon, 5 Jul 2021 01:37:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1625441825; bh=VCeb9YNd7oBXk5xTquBkWhgDIAkPazTo5fck7MrG0vI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RhsqPtmspumNXkw/GIMUzx9xrvG4PijAzBrZaDJEcpCfM+T/7jTs4jytGw+CiLEcP j6f093X7Lgf78hYTKgMvOqyn1FKF7p9SurrNTv2z+roeLRgVaz0hMoyHNJwKqTAzZB 4admSsjSjxGEd3MGskzeLl1z60R++PTaXbSlPwQo= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 5 Jul 2021 02:36:20 +0300 Message-Id: <20210704233620.9145-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210704233620.9145-1-laurent.pinchart@ideasonboard.com> References: <20210704233620.9145-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] android: Disable copy and move for CameraDevice 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" Instances of the CameraDevice class should never be copied or moved, as they represent resources, Disable copying and moving for the class. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Umang Jain --- src/android/camera_device.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 3361918d4484..d085a27f296b 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -14,6 +14,7 @@ #include +#include #include #include #include @@ -66,6 +67,8 @@ protected: std::string logPrefix() const override; private: + LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraDevice) + CameraDevice(unsigned int id, std::shared_ptr camera); struct Camera3RequestDescriptor {