[{"id":21177,"web_url":"https://patchwork.libcamera.org/comment/21177/","msgid":"<YZ3VeYgiHC0TFrTO@pendragon.ideasonboard.com>","date":"2021-11-24T06:02:33","subject":"Re: [libcamera-devel] [PATCH v3 1/2] libcamera: framebuffer: Enable\n\tattaching additional data to FrameBuffer","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Hiro,\n\nThank you for the patch.\n\nOn Wed, Nov 24, 2021 at 03:39:46AM +0900, Hirokazu Honda wrote:\n> We cannot have a subclass of FrameBuffer because it is marked as final.\n> This adds a FrameBuffer constructor with FrameBuffer::Private. So we\n> can attach some additional resources with FrameBuffer through a\n> customized FrameBuffer::Private class.\n> \n> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  include/libcamera/framebuffer.h          |  2 ++\n>  include/libcamera/internal/framebuffer.h |  1 +\n>  src/libcamera/framebuffer.cpp            | 24 ++++++++++++++++++++++--\n>  3 files changed, 25 insertions(+), 2 deletions(-)\n> \n> diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h\n> index 7f2f176a..abcede31 100644\n> --- a/include/libcamera/framebuffer.h\n> +++ b/include/libcamera/framebuffer.h\n> @@ -58,6 +58,8 @@ public:\n>  \t};\n>  \n>  \tFrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);\n> +\tFrameBuffer(std::unique_ptr<Private> d,\n> +\t\t    const std::vector<Plane> &planes, unsigned int cookie = 0);\n>  \n>  \tconst std::vector<Plane> &planes() const { return planes_; }\n>  \tRequest *request() const;\n> diff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h\n> index cd33c295..3cced5b1 100644\n> --- a/include/libcamera/internal/framebuffer.h\n> +++ b/include/libcamera/internal/framebuffer.h\n> @@ -19,6 +19,7 @@ class FrameBuffer::Private : public Extensible::Private\n>  \n>  public:\n>  \tPrivate();\n> +\tvirtual ~Private();\n>  \n>  \tvoid setRequest(Request *request) { request_ = request; }\n>  \tbool isContiguous() const { return isContiguous_; }\n> diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\n> index 337ea115..3a324471 100644\n> --- a/src/libcamera/framebuffer.cpp\n> +++ b/src/libcamera/framebuffer.cpp\n> @@ -116,6 +116,13 @@ FrameBuffer::Private::Private()\n>  {\n>  }\n>  \n> +/**\n> + * \\brief FrameBuffer::Private destructor\n> + */\n> +FrameBuffer::Private::~Private()\n> +{\n> +}\n> +\n>  /**\n>   * \\fn FrameBuffer::Private::setRequest()\n>   * \\brief Set the request this buffer belongs to\n> @@ -213,8 +220,21 @@ FrameBuffer::Private::Private()\n>   * \\param[in] cookie Cookie\n>   */\n>  FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie)\n> -\t: Extensible(std::make_unique<Private>()), planes_(planes),\n> -\t  cookie_(cookie)\n> +\t: FrameBuffer(std::make_unique<Private>(), planes, cookie)\n> +{\n> +}\n> +\n> +/**\n> + * \\brief Construct a FrameBuffer with an extensible private class and an array\n> + * of planes\n> + * \\param[in] d The extensible private class\n> + * \\param[in] planes The frame memory planes\n> + * \\param[in] cookie Cookie\n> + */\n> +FrameBuffer::FrameBuffer(std::unique_ptr<Private> d,\n> +\t\t\t const std::vector<Plane> &planes,\n> +\t\t\t unsigned int cookie)\n> +\t: Extensible(std::move(d)), planes_(planes), cookie_(cookie)\n>  {\n>  \tmetadata_.planes_.resize(planes_.size());\n>","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 1891DBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 24 Nov 2021 06:02:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 623086022F;\n\tWed, 24 Nov 2021 07:02:57 +0100 (CET)","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 C856060121\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Nov 2021 07:02:56 +0100 (CET)","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 4211F993;\n\tWed, 24 Nov 2021 07:02:56 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tGwsdUPY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637733776;\n\tbh=3KB7HXxB6EMLEh3oJr+o1O93UlD1s5CXa7XcL/F2eL4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=tGwsdUPY98DaqE+BavyD4lImiiS0/Peo4Y18U1VQa62uFywwqonXFwo4NPtEit2mm\n\tXO7q+ySrDLT4zQUHbkpDuX8+HVDsfQXCC+jZg2MAQwE3R5gMLHmDC0CR7ecM6+LkPK\n\tkcUN6aLn9QBWy+jIz38548XVriGyIWIzTmDEXUwk=","Date":"Wed, 24 Nov 2021 08:02:33 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Hirokazu Honda <hiroh@chromium.org>","Message-ID":"<YZ3VeYgiHC0TFrTO@pendragon.ideasonboard.com>","References":"<20211123183947.46839-1-hiroh@chromium.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211123183947.46839-1-hiroh@chromium.org>","Subject":"Re: [libcamera-devel] [PATCH v3 1/2] libcamera: framebuffer: Enable\n\tattaching additional data to FrameBuffer","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>"}}]