Show a patch.

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

{
    "id": 18320,
    "url": "https://patchwork.libcamera.org/api/patches/18320/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18320/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20230227-android-gralloc-v2-1-029b4d2a0c4d@baylibre.com>",
    "date": "2023-02-28T14:15:46",
    "name": "[libcamera-devel,v2] android: mm: generic: use GRALLOC_HARDWARE_MODULE_ID",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "24c54a8885c1aa14d60838ed23dc932c15bc4d65",
    "submitter": {
        "id": 153,
        "url": "https://patchwork.libcamera.org/api/people/153/?format=api",
        "name": "Mattijs Korpershoek",
        "email": "mkorpershoek@baylibre.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18320/mbox/",
    "series": [
        {
            "id": 3777,
            "url": "https://patchwork.libcamera.org/api/series/3777/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3777",
            "date": "2023-02-28T14:15:46",
            "name": "[libcamera-devel,v2] android: mm: generic: use GRALLOC_HARDWARE_MODULE_ID",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3777/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18320/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18320/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 CC0A8BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Feb 2023 14:15:54 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 512886269B;\n\tTue, 28 Feb 2023 15:15:54 +0100 (CET)",
            "from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com\n\t[IPv6:2a00:1450:4864:20::32a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5A3A962691\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Feb 2023 15:15:52 +0100 (CET)",
            "by mail-wm1-x32a.google.com with SMTP id\n\tbg16-20020a05600c3c9000b003eb34e21bdfso6206164wmb.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Feb 2023 06:15:52 -0800 (PST)",
            "from mkorpershoek-xps13.local ([82.66.159.240])\n\tby smtp.gmail.com with ESMTPSA id\n\tn4-20020a7bcbc4000000b003dc3f3d77e3sm11872464wmi.7.2023.02.28.06.15.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 28 Feb 2023 06:15:51 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1677593754;\n\tbh=sH2oboiKC3GZs1NqkSGOTYXrPWvyQopl0ozF0QBoQsg=;\n\th=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=Bkv6rcM1ztl606YPiVyAfDs9NfYjLY5rP57bbsxpLpqJ4McbKcxXDW7A+5Jk6A+EJ\n\th+0xZaqwAuTMgrQv5knGNgmkKM90y20h6muW0dDOWDQDk4IbfmpoBgCDLh+UoXpB19\n\tjkYvlIcIA3NKEf7YuuVVg15PdbJ1/FIfppaUa+qdCexaqJt4TCaQE9fTmUxz4d89Ba\n\t8pCMGb1cUCCwGn+mndwkbQmfRYPa5CuIQd8B3c3KuRNB+j6iQ4JVjqvOuZTj3Fg5GB\n\t6XFNwqOrEDOwqCLDC8+teMmnoaAael9WXUYDdI9hhxV+pRzveI6DFQxlYRWFGtzJN8\n\tRbQIBi5gqLkdg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20210112.gappssmtp.com; s=20210112;\n\th=cc:to:message-id:content-transfer-encoding:mime-version:subject\n\t:date:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=xfrgrBwq986v9yu5KBszNOyOzUhzZe5srlbJGY80N64=;\n\tb=NYZvhrbeoOSdnWxAXhylzOTXdCGOoMd4weM5WvfyJoD6yIBWLQPV1F94bYnpdyHWZv\n\tgTar8Z8/pfsCygp6cIjNnXTGCxkr4ARLJapCunuGhDhtufXa28Q4XHSy7GbUF5rojv1w\n\tLdQcodG/vHVRv7hhL/NjOc20wo2L/ke8UNXHCJvf/noAKQdmZYTdWa20ceqycab2ZNp7\n\tRLc1jfZI60bcn1/3XexVNFHFcustvIga+7xt0/KUrdJPqnu35sPqydIvwXNwzQAJfXdz\n\tR8aSawAR/C+5u00pkd9THPFERxmMlj79Vze1dMsh6IkY3jj/aefZsUiKexC4uohuL5Kz\n\tZWHA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20210112.gappssmtp.com\n\theader.i=@baylibre-com.20210112.gappssmtp.com header.b=\"NYZvhrbe\"; \n\tdkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:message-id:content-transfer-encoding:mime-version:subject\n\t:date:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=xfrgrBwq986v9yu5KBszNOyOzUhzZe5srlbJGY80N64=;\n\tb=VIPsBPlxlAwdzVXBcJoOwcgInE88gJdI4Aq4Hb0Qe4VSH6Y84qfY7Iu5QIFLsJWzg0\n\tbydufQDhIaSjPvkTg73QdIL4ewXQHnoNqPgVcRQY86PP9eXQvuwl58lP/+qMfYsBdcSZ\n\tN4vhBBIFIttDrHhramUN50M6R/T0gNHHFgFytGFmt96SDmbPfCBrW1K6hPL9jloE7I8m\n\tzU6LBRJaz7/dUiW22RIqGB8Ym0kWWGlmZJRJcNZT/d/HGBAA7hGWOv3GGfsNmAc7lkwK\n\txEVb9qozQJNwHks+UXuMSKHaVrDIfIX2ivk2dTtAWme2nfXo4tuIY3DtvaKRIKct8HTG\n\taLgw==",
        "X-Gm-Message-State": "AO0yUKWMy7wE8zJT9/vJYSIgKVUdyHmRwaD/NeKoMJBnunFutL/sJgYP\n\t/5cElp6DGt3I9gbL8r5agFu30X1IJDEsOCTd",
        "X-Google-Smtp-Source": "AK7set93jtgbMj4NSQLINVwZEnf/ffjSlDs3sTtMelvY7dRp49au4GRtZjqPtU6OsQFH4ruIbZ0WjA==",
        "X-Received": "by 2002:a05:600c:1c96:b0:3eb:38b0:e757 with SMTP id\n\tk22-20020a05600c1c9600b003eb38b0e757mr2358787wms.10.1677593751860; \n\tTue, 28 Feb 2023 06:15:51 -0800 (PST)",
        "Date": "Tue, 28 Feb 2023 15:15:46 +0100",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20230227-android-gralloc-v2-1-029b4d2a0c4d@baylibre.com>",
        "X-B4-Tracking": "v=1; b=H4sIAJEM/mMC/3WNywqDMBBFf0WybkoerZau+h/FxSQZdUCTMhGpi\n\tP/e6L7Lcy+Hs4mMTJjFs9oE40KZUixgLpXwA8QeJYXCwihjlTGNhBg4UZA9wzgmL9UNrQ53DL5\n\t+iGI5yCgdQ/TD4U2QZ+Tj+DB29D1T77bwQHlOvJ7lRR/r/8iipZbW1qrzHTRehZeDdSTHePVpE\n\tu2+7z+o3XHwygAAAA==",
        "To": "libcamera-devel@lists.libcamera.org",
        "X-Mailer": "b4 0.12.1",
        "Subject": "[libcamera-devel] [PATCH v2] android: mm: generic: use\n\tGRALLOC_HARDWARE_MODULE_ID",
        "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": "Mattijs Korpershoek via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Mattijs Korpershoek <mkorpershoek@baylibre.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "PlatformFrameBufferAllocator is an abstraction over gralloc.\nRight now hardwareModule_ points towards a CAMERA_HARDWARE_MODULE_ID.\n\nWhen gralloc_open() is called we observe:\nlibcamera: DEBUG HAL camera3_hal.cpp:75 Open camera gpu0\nlibcamera: ERROR Camera camera.cpp:524 Camera in Configured state trying acquire() requiring state Available\n01-23 14:14:04.742   370   416 E libcamera: FATAL HAL generic_frame_buffer_allocator.cpp:105 gralloc_open() failed: -87\n\nWhich is wrong, gralloc_open() is attempting to re-open the camera HAL,\ninstead of the gralloc HAL.\n\nPoint to a GRALLOC_HARDWARE_MODULE_ID instead so that we can request\nbuffers from gralloc in android.\n\nNote: this add a new dependency on android's libhardware [1]\n\n[1] https://android.googlesource.com/platform/hardware/libhardware\n\nFixes: c58662c5770e (\"android: Introduce PlatformFrameBufferAllocator\")\nSigned-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>\n---\n* Tested on an integration branch in Android 12 (Using android.bp)\n* Build tested with meson.\n---\nChanges in v2:\n- Add dlclose() in PlatformFrameBufferAllocator destructor (Laurent)\n- Removed RFC, as linking against an AOSP lib for android is OK.\n- Link to v1: https://lists.libcamera.org/pipermail/libcamera-devel/2023-February/036857.html\n---\n src/android/mm/generic_frame_buffer_allocator.cpp | 7 +++++--\n 1 file changed, 5 insertions(+), 2 deletions(-)\n\n\n---\nbase-commit: 58e0b6e18c425072a47594f42fc0b61801403aca\nchange-id: 20230227-android-gralloc-04e31d5edc68\n\nBest regards,",
    "diff": "diff --git a/src/android/mm/generic_frame_buffer_allocator.cpp b/src/android/mm/generic_frame_buffer_allocator.cpp\nindex 3750e1bf52a9..7ecef2c669df 100644\n--- a/src/android/mm/generic_frame_buffer_allocator.cpp\n+++ b/src/android/mm/generic_frame_buffer_allocator.cpp\n@@ -5,6 +5,7 @@\n  * generic_camera_buffer.cpp - Allocate FrameBuffer using gralloc API\n  */\n \n+#include <dlfcn.h>\n #include <memory>\n #include <vector>\n \n@@ -72,9 +73,10 @@ class PlatformFrameBufferAllocator::Private : public Extensible::Private\n public:\n \tPrivate(CameraDevice *const cameraDevice)\n \t\t: cameraDevice_(cameraDevice),\n-\t\t  hardwareModule_(cameraDevice->camera3Device()->common.module),\n+\t\t  hardwareModule_(nullptr),\n \t\t  allocDevice_(nullptr)\n \t{\n+\t\thw_get_module(GRALLOC_HARDWARE_MODULE_ID, &hardwareModule_);\n \t\tASSERT(hardwareModule_);\n \t}\n \n@@ -85,7 +87,7 @@ public:\n \n private:\n \tconst CameraDevice *const cameraDevice_;\n-\tstruct hw_module_t *const hardwareModule_;\n+\tconst struct hw_module_t *hardwareModule_;\n \tstruct alloc_device_t *allocDevice_;\n };\n \n@@ -93,6 +95,7 @@ PlatformFrameBufferAllocator::Private::~Private()\n {\n \tif (allocDevice_)\n \t\tgralloc_close(allocDevice_);\n+\tdlclose(hardwareModule_->dso);\n }\n \n std::unique_ptr<HALFrameBuffer>\n",
    "prefixes": [
        "libcamera-devel",
        "v2"
    ]
}