Message ID | 20190416134210.21097-5-jacopo@jmondi.org |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Jacopo, Thanks for your patch. On 2019-04-16 15:42:07 +0200, Jacopo Mondi wrote: > Add method to verify if a request has pending buffers yet to be > completed. > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > --- > include/libcamera/request.h | 2 ++ > src/libcamera/request.cpp | 12 ++++++++++-- > 2 files changed, 12 insertions(+), 2 deletions(-) > > diff --git a/include/libcamera/request.h b/include/libcamera/request.h > index 0dbd425115e8..0188bcab8383 100644 > --- a/include/libcamera/request.h > +++ b/include/libcamera/request.h > @@ -37,6 +37,8 @@ public: > > Status status() const { return status_; } > > + bool hasPendingBuffers() const { return !pending_.empty(); } > + > private: > friend class Camera; > friend class PipelineHandler; > diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp > index e0e77e972411..5e86c8e10128 100644 > --- a/src/libcamera/request.cpp > +++ b/src/libcamera/request.cpp > @@ -106,6 +106,14 @@ Buffer *Request::findBuffer(Stream *stream) const > * \return The request completion status > */ > > +/** > + * \fn Request::hasPendingBuffers() > + * \brief Retrieve if a request has buffers yet to be completed s/Retrieve/Check/ With that fixed, Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > + * > + * \return True if the request has buffers pending for completion, false > + * otherwise > + */ > + > /** > * \brief Prepare the resources for the completion handler > */ > @@ -127,7 +135,7 @@ int Request::prepare() > */ > void Request::complete(Status status) > { > - ASSERT(pending_.empty()); > + ASSERT(!hasPendingBuffers()); > status_ = status; > } > > @@ -149,7 +157,7 @@ bool Request::completeBuffer(Buffer *buffer) > int ret = pending_.erase(buffer); > ASSERT(ret == 1); > > - return pending_.empty(); > + return !hasPendingBuffers(); > } > > } /* namespace libcamera */ > -- > 2.21.0 > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
Hi Jacopo, Thank you for the patch. On Tue, Apr 16, 2019 at 09:16:43PM +0200, Niklas Söderlund wrote: > On 2019-04-16 15:42:07 +0200, Jacopo Mondi wrote: > > Add method to verify if a request has pending buffers yet to be > > completed. > > > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > > --- > > include/libcamera/request.h | 2 ++ > > src/libcamera/request.cpp | 12 ++++++++++-- > > 2 files changed, 12 insertions(+), 2 deletions(-) > > > > diff --git a/include/libcamera/request.h b/include/libcamera/request.h > > index 0dbd425115e8..0188bcab8383 100644 > > --- a/include/libcamera/request.h > > +++ b/include/libcamera/request.h > > @@ -37,6 +37,8 @@ public: > > > > Status status() const { return status_; } > > > > + bool hasPendingBuffers() const { return !pending_.empty(); } > > + > > private: > > friend class Camera; > > friend class PipelineHandler; > > diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp > > index e0e77e972411..5e86c8e10128 100644 > > --- a/src/libcamera/request.cpp > > +++ b/src/libcamera/request.cpp > > @@ -106,6 +106,14 @@ Buffer *Request::findBuffer(Stream *stream) const > > * \return The request completion status > > */ > > > > +/** > > + * \fn Request::hasPendingBuffers() > > + * \brief Retrieve if a request has buffers yet to be completed > > s/Retrieve/Check/ > > With that fixed, > > Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Likewise, Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > + * > > + * \return True if the request has buffers pending for completion, false > > + * otherwise > > + */ > > + > > /** > > * \brief Prepare the resources for the completion handler > > */ > > @@ -127,7 +135,7 @@ int Request::prepare() > > */ > > void Request::complete(Status status) > > { > > - ASSERT(pending_.empty()); > > + ASSERT(!hasPendingBuffers()); > > status_ = status; > > } > > > > @@ -149,7 +157,7 @@ bool Request::completeBuffer(Buffer *buffer) > > int ret = pending_.erase(buffer); > > ASSERT(ret == 1); > > > > - return pending_.empty(); > > + return !hasPendingBuffers(); > > } > > > > } /* namespace libcamera */
diff --git a/include/libcamera/request.h b/include/libcamera/request.h index 0dbd425115e8..0188bcab8383 100644 --- a/include/libcamera/request.h +++ b/include/libcamera/request.h @@ -37,6 +37,8 @@ public: Status status() const { return status_; } + bool hasPendingBuffers() const { return !pending_.empty(); } + private: friend class Camera; friend class PipelineHandler; diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp index e0e77e972411..5e86c8e10128 100644 --- a/src/libcamera/request.cpp +++ b/src/libcamera/request.cpp @@ -106,6 +106,14 @@ Buffer *Request::findBuffer(Stream *stream) const * \return The request completion status */ +/** + * \fn Request::hasPendingBuffers() + * \brief Retrieve if a request has buffers yet to be completed + * + * \return True if the request has buffers pending for completion, false + * otherwise + */ + /** * \brief Prepare the resources for the completion handler */ @@ -127,7 +135,7 @@ int Request::prepare() */ void Request::complete(Status status) { - ASSERT(pending_.empty()); + ASSERT(!hasPendingBuffers()); status_ = status; } @@ -149,7 +157,7 @@ bool Request::completeBuffer(Buffer *buffer) int ret = pending_.erase(buffer); ASSERT(ret == 1); - return pending_.empty(); + return !hasPendingBuffers(); } } /* namespace libcamera */
Add method to verify if a request has pending buffers yet to be completed. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- include/libcamera/request.h | 2 ++ src/libcamera/request.cpp | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)