[libcamera-devel] [PATCH v4 16/37] libcamera: IPAProxy: Add isolate parameter to create()

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Nov 25 15:54:06 CET 2020


Hi Paul,

Thank you for the patch.

On Fri, Nov 06, 2020 at 07:36:46PM +0900, Paul Elder wrote:
> Since IPAProxy implementations now always encapsulate IPA modules, add a
> parameter to create() to signal if the proxy should isolate the IPA or not.
> 
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> 
> ---
> No change in v4
> 
> No change in v3
> 
> Changes in v2:
> - document isolate argument
> ---
>  include/libcamera/internal/ipa_proxy.h | 22 +++++++++++-----------
>  src/libcamera/ipa_proxy.cpp            |  4 +++-
>  2 files changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/include/libcamera/internal/ipa_proxy.h b/include/libcamera/internal/ipa_proxy.h
> index 59a5b841..195d2cb4 100644
> --- a/include/libcamera/internal/ipa_proxy.h
> +++ b/include/libcamera/internal/ipa_proxy.h
> @@ -42,7 +42,7 @@ public:
>  	IPAProxyFactory(const char *name);
>  	virtual ~IPAProxyFactory() = default;
>  
> -	virtual std::unique_ptr<IPAProxy> create(IPAModule *ipam) = 0;
> +	virtual std::unique_ptr<IPAProxy> create(IPAModule *ipam, bool isolate) = 0;
>  
>  	const std::string &name() const { return name_; }
>  
> @@ -53,16 +53,16 @@ private:
>  	std::string name_;
>  };
>  
> -#define REGISTER_IPA_PROXY(proxy)			\
> -class proxy##Factory final : public IPAProxyFactory	\
> -{							\
> -public:							\
> -	proxy##Factory() : IPAProxyFactory(#proxy) {}	\
> -	std::unique_ptr<IPAProxy> create(IPAModule *ipam)	\
> -	{						\
> -		return std::make_unique<proxy>(ipam);	\
> -	}						\
> -};							\
> +#define REGISTER_IPA_PROXY(proxy)					\
> +class proxy##Factory final : public IPAProxyFactory			\
> +{									\
> +public:									\
> +	proxy##Factory() : IPAProxyFactory(#proxy) {}			\
> +	std::unique_ptr<IPAProxy> create(IPAModule *ipam, bool isolate)	\
> +	{								\
> +		return std::make_unique<proxy>(ipam, isolate);		\
> +	}								\
> +};									\
>  static proxy##Factory global_##proxy##Factory;
>  
>  } /* namespace libcamera */
> diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp
> index 23be24ad..ee5e6f3e 100644
> --- a/src/libcamera/ipa_proxy.cpp
> +++ b/src/libcamera/ipa_proxy.cpp
> @@ -250,10 +250,12 @@ IPAProxyFactory::IPAProxyFactory(const char *name)
>   * \fn IPAProxyFactory::create()
>   * \brief Create an instance of the IPAProxy corresponding to the factory
>   * \param[in] ipam The IPA module
> + * \param[in] isolate Flag to isolate the IPA module
>   *
>   * This virtual function is implemented by the REGISTER_IPA_PROXY() macro.
>   * It creates a IPAProxy instance that isolates an IPA interface designated
> - * by the IPA module \a ipam.
> + * by the IPA module \a ipam. If \a isolate is true, then the IPA module will
> + * be isolated.

Reading the whole paragraph, isolation is a bit confusing. How about the following ?

 * This virtual function is implemented by the REGISTER_IPA_PROXY() macro.
 * It creates a IPAProxy instance that encapsulates the IPA interface provided
 * by the IPA module \a ipam. If \a isolate is true, the proxy isolates the IPA
 * interface in a separate process. Otherwise it runs it in a thread.

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

>   *
>   * \return A pointer to a newly constructed instance of the IPAProxy subclass
>   * corresponding to the factory

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list