[{"id":19718,"web_url":"https://patchwork.libcamera.org/comment/19718/","msgid":"<YUjUQcxfmzAoyIs1@pendragon.ideasonboard.com>","date":"2021-09-20T18:34:41","subject":"Re: [libcamera-devel] [PATCH v3 01/10] android: camera_worker: Use\n\tCamera3RequestDescriptor as cookie","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Umang,\n\nThank you for the patch.\n\nOn Mon, Sep 20, 2021 at 11:07:43PM +0530, Umang Jain wrote:\n> Use Camera3RequestDescriptor as cookie for the Capture Request.\n> The cookie is used to lookup descriptors map in\n> CameraDevice::requestComplete(). The map will be transformed to a\n> queue in subsequent commit.\n> \n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n>  src/android/camera_device.cpp | 3 ++-\n>  src/android/camera_worker.cpp | 6 +++---\n>  src/android/camera_worker.h   | 5 +++--\n>  3 files changed, 8 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index ab31bdda..f461e14c 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -244,7 +244,8 @@ CameraDevice::Camera3RequestDescriptor::Camera3RequestDescriptor(\n>  \t * Create the CaptureRequest, stored as a unique_ptr<> to tie its\n>  \t * lifetime to the descriptor.\n>  \t */\n> -\trequest_ = std::make_unique<CaptureRequest>(camera);\n> +\trequest_ = std::make_unique<CaptureRequest>(camera,\n> +\t\t\t\t\t\t    reinterpret_cast<uint64_t>(this));\n>  }\n>  \n>  /*\n> diff --git a/src/android/camera_worker.cpp b/src/android/camera_worker.cpp\n> index 91313183..3e18de21 100644\n> --- a/src/android/camera_worker.cpp\n> +++ b/src/android/camera_worker.cpp\n> @@ -27,10 +27,10 @@ LOG_DECLARE_CATEGORY(HAL)\n>   * by the CameraWorker which queues it to the libcamera::Camera after handling\n>   * fences.\n>   */\n> -CaptureRequest::CaptureRequest(Camera *camera)\n> -\t: camera_(camera)\n> +CaptureRequest::CaptureRequest(Camera *camera, uint64_t cookie)\n> +\t: camera_(camera), cookie_(cookie)\n>  {\n> -\trequest_ = camera_->createRequest(reinterpret_cast<uint64_t>(this));\n> +\trequest_ = camera_->createRequest(cookie_);\n>  }\n>  \n>  void CaptureRequest::addBuffer(Stream *stream, FrameBuffer *buffer, int fence)\n> diff --git a/src/android/camera_worker.h b/src/android/camera_worker.h\n> index 67ae50bd..3432d1fd 100644\n> --- a/src/android/camera_worker.h\n> +++ b/src/android/camera_worker.h\n> @@ -22,7 +22,7 @@ class CameraDevice;\n\nYou need to include stdint.h.\n\n>  public:\n> -\tCaptureRequest(libcamera::Camera *camera);\n> +\tCaptureRequest(libcamera::Camera *camera, uint64_t cookie);\n>  \n>  \tconst std::vector<int> &fences() const { return acquireFences_; }\n>  \tlibcamera::ControlList &controls() { return request_->controls(); }\n> @@ -30,7 +30,7 @@ public:\n>  \t{\n>  \t\treturn request_->metadata();\n>  \t}\n> -\tunsigned long cookie() const { return request_->cookie(); }\n> +\tunsigned long cookie() const { return cookie_; }\n>  \n>  \tvoid addBuffer(libcamera::Stream *stream,\n>  \t\t       libcamera::FrameBuffer *buffer, int fence);\n> @@ -40,6 +40,7 @@ private:\n>  \tlibcamera::Camera *camera_;\n>  \tstd::vector<int> acquireFences_;\n>  \tstd::unique_ptr<libcamera::Request> request_;\n> +\tuint64_t cookie_;\n\nAny reason for adding this member ? I think you can keep the current\nimplementation of cookie() and drop cookie_, unless another patch in\nthis series requires it.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  };\n>  \n>  class CameraWorker : private libcamera::Thread","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6201DBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Sep 2021 18:35:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 935FD6918A;\n\tMon, 20 Sep 2021 20:35:12 +0200 (CEST)","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 F05B469186\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Sep 2021 20:35:11 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 780D62F06;\n\tMon, 20 Sep 2021 20:35:11 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"aCIBewDN\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1632162911;\n\tbh=vEU5GkaC+scv1ttLLYma2BkmrgMJulMQxaz5kE+IQJ4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=aCIBewDNYLiXRBdnNTiSYvohd2nTXllPirNH7JBIVnDhZA6sdH4OxSf3bB79ucYPB\n\t1ISMpW9sjLevTuM1ZqzqL1i/bt8WdyYpWLavomM6tCgRi8s+3t1d2lhUESl4r77FuS\n\tjvdyHfoM+0B/hMYuyvZtViS6kS5rRNeaHws0eHMU=","Date":"Mon, 20 Sep 2021 21:34:41 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<YUjUQcxfmzAoyIs1@pendragon.ideasonboard.com>","References":"<20210920173752.1346190-1-umang.jain@ideasonboard.com>\n\t<20210920173752.1346190-2-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210920173752.1346190-2-umang.jain@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 01/10] android: camera_worker: Use\n\tCamera3RequestDescriptor as cookie","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":19854,"web_url":"https://patchwork.libcamera.org/comment/19854/","msgid":"<CAO5uPHOa5pxsWzEnrWm2mYbOoJL7Y_pD4SzFQqmcb3K65e86EA@mail.gmail.com>","date":"2021-09-27T05:38:29","subject":"Re: [libcamera-devel] [PATCH v3 01/10] android: camera_worker: Use\n\tCamera3RequestDescriptor as cookie","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Umang, thank you for the patch.\n\nOn Tue, Sep 21, 2021 at 3:35 AM Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> Hi Umang,\n>\n> Thank you for the patch.\n>\n> On Mon, Sep 20, 2021 at 11:07:43PM +0530, Umang Jain wrote:\n> > Use Camera3RequestDescriptor as cookie for the Capture Request.\n> > The cookie is used to lookup descriptors map in\n> > CameraDevice::requestComplete(). The map will be transformed to a\n> > queue in subsequent commit.\n> >\n> > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> > ---\n> >  src/android/camera_device.cpp | 3 ++-\n> >  src/android/camera_worker.cpp | 6 +++---\n> >  src/android/camera_worker.h   | 5 +++--\n> >  3 files changed, 8 insertions(+), 6 deletions(-)\n> >\n> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> > index ab31bdda..f461e14c 100644\n> > --- a/src/android/camera_device.cpp\n> > +++ b/src/android/camera_device.cpp\n> > @@ -244,7 +244,8 @@ CameraDevice::Camera3RequestDescriptor::Camera3RequestDescriptor(\n> >        * Create the CaptureRequest, stored as a unique_ptr<> to tie its\n> >        * lifetime to the descriptor.\n> >        */\n> > -     request_ = std::make_unique<CaptureRequest>(camera);\n> > +     request_ = std::make_unique<CaptureRequest>(camera,\n> > +                                                 reinterpret_cast<uint64_t>(this));\n> >  }\n> >\n> >  /*\n> > diff --git a/src/android/camera_worker.cpp b/src/android/camera_worker.cpp\n> > index 91313183..3e18de21 100644\n> > --- a/src/android/camera_worker.cpp\n> > +++ b/src/android/camera_worker.cpp\n> > @@ -27,10 +27,10 @@ LOG_DECLARE_CATEGORY(HAL)\n> >   * by the CameraWorker which queues it to the libcamera::Camera after handling\n> >   * fences.\n> >   */\n> > -CaptureRequest::CaptureRequest(Camera *camera)\n> > -     : camera_(camera)\n> > +CaptureRequest::CaptureRequest(Camera *camera, uint64_t cookie)\n> > +     : camera_(camera), cookie_(cookie)\n> >  {\n> > -     request_ = camera_->createRequest(reinterpret_cast<uint64_t>(this));\n> > +     request_ = camera_->createRequest(cookie_);\n> >  }\n> >\n> >  void CaptureRequest::addBuffer(Stream *stream, FrameBuffer *buffer, int fence)\n> > diff --git a/src/android/camera_worker.h b/src/android/camera_worker.h\n> > index 67ae50bd..3432d1fd 100644\n> > --- a/src/android/camera_worker.h\n> > +++ b/src/android/camera_worker.h\n> > @@ -22,7 +22,7 @@ class CameraDevice;\n>\n> You need to include stdint.h.\n>\n> >  public:\n> > -     CaptureRequest(libcamera::Camera *camera);\n> > +     CaptureRequest(libcamera::Camera *camera, uint64_t cookie);\n> >\n> >       const std::vector<int> &fences() const { return acquireFences_; }\n> >       libcamera::ControlList &controls() { return request_->controls(); }\n> > @@ -30,7 +30,7 @@ public:\n> >       {\n> >               return request_->metadata();\n> >       }\n> > -     unsigned long cookie() const { return request_->cookie(); }\n> > +     unsigned long cookie() const { return cookie_; }\n\nI think we would rather change CaptureRequest::cookie() return type to\nuint64_t to follow Request::cookie() return type.\nBut this problem exists before your patch. So I am fine to fix this\nafter this patch series.\n\n> >\n> >       void addBuffer(libcamera::Stream *stream,\n> >                      libcamera::FrameBuffer *buffer, int fence);\n> > @@ -40,6 +40,7 @@ private:\n> >       libcamera::Camera *camera_;\n> >       std::vector<int> acquireFences_;\n> >       std::unique_ptr<libcamera::Request> request_;\n> > +     uint64_t cookie_;\n>\n> Any reason for adding this member ? I think you can keep the current\n> implementation of cookie() and drop cookie_, unless another patch in\n> this series requires it.\n>\n\n+1. request_->cookie() must be cookie_. So having cookie_ is not needed.\n\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n> >  };\n> >\n> >  class CameraWorker : private libcamera::Thread\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B59ECBF01C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Sep 2021 05:38:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 31B6D6918E;\n\tMon, 27 Sep 2021 07:38:42 +0200 (CEST)","from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com\n\t[IPv6:2a00:1450:4864:20::52e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 103C4684C8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Sep 2021 07:38:40 +0200 (CEST)","by mail-ed1-x52e.google.com with SMTP id ee50so64342240edb.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 26 Sep 2021 22:38:40 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"I3vREed4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=03oY8YBUZKp2yjQXmIXZr+XcKaRzfo4BIEJ9Gu1KqhU=;\n\tb=I3vREed4IJT2DwstOkSbYMC9THf9sG6HnnySsWb7sdPgqiS59+NnrB21vtzeKtjvQZ\n\tiKw7uhuIIn2M1+WLfn89y+34zJNKD3nDPnHwtfHpnfkIPLCy4CPqxanIKxYEOAAiMAga\n\tlUO4wz2HSFm41rQpLIWqpAXpRr8LDNL33J1Vo=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=03oY8YBUZKp2yjQXmIXZr+XcKaRzfo4BIEJ9Gu1KqhU=;\n\tb=OMbuU2ySSKFOcsVY5O9pKVIZraw1mJO9iRQl7SpWGGniB5rNx+xb3dgGpsHP/BIpC7\n\tP85cM0caCdtobx8+dlZ6yi684rbRfo+tbBBJgdC5kw1nj+jbp5ncRlQXvUuTku8Hrmbi\n\ter+vR4Ec8kXSPH2QxV/nS+bSlUOE88tYUSjC3lhXu5zvD7u6DvxUZuRR1pDLX9q87PYx\n\tpJwfnj7jE+o3Z35Y1Y2mVuV85pesyIDoVWvK3phRntvrd/3I15y9xOeJmRa/4OnSGBBV\n\tvSaT4BS+9qfJPxqyIoR4IjyHQYNChinhz5P9gWxOGT+VYY9q1vh/aEQ4R5yfGjaCfKyG\n\ttCaA==","X-Gm-Message-State":"AOAM530YL/k/6UpZIkIco48pv5JLp6oiX7DDEoSTJDDR7G3/m0kIdutg\n\tWnUgoa+SwqYPhPBlZsJGQAWRl0AzWI8d8XmI7kzPaKgCvhuPHA==","X-Google-Smtp-Source":"ABdhPJxIhFggh+EctsqvwNukf1wEi+ib3NqLO9VMKl/vfCzJuI9cGm12eJBD9rK5OTeHYN78u5BoXmGC2KQ715zBfR4=","X-Received":"by 2002:a17:906:32c9:: with SMTP id\n\tk9mr25724107ejk.218.1632721119663; \n\tSun, 26 Sep 2021 22:38:39 -0700 (PDT)","MIME-Version":"1.0","References":"<20210920173752.1346190-1-umang.jain@ideasonboard.com>\n\t<20210920173752.1346190-2-umang.jain@ideasonboard.com>\n\t<YUjUQcxfmzAoyIs1@pendragon.ideasonboard.com>","In-Reply-To":"<YUjUQcxfmzAoyIs1@pendragon.ideasonboard.com>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Mon, 27 Sep 2021 14:38:29 +0900","Message-ID":"<CAO5uPHOa5pxsWzEnrWm2mYbOoJL7Y_pD4SzFQqmcb3K65e86EA@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v3 01/10] android: camera_worker: Use\n\tCamera3RequestDescriptor as cookie","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]