Patch Detail
Show a patch.
GET /api/1.1/patches/18263/?format=api
{ "id": 18263, "url": "https://patchwork.libcamera.org/api/1.1/patches/18263/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18263/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20230208033319.1361109-3-chenghaoyang@google.com>", "date": "2023-02-08T03:33:16", "name": "[libcamera-devel,v10,2/5] android: framebuffer: Add HALFrameBuffer and replace FrameBuffer", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "9018dcccc061e88e1206dd44a36fe26f208e0c6e", "submitter": { "id": 117, "url": "https://patchwork.libcamera.org/api/1.1/people/117/?format=api", "name": "Cheng-Hao Yang", "email": "chenghaoyang@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18263/mbox/", "series": [ { "id": 3743, "url": "https://patchwork.libcamera.org/api/1.1/series/3743/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3743", "date": "2023-02-08T03:33:14", "name": "Add CrOS JEA implementation", "version": 10, "mbox": "https://patchwork.libcamera.org/series/3743/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18263/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18263/checks/", "tags": {}, "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 A6938C324D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 8 Feb 2023 03:33:32 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CF90F62602;\n\tWed, 8 Feb 2023 04:33:31 +0100 (CET)", "from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com\n\t[IPv6:2607:f8b0:4864:20::62a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A2FE8603B8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 8 Feb 2023 04:33:28 +0100 (CET)", "by mail-pl1-x62a.google.com with SMTP id w5so7841818plg.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 07 Feb 2023 19:33:28 -0800 (PST)", "from chenghaoyang-low.c.googlers.com.com\n\t(46.165.189.35.bc.googleusercontent.com. [35.189.165.46])\n\tby smtp.gmail.com with ESMTPSA id\n\te9-20020a170902784900b00194c82c2a7bsm9621963pln.224.2023.02.07.19.33.25\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 07 Feb 2023 19:33:26 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1675827211;\n\tbh=kfXCe6d0JENl0nWbN5zN6XjCdC6VmPsDqnb6LpuILsw=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Wdv0y0Kfo+7Ogefn3JqBsZl8kQujwSC/g9uCdGRsEFPYMYHaSuzzZIvlMikVnqfHK\n\tSHBUD4486Y2iZY6itbs/8ELgs50NUlx9stgKQhXoMwRkb5tB8mpF/oH1PN6cc85CQ9\n\t4fP9lkV0ELNCM7VAIP2YsDHiOXAd476SAIvp4YhBu6YmvQvm9f5cOMIR8j8svdiGD6\n\thhjX7dBOnQgj5JrBkvIQcUzQ+qFJ4OaDemkBDLKqJGnWnJVg7+xlNKJkwCcPMe5EdC\n\tDodlIazxtNHTvcI8qL8jvd5/AsZjq482Jl15qCIpmbtoun2sqYvSaxR9E1ANfH3C+C\n\tpBVeyxqdRnApw==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=z/t7H/Omk/nheHrPMv8hRot19I4ehunO7Rb/xDqKUhE=;\n\tb=TPIvGXMXcadtvb5NTgh/TEUkqyqO/zp+QjTZy3NhMlRtPIcZ4Yo3CNwFq+OZTryJS6\n\tL3cgB2GMHMcPTphy4vob57YKkc0F6DVAbA5xcU6guUovzICJwQoputlxp+vpDdjxZ8BP\n\tVo+V/mfXLAfqom1WZQiBhpkCelFpYAArmO+2U=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"TPIvGXMX\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=z/t7H/Omk/nheHrPMv8hRot19I4ehunO7Rb/xDqKUhE=;\n\tb=X9TRrlkISUYl51EYRglkv2OUYo07zurk+oX2lrlv2gwpXP3XvOyllL3cf1TSfCO9FE\n\tZ1zM1bByPF/bfTCywuSfkP4DuopATZ6aTuiEkWghWuu/ZotHXEVIUuWicWJfa40NtgFh\n\tUoW/eXE+KEhaBjlTDKT66n7ic4CeBOhG334JSRjk/f//QL9KS2A+2ziG5S7dYVAdU8Xn\n\t2HqJaSiySU17sg3kJDBofw+jjvGYC8rHkMCLDyXYmy6zovg82iw5JAKDTr723m4l3T8F\n\tPL37kvjwaCnanRAkkh7JKAvOf6jyQCO3+Dp4XYRA7G64CFa4uISVaWQUA2nRoYU6qpo3\n\tVjkQ==", "X-Gm-Message-State": "AO0yUKUCEOdRKvq8umkdsKp5lws39DoUwpHiqOiVnUvUSg5W+kdTs+63\n\tmGqh2dIkYwrySCGLKA76nsq5JURi214Uf/Ny", "X-Google-Smtp-Source": "AK7set85Cdk3HUWAI9d4Kk00jonkpU5dXflWL+w+iNXTnBawtj6Tuq2SimcDoQpMZ7WeCl/SHFm6BQ==", "X-Received": "by 2002:a17:902:dac7:b0:193:678:df13 with SMTP id\n\tq7-20020a170902dac700b001930678df13mr7043782plx.36.1675827207000; \n\tTue, 07 Feb 2023 19:33:27 -0800 (PST)", "X-Google-Original-From": "Harvey Yang <chenghaoyang@google.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 8 Feb 2023 03:33:16 +0000", "Message-Id": "<20230208033319.1361109-3-chenghaoyang@google.com>", "X-Mailer": "git-send-email 2.39.1.519.gcb327c4b5f-goog", "In-Reply-To": "<20230208033319.1361109-1-chenghaoyang@google.com>", "References": "<20230208033319.1361109-1-chenghaoyang@google.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v10 2/5] android: framebuffer: Add\n\tHALFrameBuffer and replace 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>", "From": "Harvey Yang via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Harvey Yang <chenghaoyang@chromium.org>", "Cc": "Harvey Yang <chenghaoyang@chromium.org>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: Harvey Yang <chenghaoyang@chromium.org>\n\nHALFrameBuffer is derived from FrameBuffer with access to\nbuffer_handle_t, which is needed for JEA usage.\n\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Han-Lin Chen <hanlinchen@chromium.org>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/camera_device.cpp | 5 ++--\n src/android/camera_device.h | 3 ++-\n src/android/camera_request.h | 3 ++-\n src/android/frame_buffer_allocator.h | 7 ++---\n src/android/hal_framebuffer.cpp | 22 ++++++++++++++++\n src/android/hal_framebuffer.h | 26 +++++++++++++++++++\n src/android/meson.build | 1 +\n .../mm/cros_frame_buffer_allocator.cpp | 9 ++++---\n .../mm/generic_frame_buffer_allocator.cpp | 11 +++++---\n 9 files changed, 72 insertions(+), 15 deletions(-)\n create mode 100644 src/android/hal_framebuffer.cpp\n create mode 100644 src/android/hal_framebuffer.h", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex b20e389b..1f7ce440 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -30,6 +30,7 @@\n #include \"camera_hal_config.h\"\n #include \"camera_ops.h\"\n #include \"camera_request.h\"\n+#include \"hal_framebuffer.h\"\n \n using namespace libcamera;\n \n@@ -771,7 +772,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \treturn 0;\n }\n \n-std::unique_ptr<FrameBuffer>\n+std::unique_ptr<HALFrameBuffer>\n CameraDevice::createFrameBuffer(const buffer_handle_t camera3buffer,\n \t\t\t\tPixelFormat pixelFormat, const Size &size)\n {\n@@ -794,7 +795,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<HALFrameBuffer>(planes, camera3buffer);\n }\n \n int CameraDevice::processControls(Camera3RequestDescriptor *descriptor)\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex 64050416..43ee0159 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -29,6 +29,7 @@\n #include \"camera_capabilities.h\"\n #include \"camera_metadata.h\"\n #include \"camera_stream.h\"\n+#include \"hal_framebuffer.h\"\n #include \"jpeg/encoder.h\"\n \n class Camera3RequestDescriptor;\n@@ -83,7 +84,7 @@ private:\n \n \tvoid stop() LIBCAMERA_TSA_EXCLUDES(stateMutex_);\n \n-\tstd::unique_ptr<libcamera::FrameBuffer>\n+\tstd::unique_ptr<HALFrameBuffer>\n \tcreateFrameBuffer(const buffer_handle_t camera3buffer,\n \t\t\t libcamera::PixelFormat pixelFormat,\n \t\t\t const libcamera::Size &size);\ndiff --git a/src/android/camera_request.h b/src/android/camera_request.h\nindex 37b6ae32..20aba79d 100644\n--- a/src/android/camera_request.h\n+++ b/src/android/camera_request.h\n@@ -21,6 +21,7 @@\n #include <hardware/camera3.h>\n \n #include \"camera_metadata.h\"\n+#include \"hal_framebuffer.h\"\n \n class CameraBuffer;\n class CameraStream;\n@@ -44,7 +45,7 @@ public:\n \n \t\tCameraStream *stream;\n \t\tbuffer_handle_t *camera3Buffer;\n-\t\tstd::unique_ptr<libcamera::FrameBuffer> frameBuffer;\n+\t\tstd::unique_ptr<HALFrameBuffer> frameBuffer;\n \t\tlibcamera::UniqueFD fence;\n \t\tStatus status = Status::Success;\n \t\tlibcamera::FrameBuffer *internalBuffer = nullptr;\ndiff --git a/src/android/frame_buffer_allocator.h b/src/android/frame_buffer_allocator.h\nindex 5d2eeda1..e5c94922 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 \"hal_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<HALFrameBuffer> 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<HALFrameBuffer> \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\\\ndiff --git a/src/android/hal_framebuffer.cpp b/src/android/hal_framebuffer.cpp\nnew file mode 100644\nindex 00000000..3f3d1ed1\n--- /dev/null\n+++ b/src/android/hal_framebuffer.cpp\n@@ -0,0 +1,22 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Google Inc.\n+ *\n+ * hal_framebuffer.cpp - HAL Frame Buffer Handling\n+ */\n+\n+#include \"hal_framebuffer.h\"\n+\n+#include <hardware/camera3.h>\n+\n+HALFrameBuffer::HALFrameBuffer(std::unique_ptr<Private> d,\n+\t\t\t buffer_handle_t handle)\n+\t: FrameBuffer(std::move(d)), handle_(handle)\n+{\n+}\n+\n+HALFrameBuffer::HALFrameBuffer(const std::vector<Plane> &planes,\n+\t\t\t buffer_handle_t handle)\n+\t: FrameBuffer(planes), handle_(handle)\n+{\n+}\ndiff --git a/src/android/hal_framebuffer.h b/src/android/hal_framebuffer.h\nnew file mode 100644\nindex 00000000..dc96a7e1\n--- /dev/null\n+++ b/src/android/hal_framebuffer.h\n@@ -0,0 +1,26 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Google Inc.\n+ *\n+ * hal_framebuffer.h - HAL Frame Buffer Handling\n+ */\n+\n+#pragma once\n+\n+#include \"libcamera/internal/framebuffer.h\"\n+\n+#include <hardware/camera3.h>\n+\n+class HALFrameBuffer final : public libcamera::FrameBuffer\n+{\n+public:\n+\tHALFrameBuffer(std::unique_ptr<Private> d,\n+\t\t buffer_handle_t handle);\n+\tHALFrameBuffer(const std::vector<Plane> &planes,\n+\t\t buffer_handle_t handle);\n+\n+\tbuffer_handle_t handle() const { return handle_; }\n+\n+private:\n+\tbuffer_handle_t handle_;\n+};\ndiff --git a/src/android/meson.build b/src/android/meson.build\nindex 1bba54de..b543c143 100644\n--- a/src/android/meson.build\n+++ b/src/android/meson.build\n@@ -46,6 +46,7 @@ android_hal_sources = files([\n 'camera_ops.cpp',\n 'camera_request.cpp',\n 'camera_stream.cpp',\n+ 'hal_framebuffer.cpp',\n 'jpeg/encoder_libjpeg.cpp',\n 'jpeg/exif.cpp',\n 'jpeg/post_processor_jpeg.cpp',\ndiff --git a/src/android/mm/cros_frame_buffer_allocator.cpp b/src/android/mm/cros_frame_buffer_allocator.cpp\nindex 0665c77b..0a5c59f2 100644\n--- a/src/android/mm/cros_frame_buffer_allocator.cpp\n+++ b/src/android/mm/cros_frame_buffer_allocator.cpp\n@@ -16,6 +16,7 @@\n \n #include \"../camera_device.h\"\n #include \"../frame_buffer_allocator.h\"\n+#include \"../hal_framebuffer.h\"\n #include \"cros-camera/camera_buffer_manager.h\"\n \n using namespace libcamera;\n@@ -48,11 +49,11 @@ public:\n \t{\n \t}\n \n-\tstd::unique_ptr<libcamera::FrameBuffer>\n+\tstd::unique_ptr<HALFrameBuffer>\n \tallocate(int halPixelFormat, const libcamera::Size &size, uint32_t usage);\n };\n \n-std::unique_ptr<libcamera::FrameBuffer>\n+std::unique_ptr<HALFrameBuffer>\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@@ -81,8 +82,8 @@ 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), planes));\n+\treturn std::make_unique<HALFrameBuffer>(\n+\t\tstd::make_unique<CrosFrameBufferData>(std::move(scopedHandle), planes), handle);\n }\n \n PUBLIC_FRAME_BUFFER_ALLOCATOR_IMPLEMENTATION\ndiff --git a/src/android/mm/generic_frame_buffer_allocator.cpp b/src/android/mm/generic_frame_buffer_allocator.cpp\nindex 956623df..3750e1bf 100644\n--- a/src/android/mm/generic_frame_buffer_allocator.cpp\n+++ b/src/android/mm/generic_frame_buffer_allocator.cpp\n@@ -20,6 +20,7 @@\n \n #include \"../camera_device.h\"\n #include \"../frame_buffer_allocator.h\"\n+#include \"../hal_framebuffer.h\"\n \n using namespace libcamera;\n \n@@ -79,7 +80,7 @@ public:\n \n \t~Private() override;\n \n-\tstd::unique_ptr<libcamera::FrameBuffer>\n+\tstd::unique_ptr<HALFrameBuffer>\n \tallocate(int halPixelFormat, const libcamera::Size &size, uint32_t usage);\n \n private:\n@@ -94,7 +95,7 @@ PlatformFrameBufferAllocator::Private::~Private()\n \t\tgralloc_close(allocDevice_);\n }\n \n-std::unique_ptr<libcamera::FrameBuffer>\n+std::unique_ptr<HALFrameBuffer>\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@@ -137,8 +138,10 @@ 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, planes));\n+\treturn std::make_unique<HALFrameBuffer>(\n+\t\tstd::make_unique<GenericFrameBufferData>(\n+\t\t\tallocDevice_, handle, planes),\n+\t\thandle);\n }\n \n PUBLIC_FRAME_BUFFER_ALLOCATOR_IMPLEMENTATION\n", "prefixes": [ "libcamera-devel", "v10", "2/5" ] }