[libcamera-devel,1/2] android: Disable copy and move for CameraHalManager
diff mbox series

Message ID 20210704233620.9145-1-laurent.pinchart@ideasonboard.com
State Accepted
Delegated to: Laurent Pinchart
Headers show
Series
  • [libcamera-devel,1/2] android: Disable copy and move for CameraHalManager
Related show

Commit Message

Laurent Pinchart July 4, 2021, 11:36 p.m. UTC
The CameraHalManager should be instantiated once only, and never copied
or moved. Disable copying and moving.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/android/camera_hal_manager.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Paul Elder July 5, 2021, 3:11 a.m. UTC | #1
Hi Laurent,

On Mon, Jul 05, 2021 at 02:36:19AM +0300, Laurent Pinchart wrote:
> The CameraHalManager should be instantiated once only, and never copied
> or moved. Disable copying and moving.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  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 <system/camera_metadata.h>
>  
>  #include <libcamera/camera_manager.h>
> +#include <libcamera/class.h>

libcamera/base/class.h

Other than that,

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

>  
>  #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<std::mutex>;
Laurent Pinchart July 5, 2021, 3:20 a.m. UTC | #2
On Mon, Jul 05, 2021 at 12:11:55PM +0900, paul.elder@ideasonboard.com wrote:
> Hi Laurent,
> 
> On Mon, Jul 05, 2021 at 02:36:19AM +0300, Laurent Pinchart wrote:
> > The CameraHalManager should be instantiated once only, and never copied
> > or moved. Disable copying and moving.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  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 <system/camera_metadata.h>
> >  
> >  #include <libcamera/camera_manager.h>
> > +#include <libcamera/class.h>
> 
> libcamera/base/class.h

Oops. Looks like I've rebased and compile-tested the patch with a build
directory that had the Android HAL disabled :-S Sorry about it.

> Other than that,
> 
> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
> 
> >  
> >  #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<std::mutex>;
Umang Jain July 5, 2021, 4:59 a.m. UTC | #3
Hi Laurent,

On 7/5/21 8:50 AM, Laurent Pinchart wrote:
> On Mon, Jul 05, 2021 at 12:11:55PM +0900, paul.elder@ideasonboard.com wrote:
>> Hi Laurent,
>>
>> On Mon, Jul 05, 2021 at 02:36:19AM +0300, Laurent Pinchart wrote:
>>> The CameraHalManager should be instantiated once only, and never copied
>>> or moved. Disable copying and moving.
>>>
>>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>> ---
>>>   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 <system/camera_metadata.h>
>>>   
>>>   #include <libcamera/camera_manager.h>
>>> +#include <libcamera/class.h>
>> libcamera/base/class.h
> Oops. Looks like I've rebased and compile-tested the patch with a build
> directory that had the Android HAL disabled :-S Sorry about it.

Given this is already pointed out and should be passed through your 
compiler-matrix

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

>> Other than that,
>>
>> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
>>
>>>   
>>>   #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<std::mutex>;

Patch
diff mbox series

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 <system/camera_metadata.h>
 
 #include <libcamera/camera_manager.h>
+#include <libcamera/class.h>
 
 #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<std::mutex>;