Show a patch.

GET /api/1.1/patches/15715/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 15715,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15715/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15715/",
    "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": "<20220426090029.1350103-3-chenghaoyang@chromium.org>",
    "date": "2022-04-26T09:00:27",
    "name": "[libcamera-devel,v2,2/4] Add AndroidFrameBuffer and replace FrameBuffer in src/android",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "0c5825c53c11979731a346f0eca44f095dc8ea8a",
    "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/15715/mbox/",
    "series": [
        {
            "id": 3070,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3070/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3070",
            "date": "2022-04-26T09:00:25",
            "name": "Add CrOS JEA implementation",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3070/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15715/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15715/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 3C213C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Apr 2022 09:01:19 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E78256564B;\n\tTue, 26 Apr 2022 11:01:18 +0200 (CEST)",
            "from mail-pf1-x429.google.com (mail-pf1-x429.google.com\n\t[IPv6:2607:f8b0:4864:20::429])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3BE6C60431\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Apr 2022 11:01:17 +0200 (CEST)",
            "by mail-pf1-x429.google.com with SMTP id b15so17390769pfm.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Apr 2022 02:01:17 -0700 (PDT)",
            "from chenghaoyang.c.googlers.com.com\n\t(93.135.240.35.bc.googleusercontent.com. [35.240.135.93])\n\tby smtp.gmail.com with ESMTPSA id\n\tc18-20020a056a000ad200b004cdccd3da08sm15449379pfl.44.2022.04.26.02.01.13\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 26 Apr 2022 02:01:14 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1650963679;\n\tbh=8GLF95nZOUUoDC2OuRz/C2csPeK61uEBRPSS+O0eQ/o=;\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=RHBAzgRJbv9HeOjuRgaopUwRauJENusQ0WxUer9lrijWymCo/uIX2+AJ5oZYy8p7O\n\t1Qyvz9jfWRfGKM0I6ZQya/MyXQWinN9zyqkr5cZlT5YH5MPaa/GnY0w9m61ibcMd9v\n\tWl3sft2p4LNodxSdZrQ9TY2tY4spKBSFmtDK6joWtBr/oKhW+nbqnSuAipkKaG20B5\n\tAlVS1nvLeHThM6tTLnD9SZTIe3V5keln8rlRfchN3YLIlDm1YPnzUQI/puj9Rl986/\n\tv4qj2fK96I1Sg1V7BPS+95RfnPRmL1WqFQMq8Bfl7q7uinH262jeMPoIPYi5oHKmLU\n\t6Bo8z8YE97rcg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=l9Uh5P6TFiKAcytQVKcaoT3erEQRbOSXlgXwZt1pR38=;\n\tb=WEa+cxKi+1RlfInMQmUiEf3knvCA/SiuahueU9iIC6sha1chnyXywFHgSmjTrQo1My\n\tCNkOIg7gFRwG3uDxC/woQYddGOXfRDB5YG3pTx/R2ju3i3hrXXWd420h5Rk/2sUeNLQM\n\tpq9EHJyOU6din1S1yCDilouNqNVIqn+NogQdc="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"WEa+cxKi\"; \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:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=l9Uh5P6TFiKAcytQVKcaoT3erEQRbOSXlgXwZt1pR38=;\n\tb=wLg822+S7g+1Wh97l+9C+cFdC4TIyagjqhVbOVL3x20IwGTj4zoeQOB8chdOSaNNBn\n\tZd/cnh6dKs8nCjMqD/oxA9x+oq9hsdBogSxdyd8KBuAs58SjzGxwdjIxhz+/oRxbLwnP\n\tj/JzFiJagjKp1nAaZ9TIjcta/4+kY/d85iwo4jMV8ySQrSEzDzfaW9QspeWn9OdPq5UK\n\tS2SttId8lK6rpW/YhoCVYZGrTz33MfGL6D4FvOvn43gYyAuHKomXQDZFEZ9Dm/8R/UBj\n\tlktJoqWw+MezAuCqKKaLzl3dbdphcmPdI39fgNb9AD1lNL+P6BnuCxP1q8zwVz1dBWYm\n\t8lrQ==",
        "X-Gm-Message-State": "AOAM533gvP8zV1W9d8Rbp41crLlTfBp7F866cHMNOVWzrdzZ/kkvPJvk\n\tpCwA5gbdG+dzSSz6FJwddVvMUUQJTZTLFR8P",
        "X-Google-Smtp-Source": "ABdhPJxf9Nozu8CrX/qJ8i9qtLJyD48bSGTv2XpqGFtcJcRBXPhJJLoTdTsOYi9rrYmdCxYWF6lOSQ==",
        "X-Received": "by 2002:a63:105:0:b0:3ab:e98:5844 with SMTP id\n\t5-20020a630105000000b003ab0e985844mr11549720pgb.218.1650963675312; \n\tTue, 26 Apr 2022 02:01:15 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 26 Apr 2022 09:00:27 +0000",
        "Message-Id": "<20220426090029.1350103-3-chenghaoyang@chromium.org>",
        "X-Mailer": "git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog",
        "In-Reply-To": "<20220426090029.1350103-1-chenghaoyang@chromium.org>",
        "References": "<20220426090029.1350103-1-chenghaoyang@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 2/4] Add AndroidFrameBuffer and replace\n\tFrameBuffer 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": "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": "AndroidFrameBuffer is derived from FrameBuffer with access to\nbuffer_handle_t, which is needed for JEA usage.\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",
    "diff": "diff --git a/src/android/android_framebuffer.cpp b/src/android/android_framebuffer.cpp\nnew file mode 100644\nindex 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+\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+\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+\t: FrameBuffer(planes, cookie), handle_(handle)\n+{\n+}\n+\n+buffer_handle_t AndroidFrameBuffer::getHandle() const\n+{\n+\treturn handle_;\n+}\ndiff --git a/src/android/android_framebuffer.h b/src/android/android_framebuffer.h\nnew file mode 100644\nindex 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+\t\tconst std::vector<Plane> &planes,\n+\t\tunsigned int cookie = 0);\n+\tAndroidFrameBuffer(buffer_handle_t handle,\n+\t\t\t   const std::vector<Plane> &planes,\n+\t\t\t   unsigned int cookie = 0);\n+\tbuffer_handle_t getHandle() const;\n+\n+private:\n+\tbuffer_handle_t handle_ = nullptr;\n+};\ndiff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 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)\ndiff --git a/src/android/frame_buffer_allocator.h b/src/android/frame_buffer_allocator.h\nindex 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\\\ndiff --git a/src/android/meson.build b/src/android/meson.build\nindex 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',\ndiff --git a/src/android/mm/cros_frame_buffer_allocator.cpp b/src/android/mm/cros_frame_buffer_allocator.cpp\nindex 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\ndiff --git a/src/android/mm/generic_frame_buffer_allocator.cpp b/src/android/mm/generic_frame_buffer_allocator.cpp\nindex 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\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "2/4"
    ]
}