[{"id":1399,"web_url":"https://patchwork.libcamera.org/comment/1399/","msgid":"<20190416191642.GA28515@bigcity.dyn.berto.se>","date":"2019-04-16T19:16:43","subject":"Re: [libcamera-devel] [PATCH v6 4/7] libcamera: request: Add\n\thasPendingBuffers() method","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your patch.\n\nOn 2019-04-16 15:42:07 +0200, Jacopo Mondi wrote:\n> Add method to verify if a request has pending buffers yet to be\n> completed.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  include/libcamera/request.h |  2 ++\n>  src/libcamera/request.cpp   | 12 ++++++++++--\n>  2 files changed, 12 insertions(+), 2 deletions(-)\n> \n> diff --git a/include/libcamera/request.h b/include/libcamera/request.h\n> index 0dbd425115e8..0188bcab8383 100644\n> --- a/include/libcamera/request.h\n> +++ b/include/libcamera/request.h\n> @@ -37,6 +37,8 @@ public:\n>  \n>  \tStatus status() const { return status_; }\n>  \n> +\tbool hasPendingBuffers() const { return !pending_.empty(); }\n> +\n>  private:\n>  \tfriend class Camera;\n>  \tfriend class PipelineHandler;\n> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n> index e0e77e972411..5e86c8e10128 100644\n> --- a/src/libcamera/request.cpp\n> +++ b/src/libcamera/request.cpp\n> @@ -106,6 +106,14 @@ Buffer *Request::findBuffer(Stream *stream) const\n>   * \\return The request completion status\n>   */\n>  \n> +/**\n> + * \\fn Request::hasPendingBuffers()\n> + * \\brief Retrieve if a request has buffers yet to be completed\n\ns/Retrieve/Check/\n\nWith that fixed,\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> + *\n> + * \\return True if the request has buffers pending for completion, false\n> + * otherwise\n> + */\n> +\n>  /**\n>   * \\brief Prepare the resources for the completion handler\n>   */\n> @@ -127,7 +135,7 @@ int Request::prepare()\n>   */\n>  void Request::complete(Status status)\n>  {\n> -\tASSERT(pending_.empty());\n> +\tASSERT(!hasPendingBuffers());\n>  \tstatus_ = status;\n>  }\n>  \n> @@ -149,7 +157,7 @@ bool Request::completeBuffer(Buffer *buffer)\n>  \tint ret = pending_.erase(buffer);\n>  \tASSERT(ret == 1);\n>  \n> -\treturn pending_.empty();\n> +\treturn !hasPendingBuffers();\n>  }\n>  \n>  } /* namespace libcamera */\n> -- \n> 2.21.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x144.google.com (mail-lf1-x144.google.com\n\t[IPv6:2a00:1450:4864:20::144])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7EB6360004\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Apr 2019 21:16:45 +0200 (CEST)","by mail-lf1-x144.google.com with SMTP id i68so5972961lfi.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Apr 2019 12:16:45 -0700 (PDT)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\ti24sm10460946ljb.31.2019.04.16.12.16.43\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 16 Apr 2019 12:16:43 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=9ljkjeu6ONuplL6CNWIPr7VvvbGS6tMtbo2h48+GJ7s=;\n\tb=QMDmJ29HNv9nJdFG1gnqrUV0+Z3K5eSS9uzWURF04x3FkJ1MbgGxo8kku2ZYuDyJv9\n\tRNPDZm6yAlFXhIhvjEgPLOe1ReXNr4YiE2d2SMR0PFpJTiRh8lKDpfOhOVQN1RaPw82q\n\taDl6lQO3yToy1xSzESE4ArZQFmHF9XH5exCqHdt5vbEZT9F7Fw/5ch6OqR/JJWpM1nVV\n\tA4hO8tLt1+iebpZ9UWK6QQnpBXuuGrkgex+uhiBNhBv+kvEnThDN3LLBB/s1bxpQkNxO\n\tTTp8Q/BcfFzbMoTnNkqJMWSIBsC31HxvC3AIagY0Ac5cWOL1BYu6SYgTRg9aKC7XbMSv\n\t8F2Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=9ljkjeu6ONuplL6CNWIPr7VvvbGS6tMtbo2h48+GJ7s=;\n\tb=evQpitRu7KpyiDtGsZQOypfkUYQZr6gJO2r2R9o9/7IfBSae0p0H2K5Owp37z3HeV9\n\tEIhLlpc3dKmdY8WzVegTBmc8kxNqdv+wnEF7ZQmGJLDOWxAMSf10f0NDJaPv5T7eRkKB\n\tNNw139S/hAjDQgf2yvptac3ELesJ9F8FxMyhRDZ0Mm30ubAwBdD7gfW+bYt6CTIirlpA\n\tbNu2gFL2gxdGkDfAG9O7vmTl85MYYXRDYdb4AdMlKGXniZVwy+SX5ap8/+cD2hdFt6GK\n\tGSzQq2oB+a2tj1SkJMHVns6gvI2i3RYfl9ZfR9WQoHIHw3lYWqI2linMiMRyhNR8lGzn\n\tK+6Q==","X-Gm-Message-State":"APjAAAWTGU6gkkq9XEU/MIVSug4wfwFUxJwqUE7fRMYTbRwxOsnDRCFX\n\t5+TnCV4iV7pdWSO+IpGcjP9AysviF8o=","X-Google-Smtp-Source":"APXvYqzzxQrHIMiH7fS7rzohZ5NQbUgubom5impH1bLiTluiW798+3MeA6PnC2QsJyO7NhHiRMiOJQ==","X-Received":"by 2002:a05:6512:c8:: with SMTP id\n\tc8mr26896665lfp.138.1555442204632; \n\tTue, 16 Apr 2019 12:16:44 -0700 (PDT)","Date":"Tue, 16 Apr 2019 21:16:43 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190416191642.GA28515@bigcity.dyn.berto.se>","References":"<20190416134210.21097-1-jacopo@jmondi.org>\n\t<20190416134210.21097-5-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190416134210.21097-5-jacopo@jmondi.org>","User-Agent":"Mutt/1.11.3 (2019-02-01)","Subject":"Re: [libcamera-devel] [PATCH v6 4/7] libcamera: request: Add\n\thasPendingBuffers() method","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 16 Apr 2019 19:16:45 -0000"}},{"id":1412,"web_url":"https://patchwork.libcamera.org/comment/1412/","msgid":"<20190416221653.GJ4822@pendragon.ideasonboard.com>","date":"2019-04-16T22:16:53","subject":"Re: [libcamera-devel] [PATCH v6 4/7] libcamera: request: Add\n\thasPendingBuffers() method","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Tue, Apr 16, 2019 at 09:16:43PM +0200, Niklas Söderlund wrote:\n> On 2019-04-16 15:42:07 +0200, Jacopo Mondi wrote:\n> > Add method to verify if a request has pending buffers yet to be\n> > completed.\n> > \n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  include/libcamera/request.h |  2 ++\n> >  src/libcamera/request.cpp   | 12 ++++++++++--\n> >  2 files changed, 12 insertions(+), 2 deletions(-)\n> > \n> > diff --git a/include/libcamera/request.h b/include/libcamera/request.h\n> > index 0dbd425115e8..0188bcab8383 100644\n> > --- a/include/libcamera/request.h\n> > +++ b/include/libcamera/request.h\n> > @@ -37,6 +37,8 @@ public:\n> >  \n> >  \tStatus status() const { return status_; }\n> >  \n> > +\tbool hasPendingBuffers() const { return !pending_.empty(); }\n> > +\n> >  private:\n> >  \tfriend class Camera;\n> >  \tfriend class PipelineHandler;\n> > diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n> > index e0e77e972411..5e86c8e10128 100644\n> > --- a/src/libcamera/request.cpp\n> > +++ b/src/libcamera/request.cpp\n> > @@ -106,6 +106,14 @@ Buffer *Request::findBuffer(Stream *stream) const\n> >   * \\return The request completion status\n> >   */\n> >  \n> > +/**\n> > + * \\fn Request::hasPendingBuffers()\n> > + * \\brief Retrieve if a request has buffers yet to be completed\n> \n> s/Retrieve/Check/\n> \n> With that fixed,\n> \n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nLikewise,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> > + *\n> > + * \\return True if the request has buffers pending for completion, false\n> > + * otherwise\n> > + */\n> > +\n> >  /**\n> >   * \\brief Prepare the resources for the completion handler\n> >   */\n> > @@ -127,7 +135,7 @@ int Request::prepare()\n> >   */\n> >  void Request::complete(Status status)\n> >  {\n> > -\tASSERT(pending_.empty());\n> > +\tASSERT(!hasPendingBuffers());\n> >  \tstatus_ = status;\n> >  }\n> >  \n> > @@ -149,7 +157,7 @@ bool Request::completeBuffer(Buffer *buffer)\n> >  \tint ret = pending_.erase(buffer);\n> >  \tASSERT(ret == 1);\n> >  \n> > -\treturn pending_.empty();\n> > +\treturn !hasPendingBuffers();\n> >  }\n> >  \n> >  } /* namespace libcamera */","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 41C6060004\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Apr 2019 00:17:02 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C9E03E2;\n\tWed, 17 Apr 2019 00:17:01 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1555453022;\n\tbh=GQk+3N74MC8n/jQ3LYkqS/2ZCUTlA/UtWb59pI7YR9Q=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=v9rzwZXYnVLFazvzVIpvCYpE1zL43DDeCrB8hn7ocJ91jZ0x5Nd8pfiaz4FkkgR1m\n\tWfj7144/T+GNPGEk8eqvPFp91FtzLJbRWl2QEQiu134OpsNcH1S6VqsyiZw69V+yMj\n\tLKFKaXYkvfNjGkK8l8KwN7/EaUkhpI2tAO6awMf0=","Date":"Wed, 17 Apr 2019 01:16:53 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"Jacopo Mondi <jacopo@jmondi.org>, libcamera-devel@lists.libcamera.org","Message-ID":"<20190416221653.GJ4822@pendragon.ideasonboard.com>","References":"<20190416134210.21097-1-jacopo@jmondi.org>\n\t<20190416134210.21097-5-jacopo@jmondi.org>\n\t<20190416191642.GA28515@bigcity.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190416191642.GA28515@bigcity.dyn.berto.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v6 4/7] libcamera: request: Add\n\thasPendingBuffers() method","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 16 Apr 2019 22:17:02 -0000"}}]