[libcamera-devel] [PATCH v4 07/12] libcamera: request: Add empty() method

Niklas Söderlund niklas.soderlund at ragnatech.se
Sun Apr 14 22:06:41 CEST 2019


Hi Jacopo,

Thanks for your work.

On 2019-04-09 21:25:43 +0200, Jacopo Mondi wrote:
> Add method to verify if a request has pending buffers yet to be
> completed or it is empty and ready from completion.
> 
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>

If it make sens I think this could be merged/handled outside of this 
series.

Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>

> ---
>  include/libcamera/request.h |  2 ++
>  src/libcamera/request.cpp   | 11 +++++++++--
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/include/libcamera/request.h b/include/libcamera/request.h
> index 2004312a2233..37f9a3b27482 100644
> --- a/include/libcamera/request.h
> +++ b/include/libcamera/request.h
> @@ -37,6 +37,8 @@ public:
>  
>  	Status status() const { return status_; }
>  
> +	bool empty() const { return pending_.empty(); }
> +
>  	const std::map<Stream *, Buffer *> &bufferMap() const { return bufferMap_; }
>  
>  private:
> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
> index 46f9add98fde..3e10c995a6fa 100644
> --- a/src/libcamera/request.cpp
> +++ b/src/libcamera/request.cpp
> @@ -106,6 +106,13 @@ Buffer *Request::findBuffer(Stream *stream) const
>   * \return The request completion status
>   */
>  
> +/**
> + * \fn Request::empty()
> + * \brief Retrieve if a request has buffers yet to be completed
> + *
> + * \return True if no buffer is pending for completion, false otherwise
> + */
> +
>  /**
>   * \fn Request::bufferMap()
>   * \brief Retrieve the request' stream to buffer map
> @@ -137,7 +144,7 @@ int Request::prepare()
>   */
>  void Request::complete(Status status)
>  {
> -	ASSERT(pending_.empty());
> +	ASSERT(empty());
>  	status_ = status;
>  }
>  
> @@ -159,7 +166,7 @@ bool Request::completeBuffer(Buffer *buffer)
>  	int ret = pending_.erase(buffer);
>  	ASSERT(ret == 1);
>  
> -	return pending_.empty();
> +	return empty();
>  }
>  
>  } /* namespace libcamera */
> -- 
> 2.21.0
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list