[libcamera-devel] [PATCH v5 18/33] ipa: Disable copy-construction of IPAContext

Kieran Bingham kieran.bingham at ideasonboard.com
Tue Sep 27 10:15:15 CEST 2022


Quoting Laurent Pinchart via libcamera-devel (2022-09-27 03:36:27)
> The IPAContext is not meant to be copied. Prevent unintentional
> pass-by-value by disabling its copy constructor.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

I wonder if IPAContext should derive from an (empty) base struct which
has copy disabled... (would that actually work?)

But I doubt that's much better. This is fine I think.

Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

> ---
>  src/ipa/ipu3/ipa_context.h   | 4 ++++
>  src/ipa/rkisp1/ipa_context.h | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h
> index bdba3d07d13a..9766330f2f39 100644
> --- a/src/ipa/ipu3/ipa_context.h
> +++ b/src/ipa/ipu3/ipa_context.h
> @@ -10,6 +10,7 @@
>  
>  #include <linux/intel-ipu3.h>
>  
> +#include <libcamera/base/class.h>
>  #include <libcamera/base/utils.h>
>  
>  #include <libcamera/geometry.h>
> @@ -87,6 +88,9 @@ struct IPAContext {
>         IPAActiveState activeState;
>  
>         FCQueue<IPAFrameContext, kMaxFrameContexts> frameContexts;
> +
> +private:
> +       LIBCAMERA_DISABLE_COPY(IPAContext)
>  };
>  
>  } /* namespace ipa::ipu3 */
> diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
> index 4481bd2acde6..9a84b7adda45 100644
> --- a/src/ipa/rkisp1/ipa_context.h
> +++ b/src/ipa/rkisp1/ipa_context.h
> @@ -10,6 +10,7 @@
>  
>  #include <linux/rkisp1-config.h>
>  
> +#include <libcamera/base/class.h>
>  #include <libcamera/base/utils.h>
>  
>  #include <libcamera/geometry.h>
> @@ -101,6 +102,9 @@ struct IPAContext {
>         IPAActiveState activeState;
>  
>         FCQueue<IPAFrameContext, kMaxFrameContexts> frameContexts;
> +
> +private:
> +       LIBCAMERA_DISABLE_COPY(IPAContext)
>  };
>  
>  } /* namespace ipa::rkisp1 */
> -- 
> Regards,
> 
> Laurent Pinchart
>


More information about the libcamera-devel mailing list