Patch Detail
Show a patch.
GET /api/1.1/patches/18655/?format=api
{ "id": 18655, "url": "https://patchwork.libcamera.org/api/1.1/patches/18655/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18655/", "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-v4-1-8cd3a44c5b70@baylibre.com>", "date": "2023-05-29T13:30:17", "name": "[libcamera-devel,v4] android: mm: generic: use GRALLOC_HARDWARE_MODULE_ID", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "22bbd958e47d7c501e41131ad6c797cf49505a7e", "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/18655/mbox/", "series": [ { "id": 3892, "url": "https://patchwork.libcamera.org/api/1.1/series/3892/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3892", "date": "2023-05-29T13:30:17", "name": "[libcamera-devel,v4] android: mm: generic: use GRALLOC_HARDWARE_MODULE_ID", "version": 4, "mbox": "https://patchwork.libcamera.org/series/3892/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18655/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18655/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 4C6A5C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 May 2023 13:30:38 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0FD83626F8;\n\tMon, 29 May 2023 15:30:38 +0200 (CEST)", "from mail-ed1-x535.google.com (mail-ed1-x535.google.com\n\t[IPv6:2a00:1450:4864:20::535])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 21F56626F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 May 2023 15:30:36 +0200 (CEST)", "by mail-ed1-x535.google.com with SMTP id\n\t4fb4d7f45d1cf-5149aafef44so1933593a12.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 May 2023 06:30:36 -0700 (PDT)", "from [10.2.5.100] (abordeaux-655-1-129-86.w90-5.abo.wanadoo.fr.\n\t[90.5.10.86]) by smtp.gmail.com with ESMTPSA id\n\tu4-20020a05640207c400b00514a6d05de9sm156015edy.88.2023.05.29.06.30.34\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 29 May 2023 06:30:35 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1685367038;\n\tbh=8YHBaKjcZvwuirnItvvTdE8XwUSArdlfjIpU2Wun2jY=;\n\th=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=MFo3vM+bPZ/DgQP/dKg2jAs1aQyCRWPjOXLTvrD+80VszBLE+UlKMXgk1WuGV+MRs\n\tkVBYbh5ZyucBPLVDc9B4sDMj1PDm0Cm7EptgvpptFhIqMq+Os6Tgt43f07sfYI/4JY\n\tMCMWpcSL70y9QlV75+084hWR5Js/UnCXCVZCpy1gtmf3AYDZ6N4IUpcil6Ccac2ny1\n\t3iZ30LsGULs2lCgufJlEmQ81Y2HP2pNg2ofwQGqoYxXpEIZSnkxzX6m03R35EwGW46\n\tJlhcxuKnBePFaJQ0BmztdIa0mvHNfVX/abQ7+wsa5iLzICN9bQLFHc+65IbohYKVMT\n\t8Lid5m7TdQK7w==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1685367035;\n\tx=1687959035; \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=ym3UGKNp6yp5lkLkUD7+AV7dH+RffFgtYALuXpjaC/U=;\n\tb=KMck49G3gCn5dlpR7GvJZ7K5BhCCgWpFfyKyrcWUX8X+p/+jCxqgO/1l8jG/scqy7K\n\tsLMwqmD6J60GR1V1gsKJ1HIy6mBD6yffAMZq1myCNqz48oOnRgZbW0zO9d1CvcGHnd5V\n\tOGue23hSU+GlgTdLdax9w7Q8qtsgPKVN8qRmjLfXJ7mdPYHfknYPFAJ0NfJpupJ9S0jA\n\tX6ZOgJOB4O7uY89RHfKwLwV5FztXvWCx6/WRASbp/K/kEVLiGq+KOI9ZZ4KsFdzqpXya\n\t3EKzx0GJIRKvBgOFZk0rLBcZKYAsRJqrmKxaoacg+MllAt5b1EMU/PEKsGKz3quNNt6P\n\tqavw==" ], "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=\"KMck49G3\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1685367035; x=1687959035;\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=ym3UGKNp6yp5lkLkUD7+AV7dH+RffFgtYALuXpjaC/U=;\n\tb=aArGg3uQpdrXtb6Y6uhpmxMQUty8eeAbjYs7TjpmGKJlu/+IJdZGqSuCAB5M1HFHqp\n\tNt/OISklnVZIgjjMS3XK/dlVP2mJ33BGdB4POPVLBUaOJShRpJvXjL/F3EXgjLf6hwRv\n\t5ptRBT2tl6NUpmNuPaeTkiKD/CdahPzZIy3IxPDhbnASaj98iZRxopS6xt77XrmI2nbr\n\tJFNke/l9EsUPaib7Ew1YZDeGG8RT0ATRvJ60I8qMmTLeeycGZalvDDbKDi0mx0xM5Dim\n\tVeJHuZ5X+dTxLQuuV+LJGH1m5mp4rt+FhG94JeFH49vwPqMQdQ32FpxTlAZZn83sIIPz\n\tr/XQ==", "X-Gm-Message-State": "AC+VfDwFv1ORRHWLHy6AwaPMYq/JC8tD39z0BQIbitYTKIXwHH4g7Zl/\n\tvDvqAONH/t95mFH8rweJmkMrCQ==", "X-Google-Smtp-Source": "ACHHUZ7UB6ugqHtO8n9JLRRfocEafvU2vAmdi4iyiNONcgHLWK55zXdK3kIF5B5OUFxWIJcS058FdQ==", "X-Received": "by 2002:a50:fa8b:0:b0:514:7f39:aa80 with SMTP id\n\tw11-20020a50fa8b000000b005147f39aa80mr7540969edr.18.1685367035667; \n\tMon, 29 May 2023 06:30:35 -0700 (PDT)", "Date": "Mon, 29 May 2023 15:30:17 +0200", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20230227-android-gralloc-v4-1-8cd3a44c5b70@baylibre.com>", "X-B4-Tracking": "v=1; b=H4sIAOiodGQC/4XOwQ6CMAwG4FchOzsztgnqyfcwHrqtwBJkpiOLh\n\tPDuDo5Gw/Fv0+/vzCKSx8iuxcwIk48+DDnoQ8FsB0OL3LucmRRSCSlrDoOj4B1vCfo+WC40qtK\n\td0NnqzPKVgYjcEAy2W++eEEekdfEibPx7q7o/cu58HANNW3Mq1+n/klTykitVicY2UFvhbgam3\n\thvCow1PtnJJ7hAyE0JejHYShNW/CLVDqEw4hQJ0oyE/80Usy/IB7xQBZFABAAA=", "To": "libcamera-devel@lists.libcamera.org", "X-Mailer": "b4 0.12.2", "Subject": "[libcamera-devel] [PATCH v4] 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 adds new dependencies on android's libhardware [1] and on libdl.\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\n(Laurent, I dropped your reviewed-by since there are additional changes)\n---\nChanges in v4:\n- Add missing meson.build change to link against libdl\n- Link to v3: https://lists.libcamera.org/pipermail/libcamera-devel/2023-May/037926.html\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: 76e1cb9f7176b4e7a935295d4e633ee24a0fef67\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..c92416bd3a6f 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 += [libdl, 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", "v4" ] }