[{"id":22801,"web_url":"https://patchwork.libcamera.org/comment/22801/","msgid":"<YmiKHYb9ZXlf+aL4@pendragon.ideasonboard.com>","date":"2022-04-27T00:11:09","subject":"Re: [libcamera-devel] [PATCH v3 2/4] Add AndroidFrameBuffer and\n\treplace FrameBuffer in src/android","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Harvey,\n\nThank you for the patch.\n\nOn Tue, Apr 26, 2022 at 09:14:07AM +0000, Harvey Yang via libcamera-devel wrote:\n> AndroidFrameBuffer is derived from FrameBuffer with access to\n> buffer_handle_t, which is needed for JEA usage.\n\nGiven that we have an implement for Chrome OS and a \"generic Android\"\nimplementation, would it be better (and more in line with the HAL naming\nconventions) to call the class HALFrameBuffer instead of\nAndroidFrameBuffer ?\n\n> Signed-off-by: Harvey Yang <chenghaoyang at chromium.org>\n> ---\n>  src/android/android_framebuffer.cpp           | 32 +++++++++++++++++++\n>  src/android/android_framebuffer.h             | 28 ++++++++++++++++\n>  src/android/camera_device.cpp                 |  3 +-\n>  src/android/frame_buffer_allocator.h          |  7 ++--\n>  src/android/meson.build                       |  1 +\n>  .../mm/cros_frame_buffer_allocator.cpp        | 13 +++++---\n>  .../mm/generic_frame_buffer_allocator.cpp     | 11 ++++---\n>  7 files changed, 81 insertions(+), 14 deletions(-)\n>  create mode 100644 src/android/android_framebuffer.cpp\n>  create mode 100644 src/android/android_framebuffer.h\n> \n> diff --git a/src/android/android_framebuffer.cpp b/src/android/android_framebuffer.cpp\n> new file mode 100644\n> index 00000000..1ff7018e\n> --- /dev/null\n> +++ b/src/android/android_framebuffer.cpp\n> @@ -0,0 +1,32 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2022, Google Inc.\n> + *\n> + * android_framebuffer.cpp - Android Frame buffer handling\n\ns/buffer handling/Buffer Handling/\n\nSame below.\n\n> + */\n> +\n> +#include \"android_framebuffer.h\"\n> +\n> +#include <hardware/camera3.h>\n> +\n> +AndroidFrameBuffer::AndroidFrameBuffer(\n> +\tbuffer_handle_t handle,\n> +\tstd::unique_ptr<Private> d,\n> +\tconst std::vector<Plane> &planes,\n> +\tunsigned int cookie)\n\nAndroidFrameBuffer::AndroidFrameBuffer(buffer_handle_t handle,\n\t\t\t\t       std::unique_ptr<Private> d,\n\t\t\t\t       const std::vector<Plane> &planes,\n\t\t\t\t       unsigned int cookie)\n\nThis isn't a rule that is universally enforced when it would result in\nreally long lines (and I wonder if we wouldn't be better off with the\ncoding style you've used, but that should then be changed globally).\n\n> +\t: FrameBuffer(std::move(d), planes, cookie), handle_(handle)\n> +{\n> +}\n> +\n> +AndroidFrameBuffer::AndroidFrameBuffer(\n> +\tbuffer_handle_t handle,\n> +\tconst std::vector<Plane> &planes,\n> +\tunsigned int cookie)\n\nSame here.\n\n> +\t: FrameBuffer(planes, cookie), handle_(handle)\n> +{\n> +}\n> +\n> +buffer_handle_t AndroidFrameBuffer::getHandle() const\n> +{\n> +\treturn handle_;\n> +}\n> diff --git a/src/android/android_framebuffer.h b/src/android/android_framebuffer.h\n> new file mode 100644\n> index 00000000..49df9756\n> --- /dev/null\n> +++ b/src/android/android_framebuffer.h\n> @@ -0,0 +1,28 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2022, Google Inc.\n> + *\n> + * android_framebuffer.h - Android Frame buffer handling\n> + */\n> +\n> +#pragma once\n> +\n> +#include \"libcamera/internal/framebuffer.h\"\n> +\n> +#include <hardware/camera3.h>\n> +\n> +class AndroidFrameBuffer final : public libcamera::FrameBuffer\n> +{\n> +public:\n> +\tAndroidFrameBuffer(\n> +\t\tbuffer_handle_t handle, std::unique_ptr<Private> d,\n\nPlease make the Private pointer the first argument.\n\n> +\t\tconst std::vector<Plane> &planes,\n> +\t\tunsigned int cookie = 0);\n\nThe cookie argument is never used, I'd drop it. Same below.\n\nSame comment regarding the alignment.\n\n> +\tAndroidFrameBuffer(buffer_handle_t handle,\n> +\t\t\t   const std::vector<Plane> &planes,\n> +\t\t\t   unsigned int cookie = 0);\n\nPlease add a blank line here.\n\n> +\tbuffer_handle_t getHandle() const;\n\nYou can inline this function, and rename it to just handle().\n\n> +\n> +private:\n> +\tbuffer_handle_t handle_ = nullptr;\n\nNo need for = nullptr, as the two constructors set the handle\nexplicitly.\n\n> +};\n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 00d48471..643b4dee 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -25,6 +25,7 @@\n>  \n>  #include \"system/graphics.h\"\n>  \n> +#include \"android_framebuffer.h\"\n>  #include \"camera_buffer.h\"\n>  #include \"camera_hal_config.h\"\n>  #include \"camera_ops.h\"\n> @@ -754,7 +755,7 @@ CameraDevice::createFrameBuffer(const buffer_handle_t camera3buffer,\n>  \t\tplanes[i].length = buf.size(i);\n>  \t}\n>  \n> -\treturn std::make_unique<FrameBuffer>(planes);\n> +\treturn std::make_unique<AndroidFrameBuffer>(camera3buffer, planes);\n>  }\n>  \n>  int CameraDevice::processControls(Camera3RequestDescriptor *descriptor)\n> diff --git a/src/android/frame_buffer_allocator.h b/src/android/frame_buffer_allocator.h\n> index 5d2eeda1..d7b2118e 100644\n> --- a/src/android/frame_buffer_allocator.h\n> +++ b/src/android/frame_buffer_allocator.h\n> @@ -13,9 +13,10 @@\n>  #include <libcamera/base/class.h>\n>  \n>  #include <libcamera/camera.h>\n> -#include <libcamera/framebuffer.h>\n>  #include <libcamera/geometry.h>\n>  \n> +#include \"android_framebuffer.h\"\n> +\n>  class CameraDevice;\n>  \n>  class PlatformFrameBufferAllocator : libcamera::Extensible\n> @@ -31,7 +32,7 @@ public:\n>  \t * Note: The returned FrameBuffer needs to be destroyed before\n>  \t * PlatformFrameBufferAllocator is destroyed.\n>  \t */\n> -\tstd::unique_ptr<libcamera::FrameBuffer> allocate(\n> +\tstd::unique_ptr<AndroidFrameBuffer> allocate(\n>  \t\tint halPixelFormat, const libcamera::Size &size, uint32_t usage);\n>  };\n>  \n> @@ -44,7 +45,7 @@ PlatformFrameBufferAllocator::PlatformFrameBufferAllocator(\t\t\\\n>  PlatformFrameBufferAllocator::~PlatformFrameBufferAllocator()\t\t\\\n>  {\t\t\t\t\t\t\t\t\t\\\n>  }\t\t\t\t\t\t\t\t\t\\\n> -std::unique_ptr<libcamera::FrameBuffer>\t\t\t\t\t\\\n> +std::unique_ptr<AndroidFrameBuffer>\t\t\t\t\t\t\\\n>  PlatformFrameBufferAllocator::allocate(int halPixelFormat,\t\t\\\n>  \t\t\t\t       const libcamera::Size &size,\t\\\n>  \t\t\t\t       uint32_t usage)\t\t\t\\\n> diff --git a/src/android/meson.build b/src/android/meson.build\n> index 75b4bf20..27be27bb 100644\n> --- a/src/android/meson.build\n> +++ b/src/android/meson.build\n> @@ -38,6 +38,7 @@ endif\n>  android_deps += [libyuv_dep]\n>  \n>  android_hal_sources = files([\n> +    'android_framebuffer.cpp',\n>      'camera3_hal.cpp',\n>      'camera_capabilities.cpp',\n>      'camera_device.cpp',\n> diff --git a/src/android/mm/cros_frame_buffer_allocator.cpp b/src/android/mm/cros_frame_buffer_allocator.cpp\n> index 52e8c180..163c5d75 100644\n> --- a/src/android/mm/cros_frame_buffer_allocator.cpp\n> +++ b/src/android/mm/cros_frame_buffer_allocator.cpp\n> @@ -14,6 +14,7 @@\n>  \n>  #include \"libcamera/internal/framebuffer.h\"\n>  \n> +#include \"../android_framebuffer.h\"\n>  #include \"../camera_device.h\"\n>  #include \"../frame_buffer_allocator.h\"\n>  #include \"cros-camera/camera_buffer_manager.h\"\n> @@ -47,11 +48,11 @@ public:\n>  \t{\n>  \t}\n>  \n> -\tstd::unique_ptr<libcamera::FrameBuffer>\n> +\tstd::unique_ptr<AndroidFrameBuffer>\n>  \tallocate(int halPixelFormat, const libcamera::Size &size, uint32_t usage);\n>  };\n>  \n> -std::unique_ptr<libcamera::FrameBuffer>\n> +std::unique_ptr<AndroidFrameBuffer>\n>  PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,\n>  \t\t\t\t\t\tconst libcamera::Size &size,\n>  \t\t\t\t\t\tuint32_t usage)\n> @@ -80,9 +81,11 @@ PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,\n>  \t\tplane.length = cros::CameraBufferManager::GetPlaneSize(handle, i);\n>  \t}\n>  \n> -\treturn std::make_unique<FrameBuffer>(\n> -\t\tstd::make_unique<CrosFrameBufferData>(std::move(scopedHandle)),\n> -\t\tplanes);\n> +\tauto fb = std::make_unique<AndroidFrameBuffer>(handle,\n> +\t\t\t\t\t\t       std::make_unique<CrosFrameBufferData>(std::move(scopedHandle)),\n> +\t\t\t\t\t\t       planes);\n> +\n> +\treturn fb;\n>  }\n>  \n>  PUBLIC_FRAME_BUFFER_ALLOCATOR_IMPLEMENTATION\n> diff --git a/src/android/mm/generic_frame_buffer_allocator.cpp b/src/android/mm/generic_frame_buffer_allocator.cpp\n> index acb2fa2b..c79b7b10 100644\n> --- a/src/android/mm/generic_frame_buffer_allocator.cpp\n> +++ b/src/android/mm/generic_frame_buffer_allocator.cpp\n> @@ -18,6 +18,7 @@\n>  #include <hardware/gralloc.h>\n>  #include <hardware/hardware.h>\n>  \n> +#include \"../android_framebuffer.h\"\n>  #include \"../camera_device.h\"\n>  #include \"../frame_buffer_allocator.h\"\n>  \n> @@ -77,7 +78,7 @@ public:\n>  \n>  \t~Private() override;\n>  \n> -\tstd::unique_ptr<libcamera::FrameBuffer>\n> +\tstd::unique_ptr<AndroidFrameBuffer>\n>  \tallocate(int halPixelFormat, const libcamera::Size &size, uint32_t usage);\n>  \n>  private:\n> @@ -92,7 +93,7 @@ PlatformFrameBufferAllocator::Private::~Private()\n>  \t\tgralloc_close(allocDevice_);\n>  }\n>  \n> -std::unique_ptr<libcamera::FrameBuffer>\n> +std::unique_ptr<AndroidFrameBuffer>\n>  PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,\n>  \t\t\t\t\t\tconst libcamera::Size &size,\n>  \t\t\t\t\t\tuint32_t usage)\n> @@ -135,9 +136,9 @@ PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,\n>  \t\toffset += planeSize;\n>  \t}\n>  \n> -\treturn std::make_unique<FrameBuffer>(\n> -\t\tstd::make_unique<GenericFrameBufferData>(allocDevice_, handle),\n> -\t\tplanes);\n> +\treturn std::make_unique<AndroidFrameBuffer>(handle,\n> +\t\t\t\t\t\t    std::make_unique<GenericFrameBufferData>(allocDevice_, handle),\n> +\t\t\t\t\t\t    planes);\n>  }\n>  \n>  PUBLIC_FRAME_BUFFER_ALLOCATOR_IMPLEMENTATION","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 9879AC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Apr 2022 00:11:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F102A6563D;\n\tWed, 27 Apr 2022 02:11:10 +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 EDC3A604A9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Apr 2022 02:11:09 +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 5C57530B;\n\tWed, 27 Apr 2022 02:11:09 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1651018271;\n\tbh=M7C7VMa3Zr+WHeGJwZYhN4gBj+BY1wtbeQ3bDWKnmDs=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=O5D+531leO/OYVW7A5q8Ze96u+9vvcKL9RuE1oka8Qu9Xnj2aDQJ04n4kZaJ7jN6O\n\tIYBRMcmiC76If+k6s5Mt/blETZiGa1dLKbJo8SIw7GMU8vEwIvA5+kCIjM3PRZcNKH\n\tSrTsnwymzVF9SUuQyH1prlohqVOistMk81x1zvZZndf8bPDrvI5CPLkog7xhSxnkGd\n\tmimxUyrU9gKm+SxtJ3RqILnEmyp9WgrDZIOnzrrC3c07eincGCPKq6JRL3c0KADYsR\n\tJlj0FR3ViKrQoAhpu4DsQaOk1wL9Q9SGp9i6em9xGxC5sShFRIYAYNkst+hyglt6oP\n\t77w9AVJx8WnNQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1651018269;\n\tbh=M7C7VMa3Zr+WHeGJwZYhN4gBj+BY1wtbeQ3bDWKnmDs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=fiBCjeULY1Ifuu0ttzVZNjYrIWdx1S+9QAgvkChOlIsQbnpKWieZoL8R1/zWK1KD1\n\tQeQuZLUqauhnXi8bm2t9prdE4tlHrfbl+7YCOcFoc2nJu6kIKACBU9pvUjtwmjQz6W\n\tXAdoOltMg/b8hkviH1SbsheJk5svyo/SsGkwdWbA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"fiBCjeUL\"; dkim-atps=neutral","Date":"Wed, 27 Apr 2022 03:11:09 +0300","To":"Harvey Yang <chenghaoyang@chromium.org>","Message-ID":"<YmiKHYb9ZXlf+aL4@pendragon.ideasonboard.com>","References":"<20220426091409.1352047-1-chenghaoyang@chromium.org>\n\t<20220426091409.1352047-3-chenghaoyang@chromium.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220426091409.1352047-3-chenghaoyang@chromium.org>","Subject":"Re: [libcamera-devel] [PATCH v3 2/4] Add AndroidFrameBuffer and\n\treplace FrameBuffer in src/android","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22819,"web_url":"https://patchwork.libcamera.org/comment/22819/","msgid":"<CAEB1ahs0jtf8sVAaRQm+U8xSsWexi1en8Qeekpdo-AFsiSgBLg@mail.gmail.com>","date":"2022-05-03T03:29:27","subject":"Re: [libcamera-devel] [PATCH v3 2/4] Add AndroidFrameBuffer and\n\treplace FrameBuffer in src/android","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/people/117/","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"content":"Thanks Laurent!\n\nSorry I forgot to send this reply before going on vacation...\n\n> Given that we have an implement for Chrome OS and a \"generic Android\"\nimplementation, would it be better (and more in line with the HAL naming\nconventions) to call the class HALFrameBuffer instead of AndroidFrameBuffer?\nSure. I named it AndroidFrameBuffer simply because it's under src/android\ndirectory. Updated.\n\n> This isn't a rule that is universally enforced when it would result in\nreally long lines (and I wonder if we wouldn't be better off with the\ncoding style you've used, but that should then be changed globally).\nI'm actually curious what's the style here, as clang-format and\n./utils/checkstyle.py suggest me to use the style I adopted...\nUpdated with the class name changed. Hope that still fits the style you\nsuggested. (While I'm not sure how many indents/spaces for the header\nfile's c'tor...?)\n\nPlease check if I miss anything.\n\nBR,\nHarvey\n\n\n\nOn Wed, Apr 27, 2022 at 8:11 AM Laurent Pinchart <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> Hi Harvey,\n>\n> Thank you for the patch.\n>\n> On Tue, Apr 26, 2022 at 09:14:07AM +0000, Harvey Yang via libcamera-devel\n> wrote:\n> > AndroidFrameBuffer is derived from FrameBuffer with access to\n> > buffer_handle_t, which is needed for JEA usage.\n>\n> Given that we have an implement for Chrome OS and a \"generic Android\"\n> implementation, would it be better (and more in line with the HAL naming\n> conventions) to call the class HALFrameBuffer instead of\n> AndroidFrameBuffer ?\n>\n> > Signed-off-by: Harvey Yang <chenghaoyang at chromium.org>\n> > ---\n> >  src/android/android_framebuffer.cpp           | 32 +++++++++++++++++++\n> >  src/android/android_framebuffer.h             | 28 ++++++++++++++++\n> >  src/android/camera_device.cpp                 |  3 +-\n> >  src/android/frame_buffer_allocator.h          |  7 ++--\n> >  src/android/meson.build                       |  1 +\n> >  .../mm/cros_frame_buffer_allocator.cpp        | 13 +++++---\n> >  .../mm/generic_frame_buffer_allocator.cpp     | 11 ++++---\n> >  7 files changed, 81 insertions(+), 14 deletions(-)\n> >  create mode 100644 src/android/android_framebuffer.cpp\n> >  create mode 100644 src/android/android_framebuffer.h\n> >\n> > diff --git a/src/android/android_framebuffer.cpp\n> b/src/android/android_framebuffer.cpp\n> > new file mode 100644\n> > index 00000000..1ff7018e\n> > --- /dev/null\n> > +++ b/src/android/android_framebuffer.cpp\n> > @@ -0,0 +1,32 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2022, Google Inc.\n> > + *\n> > + * android_framebuffer.cpp - Android Frame buffer handling\n>\n> s/buffer handling/Buffer Handling/\n>\n> Same below.\n>\n> > + */\n> > +\n> > +#include \"android_framebuffer.h\"\n> > +\n> > +#include <hardware/camera3.h>\n> > +\n> > +AndroidFrameBuffer::AndroidFrameBuffer(\n> > +     buffer_handle_t handle,\n> > +     std::unique_ptr<Private> d,\n> > +     const std::vector<Plane> &planes,\n> > +     unsigned int cookie)\n>\n> AndroidFrameBuffer::AndroidFrameBuffer(buffer_handle_t handle,\n>                                        std::unique_ptr<Private> d,\n>                                        const std::vector<Plane> &planes,\n>                                        unsigned int cookie)\n>\n> This isn't a rule that is universally enforced when it would result in\n> really long lines (and I wonder if we wouldn't be better off with the\n> coding style you've used, but that should then be changed globally).\n>\n> > +     : FrameBuffer(std::move(d), planes, cookie), handle_(handle)\n> > +{\n> > +}\n> > +\n> > +AndroidFrameBuffer::AndroidFrameBuffer(\n> > +     buffer_handle_t handle,\n> > +     const std::vector<Plane> &planes,\n> > +     unsigned int cookie)\n>\n> Same here.\n>\n> > +     : FrameBuffer(planes, cookie), handle_(handle)\n> > +{\n> > +}\n> > +\n> > +buffer_handle_t AndroidFrameBuffer::getHandle() const\n> > +{\n> > +     return handle_;\n> > +}\n> > diff --git a/src/android/android_framebuffer.h\n> b/src/android/android_framebuffer.h\n> > new file mode 100644\n> > index 00000000..49df9756\n> > --- /dev/null\n> > +++ b/src/android/android_framebuffer.h\n> > @@ -0,0 +1,28 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2022, Google Inc.\n> > + *\n> > + * android_framebuffer.h - Android Frame buffer handling\n> > + */\n> > +\n> > +#pragma once\n> > +\n> > +#include \"libcamera/internal/framebuffer.h\"\n> > +\n> > +#include <hardware/camera3.h>\n> > +\n> > +class AndroidFrameBuffer final : public libcamera::FrameBuffer\n> > +{\n> > +public:\n> > +     AndroidFrameBuffer(\n> > +             buffer_handle_t handle, std::unique_ptr<Private> d,\n>\n> Please make the Private pointer the first argument.\n>\n> > +             const std::vector<Plane> &planes,\n> > +             unsigned int cookie = 0);\n>\n> The cookie argument is never used, I'd drop it. Same below.\n>\n> Same comment regarding the alignment.\n>\n> > +     AndroidFrameBuffer(buffer_handle_t handle,\n> > +                        const std::vector<Plane> &planes,\n> > +                        unsigned int cookie = 0);\n>\n> Please add a blank line here.\n>\n> > +     buffer_handle_t getHandle() const;\n>\n> You can inline this function, and rename it to just handle().\n>\n> > +\n> > +private:\n> > +     buffer_handle_t handle_ = nullptr;\n>\n> No need for = nullptr, as the two constructors set the handle\n> explicitly.\n>\n> > +};\n> > diff --git a/src/android/camera_device.cpp\n> b/src/android/camera_device.cpp\n> > index 00d48471..643b4dee 100644\n> > --- a/src/android/camera_device.cpp\n> > +++ b/src/android/camera_device.cpp\n> > @@ -25,6 +25,7 @@\n> >\n> >  #include \"system/graphics.h\"\n> >\n> > +#include \"android_framebuffer.h\"\n> >  #include \"camera_buffer.h\"\n> >  #include \"camera_hal_config.h\"\n> >  #include \"camera_ops.h\"\n> > @@ -754,7 +755,7 @@ CameraDevice::createFrameBuffer(const\n> buffer_handle_t camera3buffer,\n> >               planes[i].length = buf.size(i);\n> >       }\n> >\n> > -     return std::make_unique<FrameBuffer>(planes);\n> > +     return std::make_unique<AndroidFrameBuffer>(camera3buffer, planes);\n> >  }\n> >\n> >  int CameraDevice::processControls(Camera3RequestDescriptor *descriptor)\n> > diff --git a/src/android/frame_buffer_allocator.h\n> b/src/android/frame_buffer_allocator.h\n> > index 5d2eeda1..d7b2118e 100644\n> > --- a/src/android/frame_buffer_allocator.h\n> > +++ b/src/android/frame_buffer_allocator.h\n> > @@ -13,9 +13,10 @@\n> >  #include <libcamera/base/class.h>\n> >\n> >  #include <libcamera/camera.h>\n> > -#include <libcamera/framebuffer.h>\n> >  #include <libcamera/geometry.h>\n> >\n> > +#include \"android_framebuffer.h\"\n> > +\n> >  class CameraDevice;\n> >\n> >  class PlatformFrameBufferAllocator : libcamera::Extensible\n> > @@ -31,7 +32,7 @@ public:\n> >        * Note: The returned FrameBuffer needs to be destroyed before\n> >        * PlatformFrameBufferAllocator is destroyed.\n> >        */\n> > -     std::unique_ptr<libcamera::FrameBuffer> allocate(\n> > +     std::unique_ptr<AndroidFrameBuffer> allocate(\n> >               int halPixelFormat, const libcamera::Size &size, uint32_t\n> usage);\n> >  };\n> >\n> > @@ -44,7 +45,7 @@\n> PlatformFrameBufferAllocator::PlatformFrameBufferAllocator(         \\\n> >  PlatformFrameBufferAllocator::~PlatformFrameBufferAllocator()\n>       \\\n> >  {                                                                    \\\n> >  }                                                                    \\\n> > -std::unique_ptr<libcamera::FrameBuffer>\n>       \\\n> > +std::unique_ptr<AndroidFrameBuffer>\n>       \\\n> >  PlatformFrameBufferAllocator::allocate(int halPixelFormat,           \\\n> >                                      const libcamera::Size &size,     \\\n> >                                      uint32_t usage)                  \\\n> > diff --git a/src/android/meson.build b/src/android/meson.build\n> > index 75b4bf20..27be27bb 100644\n> > --- a/src/android/meson.build\n> > +++ b/src/android/meson.build\n> > @@ -38,6 +38,7 @@ endif\n> >  android_deps += [libyuv_dep]\n> >\n> >  android_hal_sources = files([\n> > +    'android_framebuffer.cpp',\n> >      'camera3_hal.cpp',\n> >      'camera_capabilities.cpp',\n> >      'camera_device.cpp',\n> > diff --git a/src/android/mm/cros_frame_buffer_allocator.cpp\n> b/src/android/mm/cros_frame_buffer_allocator.cpp\n> > index 52e8c180..163c5d75 100644\n> > --- a/src/android/mm/cros_frame_buffer_allocator.cpp\n> > +++ b/src/android/mm/cros_frame_buffer_allocator.cpp\n> > @@ -14,6 +14,7 @@\n> >\n> >  #include \"libcamera/internal/framebuffer.h\"\n> >\n> > +#include \"../android_framebuffer.h\"\n> >  #include \"../camera_device.h\"\n> >  #include \"../frame_buffer_allocator.h\"\n> >  #include \"cros-camera/camera_buffer_manager.h\"\n> > @@ -47,11 +48,11 @@ public:\n> >       {\n> >       }\n> >\n> > -     std::unique_ptr<libcamera::FrameBuffer>\n> > +     std::unique_ptr<AndroidFrameBuffer>\n> >       allocate(int halPixelFormat, const libcamera::Size &size, uint32_t\n> usage);\n> >  };\n> >\n> > -std::unique_ptr<libcamera::FrameBuffer>\n> > +std::unique_ptr<AndroidFrameBuffer>\n> >  PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,\n> >                                               const libcamera::Size\n> &size,\n> >                                               uint32_t usage)\n> > @@ -80,9 +81,11 @@ PlatformFrameBufferAllocator::Private::allocate(int\n> halPixelFormat,\n> >               plane.length =\n> cros::CameraBufferManager::GetPlaneSize(handle, i);\n> >       }\n> >\n> > -     return std::make_unique<FrameBuffer>(\n> > -\n>  std::make_unique<CrosFrameBufferData>(std::move(scopedHandle)),\n> > -             planes);\n> > +     auto fb = std::make_unique<AndroidFrameBuffer>(handle,\n> > +\n> std::make_unique<CrosFrameBufferData>(std::move(scopedHandle)),\n> > +                                                    planes);\n> > +\n> > +     return fb;\n> >  }\n> >\n> >  PUBLIC_FRAME_BUFFER_ALLOCATOR_IMPLEMENTATION\n> > diff --git a/src/android/mm/generic_frame_buffer_allocator.cpp\n> b/src/android/mm/generic_frame_buffer_allocator.cpp\n> > index acb2fa2b..c79b7b10 100644\n> > --- a/src/android/mm/generic_frame_buffer_allocator.cpp\n> > +++ b/src/android/mm/generic_frame_buffer_allocator.cpp\n> > @@ -18,6 +18,7 @@\n> >  #include <hardware/gralloc.h>\n> >  #include <hardware/hardware.h>\n> >\n> > +#include \"../android_framebuffer.h\"\n> >  #include \"../camera_device.h\"\n> >  #include \"../frame_buffer_allocator.h\"\n> >\n> > @@ -77,7 +78,7 @@ public:\n> >\n> >       ~Private() override;\n> >\n> > -     std::unique_ptr<libcamera::FrameBuffer>\n> > +     std::unique_ptr<AndroidFrameBuffer>\n> >       allocate(int halPixelFormat, const libcamera::Size &size, uint32_t\n> usage);\n> >\n> >  private:\n> > @@ -92,7 +93,7 @@ PlatformFrameBufferAllocator::Private::~Private()\n> >               gralloc_close(allocDevice_);\n> >  }\n> >\n> > -std::unique_ptr<libcamera::FrameBuffer>\n> > +std::unique_ptr<AndroidFrameBuffer>\n> >  PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,\n> >                                               const libcamera::Size\n> &size,\n> >                                               uint32_t usage)\n> > @@ -135,9 +136,9 @@ PlatformFrameBufferAllocator::Private::allocate(int\n> halPixelFormat,\n> >               offset += planeSize;\n> >       }\n> >\n> > -     return std::make_unique<FrameBuffer>(\n> > -             std::make_unique<GenericFrameBufferData>(allocDevice_,\n> handle),\n> > -             planes);\n> > +     return std::make_unique<AndroidFrameBuffer>(handle,\n> > +\n>  std::make_unique<GenericFrameBufferData>(allocDevice_, handle),\n> > +                                                 planes);\n> >  }\n> >\n> >  PUBLIC_FRAME_BUFFER_ALLOCATOR_IMPLEMENTATION\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\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 D631CC0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  3 May 2022 03:29:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1D32865643;\n\tTue,  3 May 2022 05:29:41 +0200 (CEST)","from mail-lf1-x135.google.com (mail-lf1-x135.google.com\n\t[IPv6:2a00:1450:4864:20::135])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 23F04604A1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  3 May 2022 05:29:39 +0200 (CEST)","by mail-lf1-x135.google.com with SMTP id x33so28399406lfu.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 02 May 2022 20:29:39 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1651548581;\n\tbh=svGlX30DwbTn+1/vIqkltV07RMUhJ+XaSvDuXAXqB50=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Om9rREZIGadJcU3Vm+F0jk5ktQXFt4Wssr3jHsau2D/y5igzclt5/9ndy4Lzfl0mV\n\txJ2Ubu2+XW2K1C3chZ+p9n7Tc5thXcRnAGNhpmmXCpUinFEqzTZt226r3J8VxDqFSa\n\t7iteThGLftLYfkBIj4dNpy7nLPAZJzkrwpe3WLaxGiQXdpTcNY1iZ+DnzyHDEHg0li\n\tZJUANt7GUVk6HP4593JOCaPI1s++C06oVtUnaMYgQ9yO4dGLpJJOLYyLFikgAPyjfU\n\tF8r9ITOXEs95F+NQA0rrOLhBTamO7NwiaiBKDqVoqAhzQHJIH/0tr51qKeQhTDBXxk\n\tS/5xgZ1v4Bh5g==","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=kQNZsxAtvpg84HrkLYUCiNNMQwbyWkSDOWlIcnwfb54=;\n\tb=NwcJB671W7VjS3LlQ3A9SN30WOsAitRb8GqERQOApCdpE2yD/kE2F6iCcbopwxyIGw\n\tOIrnpaYJwQ3AgoZ9mYLjxZ7zM1w4REl7ILxY8i5wicMNBDWVgyGx8AN9XvnAu0QrtIdF\n\tSUd5v9V4xPJJy5A4hawTi1kOpKpUAXUSdy+y4="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"NwcJB671\"; \n\tdkim-atps=neutral","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=kQNZsxAtvpg84HrkLYUCiNNMQwbyWkSDOWlIcnwfb54=;\n\tb=fiRifgDZffykNG3E04Qf0jVu6DXi9Q8qBUXHcjCNWF69I95B8W0CyI69RbsHcGfz7E\n\tqEbADvp5wDW1q8E9wfVrvurXx2jeKPcu5Xna1HfiUPhpMwnq7tiWMOpAZcJnlyNU9LST\n\t7sUXklJUwX25UWJZHv5Ffk5IQb5aLoFtOqBCBxncE4nHQCtV+q/rWBwBBJj+czhEa8aE\n\tsWGb66jkcP3H1pcFH7pzcagQ2su68EvUPcNMTfYf9EXe2/k1kUowAovydkzFx+7eHSFW\n\tqnVZxgkMM5tawKyV+wInrYAk5MZKgkeDEMg1PhKn3rncxZBmiRjf3iuoTE+RWIyXKSX1\n\tvrAw==","X-Gm-Message-State":"AOAM530ruUU6L9EOBjOGJlr/C3i8krd71/KbCQEIYZLpnE6l6B5ydYYW\n\tdCiPzghx14bv6eVI2Im7tbTCo4jU7vpV5fXavIvE0Q==","X-Google-Smtp-Source":"ABdhPJxGaVuS+L9VD5XJ20Ch5HfSM4UpUbSp9klrteKlXZyJwpZGCpFUj6LndK7ZMzar+oXKi9FbYkiHllW/8Vdk9to=","X-Received":"by 2002:a05:6512:2613:b0:448:5164:689d with SMTP id\n\tbt19-20020a056512261300b004485164689dmr10291680lfb.526.1651548578214;\n\tMon, 02 May 2022 20:29:38 -0700 (PDT)","MIME-Version":"1.0","References":"<20220426091409.1352047-1-chenghaoyang@chromium.org>\n\t<20220426091409.1352047-3-chenghaoyang@chromium.org>\n\t<YmiKHYb9ZXlf+aL4@pendragon.ideasonboard.com>","In-Reply-To":"<YmiKHYb9ZXlf+aL4@pendragon.ideasonboard.com>","Date":"Tue, 3 May 2022 11:29:27 +0800","Message-ID":"<CAEB1ahs0jtf8sVAaRQm+U8xSsWexi1en8Qeekpdo-AFsiSgBLg@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"0000000000005582f105de131ea4\"","Subject":"Re: [libcamera-devel] [PATCH v3 2/4] Add AndroidFrameBuffer and\n\treplace FrameBuffer in src/android","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>","From":"Cheng-Hao Yang via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Cheng-Hao Yang <chenghaoyang@chromium.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":24887,"web_url":"https://patchwork.libcamera.org/comment/24887/","msgid":"<YxEQmuVEcSaUSBTG@pendragon.ideasonboard.com>","date":"2022-09-01T20:05:46","subject":"Re: [libcamera-devel] [PATCH v3 2/4] Add AndroidFrameBuffer and\n\treplace FrameBuffer in src/android","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Harvey,\n\nOn Tue, May 03, 2022 at 11:29:27AM +0800, Cheng-Hao Yang wrote:\n> Thanks Laurent!\n> \n> Sorry I forgot to send this reply before going on vacation...\n> \n> > Given that we have an implement for Chrome OS and a \"generic Android\"\n> > implementation, would it be better (and more in line with the HAL naming\n> > conventions) to call the class HALFrameBuffer instead of AndroidFrameBuffer?\n> \n> Sure. I named it AndroidFrameBuffer simply because it's under src/android\n> directory. Updated.\n> \n> > This isn't a rule that is universally enforced when it would result in\n> > really long lines (and I wonder if we wouldn't be better off with the\n> > coding style you've used, but that should then be changed globally).\n> \n> I'm actually curious what's the style here, as clang-format and\n> ./utils/checkstyle.py suggest me to use the style I adopted...\n\nIt's hard to get clang-format to do exactly what we want. It's close,\nbut not a 100% match. checkstyle.py is based on clang-format, so the two\nproduce the same output :-) (checkstyle.py has a number of other checks\nthough).\n\n> Updated with the class name changed. Hope that still fits the style you\n> suggested. (While I'm not sure how many indents/spaces for the header\n> file's c'tor...?)\n\nI'll check in the latest version.\n\n> Please check if I miss anything.\n> \n> On Wed, Apr 27, 2022 at 8:11 AM Laurent Pinchart wrote:\n> > On Tue, Apr 26, 2022 at 09:14:07AM +0000, Harvey Yang via libcamera-devel wrote:\n> > > AndroidFrameBuffer is derived from FrameBuffer with access to\n> > > buffer_handle_t, which is needed for JEA usage.\n> >\n> > Given that we have an implement for Chrome OS and a \"generic Android\"\n> > implementation, would it be better (and more in line with the HAL naming\n> > conventions) to call the class HALFrameBuffer instead of\n> > AndroidFrameBuffer ?\n> >\n> > > Signed-off-by: Harvey Yang <chenghaoyang at chromium.org>\n> > > ---\n> > >  src/android/android_framebuffer.cpp           | 32 +++++++++++++++++++\n> > >  src/android/android_framebuffer.h             | 28 ++++++++++++++++\n> > >  src/android/camera_device.cpp                 |  3 +-\n> > >  src/android/frame_buffer_allocator.h          |  7 ++--\n> > >  src/android/meson.build                       |  1 +\n> > >  .../mm/cros_frame_buffer_allocator.cpp        | 13 +++++---\n> > >  .../mm/generic_frame_buffer_allocator.cpp     | 11 ++++---\n> > >  7 files changed, 81 insertions(+), 14 deletions(-)\n> > >  create mode 100644 src/android/android_framebuffer.cpp\n> > >  create mode 100644 src/android/android_framebuffer.h\n> > >\n> > > diff --git a/src/android/android_framebuffer.cpp\n> > b/src/android/android_framebuffer.cpp\n> > > new file mode 100644\n> > > index 00000000..1ff7018e\n> > > --- /dev/null\n> > > +++ b/src/android/android_framebuffer.cpp\n> > > @@ -0,0 +1,32 @@\n> > > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > > +/*\n> > > + * Copyright (C) 2022, Google Inc.\n> > > + *\n> > > + * android_framebuffer.cpp - Android Frame buffer handling\n> >\n> > s/buffer handling/Buffer Handling/\n> >\n> > Same below.\n> >\n> > > + */\n> > > +\n> > > +#include \"android_framebuffer.h\"\n> > > +\n> > > +#include <hardware/camera3.h>\n> > > +\n> > > +AndroidFrameBuffer::AndroidFrameBuffer(\n> > > +     buffer_handle_t handle,\n> > > +     std::unique_ptr<Private> d,\n> > > +     const std::vector<Plane> &planes,\n> > > +     unsigned int cookie)\n> >\n> > AndroidFrameBuffer::AndroidFrameBuffer(buffer_handle_t handle,\n> >                                        std::unique_ptr<Private> d,\n> >                                        const std::vector<Plane> &planes,\n> >                                        unsigned int cookie)\n> >\n> > This isn't a rule that is universally enforced when it would result in\n> > really long lines (and I wonder if we wouldn't be better off with the\n> > coding style you've used, but that should then be changed globally).\n> >\n> > > +     : FrameBuffer(std::move(d), planes, cookie), handle_(handle)\n> > > +{\n> > > +}\n> > > +\n> > > +AndroidFrameBuffer::AndroidFrameBuffer(\n> > > +     buffer_handle_t handle,\n> > > +     const std::vector<Plane> &planes,\n> > > +     unsigned int cookie)\n> >\n> > Same here.\n> >\n> > > +     : FrameBuffer(planes, cookie), handle_(handle)\n> > > +{\n> > > +}\n> > > +\n> > > +buffer_handle_t AndroidFrameBuffer::getHandle() const\n> > > +{\n> > > +     return handle_;\n> > > +}\n> > > diff --git a/src/android/android_framebuffer.h\n> > b/src/android/android_framebuffer.h\n> > > new file mode 100644\n> > > index 00000000..49df9756\n> > > --- /dev/null\n> > > +++ b/src/android/android_framebuffer.h\n> > > @@ -0,0 +1,28 @@\n> > > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > > +/*\n> > > + * Copyright (C) 2022, Google Inc.\n> > > + *\n> > > + * android_framebuffer.h - Android Frame buffer handling\n> > > + */\n> > > +\n> > > +#pragma once\n> > > +\n> > > +#include \"libcamera/internal/framebuffer.h\"\n> > > +\n> > > +#include <hardware/camera3.h>\n> > > +\n> > > +class AndroidFrameBuffer final : public libcamera::FrameBuffer\n> > > +{\n> > > +public:\n> > > +     AndroidFrameBuffer(\n> > > +             buffer_handle_t handle, std::unique_ptr<Private> d,\n> >\n> > Please make the Private pointer the first argument.\n> >\n> > > +             const std::vector<Plane> &planes,\n> > > +             unsigned int cookie = 0);\n> >\n> > The cookie argument is never used, I'd drop it. Same below.\n> >\n> > Same comment regarding the alignment.\n> >\n> > > +     AndroidFrameBuffer(buffer_handle_t handle,\n> > > +                        const std::vector<Plane> &planes,\n> > > +                        unsigned int cookie = 0);\n> >\n> > Please add a blank line here.\n> >\n> > > +     buffer_handle_t getHandle() const;\n> >\n> > You can inline this function, and rename it to just handle().\n> >\n> > > +\n> > > +private:\n> > > +     buffer_handle_t handle_ = nullptr;\n> >\n> > No need for = nullptr, as the two constructors set the handle\n> > explicitly.\n> >\n> > > +};\n> > > diff --git a/src/android/camera_device.cpp\n> > b/src/android/camera_device.cpp\n> > > index 00d48471..643b4dee 100644\n> > > --- a/src/android/camera_device.cpp\n> > > +++ b/src/android/camera_device.cpp\n> > > @@ -25,6 +25,7 @@\n> > >\n> > >  #include \"system/graphics.h\"\n> > >\n> > > +#include \"android_framebuffer.h\"\n> > >  #include \"camera_buffer.h\"\n> > >  #include \"camera_hal_config.h\"\n> > >  #include \"camera_ops.h\"\n> > > @@ -754,7 +755,7 @@ CameraDevice::createFrameBuffer(const\n> > buffer_handle_t camera3buffer,\n> > >               planes[i].length = buf.size(i);\n> > >       }\n> > >\n> > > -     return std::make_unique<FrameBuffer>(planes);\n> > > +     return std::make_unique<AndroidFrameBuffer>(camera3buffer, planes);\n> > >  }\n> > >\n> > >  int CameraDevice::processControls(Camera3RequestDescriptor *descriptor)\n> > > diff --git a/src/android/frame_buffer_allocator.h\n> > b/src/android/frame_buffer_allocator.h\n> > > index 5d2eeda1..d7b2118e 100644\n> > > --- a/src/android/frame_buffer_allocator.h\n> > > +++ b/src/android/frame_buffer_allocator.h\n> > > @@ -13,9 +13,10 @@\n> > >  #include <libcamera/base/class.h>\n> > >\n> > >  #include <libcamera/camera.h>\n> > > -#include <libcamera/framebuffer.h>\n> > >  #include <libcamera/geometry.h>\n> > >\n> > > +#include \"android_framebuffer.h\"\n> > > +\n> > >  class CameraDevice;\n> > >\n> > >  class PlatformFrameBufferAllocator : libcamera::Extensible\n> > > @@ -31,7 +32,7 @@ public:\n> > >        * Note: The returned FrameBuffer needs to be destroyed before\n> > >        * PlatformFrameBufferAllocator is destroyed.\n> > >        */\n> > > -     std::unique_ptr<libcamera::FrameBuffer> allocate(\n> > > +     std::unique_ptr<AndroidFrameBuffer> allocate(\n> > >               int halPixelFormat, const libcamera::Size &size, uint32_t\n> > usage);\n> > >  };\n> > >\n> > > @@ -44,7 +45,7 @@\n> > PlatformFrameBufferAllocator::PlatformFrameBufferAllocator(         \\\n> > >  PlatformFrameBufferAllocator::~PlatformFrameBufferAllocator()\n> >       \\\n> > >  {                                                                    \\\n> > >  }                                                                    \\\n> > > -std::unique_ptr<libcamera::FrameBuffer>\n> >       \\\n> > > +std::unique_ptr<AndroidFrameBuffer>\n> >       \\\n> > >  PlatformFrameBufferAllocator::allocate(int halPixelFormat,           \\\n> > >                                      const libcamera::Size &size,     \\\n> > >                                      uint32_t usage)                  \\\n> > > diff --git a/src/android/meson.build b/src/android/meson.build\n> > > index 75b4bf20..27be27bb 100644\n> > > --- a/src/android/meson.build\n> > > +++ b/src/android/meson.build\n> > > @@ -38,6 +38,7 @@ endif\n> > >  android_deps += [libyuv_dep]\n> > >\n> > >  android_hal_sources = files([\n> > > +    'android_framebuffer.cpp',\n> > >      'camera3_hal.cpp',\n> > >      'camera_capabilities.cpp',\n> > >      'camera_device.cpp',\n> > > diff --git a/src/android/mm/cros_frame_buffer_allocator.cpp\n> > b/src/android/mm/cros_frame_buffer_allocator.cpp\n> > > index 52e8c180..163c5d75 100644\n> > > --- a/src/android/mm/cros_frame_buffer_allocator.cpp\n> > > +++ b/src/android/mm/cros_frame_buffer_allocator.cpp\n> > > @@ -14,6 +14,7 @@\n> > >\n> > >  #include \"libcamera/internal/framebuffer.h\"\n> > >\n> > > +#include \"../android_framebuffer.h\"\n> > >  #include \"../camera_device.h\"\n> > >  #include \"../frame_buffer_allocator.h\"\n> > >  #include \"cros-camera/camera_buffer_manager.h\"\n> > > @@ -47,11 +48,11 @@ public:\n> > >       {\n> > >       }\n> > >\n> > > -     std::unique_ptr<libcamera::FrameBuffer>\n> > > +     std::unique_ptr<AndroidFrameBuffer>\n> > >       allocate(int halPixelFormat, const libcamera::Size &size, uint32_t\n> > usage);\n> > >  };\n> > >\n> > > -std::unique_ptr<libcamera::FrameBuffer>\n> > > +std::unique_ptr<AndroidFrameBuffer>\n> > >  PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,\n> > >                                               const libcamera::Size\n> > &size,\n> > >                                               uint32_t usage)\n> > > @@ -80,9 +81,11 @@ PlatformFrameBufferAllocator::Private::allocate(int\n> > halPixelFormat,\n> > >               plane.length =\n> > cros::CameraBufferManager::GetPlaneSize(handle, i);\n> > >       }\n> > >\n> > > -     return std::make_unique<FrameBuffer>(\n> > > -\n> >  std::make_unique<CrosFrameBufferData>(std::move(scopedHandle)),\n> > > -             planes);\n> > > +     auto fb = std::make_unique<AndroidFrameBuffer>(handle,\n> > > +\n> > std::make_unique<CrosFrameBufferData>(std::move(scopedHandle)),\n> > > +                                                    planes);\n> > > +\n> > > +     return fb;\n> > >  }\n> > >\n> > >  PUBLIC_FRAME_BUFFER_ALLOCATOR_IMPLEMENTATION\n> > > diff --git a/src/android/mm/generic_frame_buffer_allocator.cpp\n> > b/src/android/mm/generic_frame_buffer_allocator.cpp\n> > > index acb2fa2b..c79b7b10 100644\n> > > --- a/src/android/mm/generic_frame_buffer_allocator.cpp\n> > > +++ b/src/android/mm/generic_frame_buffer_allocator.cpp\n> > > @@ -18,6 +18,7 @@\n> > >  #include <hardware/gralloc.h>\n> > >  #include <hardware/hardware.h>\n> > >\n> > > +#include \"../android_framebuffer.h\"\n> > >  #include \"../camera_device.h\"\n> > >  #include \"../frame_buffer_allocator.h\"\n> > >\n> > > @@ -77,7 +78,7 @@ public:\n> > >\n> > >       ~Private() override;\n> > >\n> > > -     std::unique_ptr<libcamera::FrameBuffer>\n> > > +     std::unique_ptr<AndroidFrameBuffer>\n> > >       allocate(int halPixelFormat, const libcamera::Size &size, uint32_t\n> > usage);\n> > >\n> > >  private:\n> > > @@ -92,7 +93,7 @@ PlatformFrameBufferAllocator::Private::~Private()\n> > >               gralloc_close(allocDevice_);\n> > >  }\n> > >\n> > > -std::unique_ptr<libcamera::FrameBuffer>\n> > > +std::unique_ptr<AndroidFrameBuffer>\n> > >  PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,\n> > >                                               const libcamera::Size\n> > &size,\n> > >                                               uint32_t usage)\n> > > @@ -135,9 +136,9 @@ PlatformFrameBufferAllocator::Private::allocate(int\n> > halPixelFormat,\n> > >               offset += planeSize;\n> > >       }\n> > >\n> > > -     return std::make_unique<FrameBuffer>(\n> > > -             std::make_unique<GenericFrameBufferData>(allocDevice_,\n> > handle),\n> > > -             planes);\n> > > +     return std::make_unique<AndroidFrameBuffer>(handle,\n> > > +\n> >  std::make_unique<GenericFrameBufferData>(allocDevice_, handle),\n> > > +                                                 planes);\n> > >  }\n> > >\n> > >  PUBLIC_FRAME_BUFFER_ALLOCATOR_IMPLEMENTATION","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 B43B9C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  1 Sep 2022 20:06:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0C21D61FD5;\n\tThu,  1 Sep 2022 22:06:01 +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 5B2A861FB9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  1 Sep 2022 22:05:59 +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 A626A6CD;\n\tThu,  1 Sep 2022 22:05:58 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662062761;\n\tbh=2Qve3WNen+b7G7Rxrw8f5lzgXB4/zKRQly2QhfGP+Kw=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=C1S/8+GEgEkxtF+sg8FD/tLipv84HOYH2Kp69PWE5QQugY05koclp6PnHQUmhM2KI\n\tc1EOtbP1E00Yz0r2VPoEv8uy/PaH8a6HMJixWCWpJTaXmKErEpFtJHgcFURUePdljT\n\tQjgDlDs5XyZVrnnxo6p90gLZGZcu607wvDWaWT0N+0g6VASE38psndk1lgrrUUT5gC\n\tV2wnc/dUQE+RQ8H75RcdGOmHcj1QdlYArBX5IYz7rVwb82DwEyiUiRAFAfpz+Ozr27\n\tRXLl57vhIFMWcyIfY4j4U8W+5DaUEXS8rLDZ2xMvmpA5/yTAPrVwkrzmdZD+Um13qm\n\t6LlN/0b2dJLKw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1662062758;\n\tbh=2Qve3WNen+b7G7Rxrw8f5lzgXB4/zKRQly2QhfGP+Kw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=vFBGYgVcjQjDE7TnIQTvLqHDEg1vzawWmZDRf2iO4moSBxTooaMFhNNME5U9Bcjrn\n\t8iFBpUd6/ViF+nHexB8Wc98dDQ7mfpnkE3dNL0dH7zfDiqxwPQriEXEl5R/XWWGVw+\n\tEH68apqeprrhkN3WACyl7LGfZ3r7G6vrNWxzKKKE="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"vFBGYgVc\"; dkim-atps=neutral","Date":"Thu, 1 Sep 2022 23:05:46 +0300","To":"Cheng-Hao Yang <chenghaoyang@chromium.org>","Message-ID":"<YxEQmuVEcSaUSBTG@pendragon.ideasonboard.com>","References":"<20220426091409.1352047-1-chenghaoyang@chromium.org>\n\t<20220426091409.1352047-3-chenghaoyang@chromium.org>\n\t<YmiKHYb9ZXlf+aL4@pendragon.ideasonboard.com>\n\t<CAEB1ahs0jtf8sVAaRQm+U8xSsWexi1en8Qeekpdo-AFsiSgBLg@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAEB1ahs0jtf8sVAaRQm+U8xSsWexi1en8Qeekpdo-AFsiSgBLg@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v3 2/4] Add AndroidFrameBuffer and\n\treplace FrameBuffer in src/android","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]