Patch Detail
Show a patch.
GET /api/1.1/patches/18652/?format=api
{ "id": 18652, "url": "https://patchwork.libcamera.org/api/1.1/patches/18652/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18652/", "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": "<20230227-android-gralloc-v3-1-babbdf049259@baylibre.com>", "date": "2023-05-28T16:07:00", "name": "[libcamera-devel,RESEND,v3] android: mm: generic: use GRALLOC_HARDWARE_MODULE_ID", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "0591ce8b0baca390ecbf6d9510bc629654b5d6d8", "submitter": { "id": 153, "url": "https://patchwork.libcamera.org/api/1.1/people/153/?format=api", "name": "Mattijs Korpershoek", "email": "mkorpershoek@baylibre.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18652/mbox/", "series": [ { "id": 3890, "url": "https://patchwork.libcamera.org/api/1.1/series/3890/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3890", "date": "2023-05-28T16:07:00", "name": "[libcamera-devel,RESEND,v3] android: mm: generic: use GRALLOC_HARDWARE_MODULE_ID", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3890/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18652/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18652/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 C7A65C3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 28 May 2023 16:07:16 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 418FE626FA;\n\tSun, 28 May 2023 18:07:16 +0200 (CEST)", "from mail-pl1-x631.google.com (mail-pl1-x631.google.com\n\t[IPv6:2607:f8b0:4864:20::631])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 73A42626F7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 28 May 2023 18:07:13 +0200 (CEST)", "by mail-pl1-x631.google.com with SMTP id\n\td9443c01a7336-1b00ffb4186so15054685ad.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 28 May 2023 09:07:13 -0700 (PDT)", "from [10.228.2.211] (224.155.55.84.rev.sfr.net. [84.55.155.224])\n\tby smtp.gmail.com with ESMTPSA id\n\tz22-20020a1709028f9600b001ac40488620sm6462590plo.92.2023.05.28.09.07.08\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 28 May 2023 09:07:11 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1685290036;\n\tbh=6+pjW13oltCtROF2IVRJffgTr9KVfE/2DAmq3nHKMh8=;\n\th=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=JMD/ui95JKVQLHbP/numb+fUkeMS3GOj6RyGp3u7KVKkwkwXQvXXMlUIPVGsvy8VG\n\t/DJR5QUzW/nIXea9cHBmr6zdhPK1yr5q0GV161RIJ0kxCO3vICxiG0EADGx5TL28Vi\n\tNPaiFDLNjyvwHl16L6pnNhjT9BNTclP2NCt1QGfhpVIww1DVUboB8wvQiH4eCKA6iC\n\thiILL33voiUdCA6xtuEnx2wrMzV0NkOxUVK8U4mwE5ONhxpDrb4m+XNN6mUWjilglW\n\tUF8oW0IknYGR3Bums0+fPJm8aqMMSM+cA89QOx1qjPBaxIrgbVufIFtdwOBVRtJztM\n\t2hgJWs5HkrNkA==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1685290032;\n\tx=1687882032; \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=EvYTol28kVRNmd8znfjquRAfwKGtksg+QahfMbqU5AA=;\n\tb=cIChiBlDYJSbgzrSAXZ4Oudg43hPoIZRkaBTMJUd9m4/1XZ2wsXYbOu/WVKUm6bA1P\n\to7Z2FleZOQba5eW0/HXkgSoVmIMkbebKewAoEoIYmjwpMFNpg4MiJhzS7DCmUob7T+xz\n\tEy0h7gyVgkGyADTF7/xyJ3b241n/I0LmvfIaalzE4wzxk8LIcogBV9kWkjJea9SYBXqi\n\tEzVf6wQ8sFMjuz2qlPt7GrSbaP61DJmoFSIIUn87mw0lzwonVuu3g1g9D4+lKqVAQhgZ\n\tESZMY0xW9gdCXt9ErSqR10rR1PgAJrqBANuXb2SXOP4+hMEMHVWdLwADcPQDbndEeN75\n\tAwkA==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20221208.gappssmtp.com\n\theader.i=@baylibre-com.20221208.gappssmtp.com header.b=\"cIChiBlD\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1685290032; x=1687882032;\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=EvYTol28kVRNmd8znfjquRAfwKGtksg+QahfMbqU5AA=;\n\tb=cG+sxFC9TFurBsZsTP6E0gkitCb26QPi5bjoKxpGkfYGEXMQLJynQYouKmjpTa1iLy\n\tPqbZpGkTna3NYDEhlR4cYy+cgubswypx33TJYKEbikztxXZ8y5TBHJunb3E1Q2shswxz\n\ts7MAhvVNLOH/fn+I2lZD7//MmgucqzCGj2YZNIh7cz/rcKX6IsntH/V7zKGdpRpzKbvd\n\t4o3iwYQFOJWPD34I25F5lLKK7rVInuTIXEz7Fok+X4B1WsgKTCbf/6IMm57u972bnyYA\n\tREi3bzj4cidIlpij6Z6H50LdgVUOTgnTDlqE3ZQfZ2EU5L90Ddw/f5REDPbFpCgOFdy6\n\t/JhA==", "X-Gm-Message-State": "AC+VfDzZanBH240RMtpzcAWZgShUjIUZ7qfJHrMrvgbFbmIav2O000qi\n\tvM04lPPLkDUq+Q0SLpc37bkq8A==", "X-Google-Smtp-Source": "ACHHUZ76r1y0fksO8ZF3Wbf49qFRgK/ILrMrowbpYbrE1WoL1kOYbeo0C9dkgBC01QxaP0ot8ANoAw==", "X-Received": "by 2002:a17:902:9a85:b0:1b0:25ff:a8af with SMTP id\n\tw5-20020a1709029a8500b001b025ffa8afmr4829357plp.60.1685290031669; \n\tSun, 28 May 2023 09:07:11 -0700 (PDT)", "Date": "Sun, 28 May 2023 18:07:00 +0200", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20230227-android-gralloc-v3-1-babbdf049259@baylibre.com>", "To": "libcamera-devel@lists.libcamera.org", "X-Mailer": "b4 0.12.2", "Subject": "[libcamera-devel] [PATCH RESEND v3] 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 setup build -Dandroid=enabled -Dandroid_platform=generic\n---\nChanges in v3:\n- Add missing meson.build change to define libhardware dependency\n- Link to v2: https://lists.libcamera.org/pipermail/libcamera-devel/2023-February/036884.html\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 src/android/mm/meson.build | 1 +\n 2 files changed, 6 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>\ndiff --git a/src/android/mm/meson.build b/src/android/mm/meson.build\nindex d40a3b0ba2eb..42eeab3bcfa9 100644\n--- a/src/android/mm/meson.build\n+++ b/src/android/mm/meson.build\n@@ -4,6 +4,7 @@ platform = get_option('android_platform')\n if platform == 'generic'\n android_hal_sources += files(['generic_camera_buffer.cpp',\n 'generic_frame_buffer_allocator.cpp'])\n+ android_deps += [dependency('libhardware')]\n elif platform == 'cros'\n android_hal_sources += files(['cros_camera_buffer.cpp',\n 'cros_frame_buffer_allocator.cpp'])\n", "prefixes": [ "libcamera-devel", "RESEND", "v3" ] }