Patch Detail
Show a patch.
GET /api/1.1/patches/18997/?format=api
{ "id": 18997, "url": "https://patchwork.libcamera.org/api/1.1/patches/18997/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18997/", "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": "<20230912-gralloc-api-v4-v2-2-e859da63f98c@baylibre.com>", "date": "2023-09-12T14:15:21", "name": "[libcamera-devel,v2,2/4] android: Import GraphicBufferAllocator header from vndk v33", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "3533c4ef692c6bb8e829c401ef99d39beb2d516e", "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/18997/mbox/", "series": [ { "id": 4018, "url": "https://patchwork.libcamera.org/api/1.1/series/4018/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4018", "date": "2023-09-12T14:15:19", "name": "android: switch over to modern gralloc API via libui", "version": 2, "mbox": "https://patchwork.libcamera.org/series/4018/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18997/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18997/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 51957C32B0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 Sep 2023 14:15:32 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9B30261DEF;\n\tTue, 12 Sep 2023 16:15:31 +0200 (CEST)", "from mail-wm1-x329.google.com (mail-wm1-x329.google.com\n\t[IPv6:2a00:1450:4864:20::329])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 72528628F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Sep 2023 16:15:28 +0200 (CEST)", "by mail-wm1-x329.google.com with SMTP id\n\t5b1f17b1804b1-401da71b7c5so64377275e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Sep 2023 07:15:28 -0700 (PDT)", "from [192.168.2.39] ([82.66.159.240])\n\tby smtp.gmail.com with ESMTPSA id\n\ty9-20020a7bcd89000000b003fed630f560sm12996380wmj.36.2023.09.12.07.15.27\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 12 Sep 2023 07:15:27 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1694528131;\n\tbh=lgj0ZB2d6fBtKECTnBueFfk0BmVgG8zjpZqDhXO0D7M=;\n\th=Date:References:In-Reply-To:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=uuSN7GQ/HEc89awNX5MEfHtmK1rSiLP5GVf3/0u4J9dAx2lA0l6ol4kEDTa2uxUBa\n\t7/bfIIwqzocgEz5NsWLRJQHpui/WFqHvIB0EDZiT8a2jl+3N37WgksRptNchmjfDDZ\n\tK6TY/cjQRIGRSIK0dni1KR9Q+9PgB/LdXUsPwVMkPpWs9f+XZmpqQV1fmU3oQqR16B\n\t/SFJ2LKkZIchtWSwuzGwADn7gmynqhkd5yBwwMWz9FSI0anN3N0v1sM92GWUY15BFc\n\taLcfFeWHX9h7h8Sk/USIFcBuWpmRqrkulxkUyV5/qArzTusKNZt/DyNkhmG5I7+tLn\n\t6K1EjDmHAAGGg==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1694528128;\n\tx=1695132928; darn=lists.libcamera.org; \n\th=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n\t:mime-version:subject:date:from:from:to:cc:subject:date:message-id\n\t:reply-to; bh=OqTOWyJSnZVOAfjh8r0tYOaae7jupjSbWMDA90wU7i8=;\n\tb=zGPCgBu5IXK934oI+JhYw/zQ4xZjK48CdlSNGgkaIK+XFU2fP0gRd3wt0/qJEt4WBQ\n\tKzsXc/eLh/gdPEpdmSU2sY4XAiuJrqRflJ1+Pq1Hmxn+i8RQf9dOkLx7CJt+l6xd8Bud\n\tiIWxOIyJ1o1qVinPjAMKoWFCIkOPbgxirLwcsc7/Jd4kSb5papXgIeAqT8RCZK4bsf1p\n\t0X8f9F3x8mPPxvP3muc6Uqoj1nKQnT1adsL759+w50d6Wdz5qBO/ZnZmfKkOWRhaTxwS\n\tLmNTP1Amzohyq+rHOvNCHV51ZaVyiWeHVYIEZuYLce9SqcVml2v8DftvMarFU3XMLg3K\n\tDleA==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20230601.gappssmtp.com\n\theader.i=@baylibre-com.20230601.gappssmtp.com header.b=\"zGPCgBu5\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1694528128; x=1695132928;\n\th=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n\t:mime-version:subject:date:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=OqTOWyJSnZVOAfjh8r0tYOaae7jupjSbWMDA90wU7i8=;\n\tb=PVk8pUSBzemUenPEmqrA7Qk8hcwuW4+IFPB95hPnF0pKhpwfKil5HiazJzZCdi/S/C\n\t0BFs/mJtBFvQElpdVYI46C/pvPKbfpktYH1GWR+wSNRZZ6ooa+J5sRlV61IOeSUrU11B\n\t3ucpvsk+ESdTz+dQSopgu+GCD0c0ELHDMgsEMRe10gFbXVnoQ8xGsBuBuV6WNqUbmMET\n\tZOgqrfOeXElewNE65nSD/eBaNoOy1S+joWC6C6f9obj7KVFGYvrj5DPflIS89OkksVlk\n\thNls/SEZ4J1KI1zmmBRHmu9UsJ4vG7UQam6ZcsUmOaBdWjiCSxWxvvUceIC4x+d2b3Ud\n\tUncw==", "X-Gm-Message-State": "AOJu0YyX+rrBzr+8H8Q6txqli8afkP4f2VzElQISLnDOfenD/WRUezLN\n\tiLt4CE7JamFvfeywFJzI0HurYQwPPPHDWvepuio=", "X-Google-Smtp-Source": "AGHT+IGqKh7XHA3cZ5hZB0ubfSyrIPv9NuMpULgP03S5ULHH2X9PDu4C4Gaq6EvVA7nXtdPAJ+vZRQ==", "X-Received": "by 2002:a05:600c:1da6:b0:403:b86:f624 with SMTP id\n\tp38-20020a05600c1da600b004030b86f624mr5532305wms.23.1694528128003; \n\tTue, 12 Sep 2023 07:15:28 -0700 (PDT)", "Date": "Tue, 12 Sep 2023 16:15:21 +0200", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20230912-gralloc-api-v4-v2-2-e859da63f98c@baylibre.com>", "References": "<20230912-gralloc-api-v4-v2-0-e859da63f98c@baylibre.com>", "In-Reply-To": "<20230912-gralloc-api-v4-v2-0-e859da63f98c@baylibre.com>", "To": "libcamera-devel@lists.libcamera.org", "X-Mailer": "b4 0.12.3", "Subject": "[libcamera-devel] [PATCH v2 2/4] android: Import\n\tGraphicBufferAllocator header from vndk v33", "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>", "Cc": "Guillaume La Roque <glaroque@baylibre.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The GraphicBufferAllocator class (from libui) provides a more modern interface\nto Android buffer allocation.\n\nMoreover, the gralloc.h API has been deprecated since Android P (9).\n\nImport the GraphicBufferAllocator.h from the VNDK.\n\nThese have been imported from:\nURL: https://android.googlesource.com/platform/prebuilts/vndk/v33/\nrev: 390028a9da88 (\"Update VNDK snapshot v33 to build 9948968. am: 3042508aee am: 7092391a46\")\n\nNo changes have been made to the files, besides adding the SPDX comment.\n\nNote: because GraphicBufferAllocator has lots of Android-specific dependencies,\na future patch is needed to stub/simplify this include.\n\nSigned-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>\n---\n .../libs/ui/include/ui/GraphicBufferAllocator.h | 111 +++++++++++++++++++++\n 1 file changed, 111 insertions(+)", "diff": "diff --git a/include/android/frameworks/native/libs/ui/include/ui/GraphicBufferAllocator.h b/include/android/frameworks/native/libs/ui/include/ui/GraphicBufferAllocator.h\nnew file mode 100644\nindex 000000000000..e4674d746e37\n--- /dev/null\n+++ b/include/android/frameworks/native/libs/ui/include/ui/GraphicBufferAllocator.h\n@@ -0,0 +1,111 @@\n+/* SPDX-License-Identifier: Apache-2.0 */\n+/*\n+ *\n+ * Copyright 2009, The Android Open Source Project\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+#ifndef ANDROID_BUFFER_ALLOCATOR_H\n+#define ANDROID_BUFFER_ALLOCATOR_H\n+\n+#include <stdint.h>\n+\n+#include <memory>\n+#include <string>\n+\n+#include <cutils/native_handle.h>\n+\n+#include <ui/PixelFormat.h>\n+\n+#include <utils/Errors.h>\n+#include <utils/KeyedVector.h>\n+#include <utils/Mutex.h>\n+#include <utils/Singleton.h>\n+\n+namespace android {\n+\n+class GrallocAllocator;\n+class GraphicBufferMapper;\n+\n+class GraphicBufferAllocator : public Singleton<GraphicBufferAllocator>\n+{\n+public:\n+ static inline GraphicBufferAllocator& get() { return getInstance(); }\n+\n+ /**\n+ * Allocates and imports a gralloc buffer.\n+ *\n+ * The handle must be freed with GraphicBufferAllocator::free() when no longer needed.\n+ */\n+ status_t allocate(uint32_t w, uint32_t h, PixelFormat format, uint32_t layerCount,\n+ uint64_t usage, buffer_handle_t* handle, uint32_t* stride,\n+ std::string requestorName);\n+\n+ /**\n+ * Allocates and does NOT import a gralloc buffer. Buffers cannot be used until they have\n+ * been imported. This function is for advanced use cases only.\n+ *\n+ * The raw native handle must be freed by calling native_handle_close() followed by\n+ * native_handle_delete().\n+ */\n+ status_t allocateRawHandle(uint32_t w, uint32_t h, PixelFormat format, uint32_t layerCount,\n+ uint64_t usage, buffer_handle_t* handle, uint32_t* stride,\n+ std::string requestorName);\n+\n+ /**\n+ * DEPRECATED: GraphicBufferAllocator does not use the graphicBufferId.\n+ */\n+ status_t allocate(uint32_t w, uint32_t h, PixelFormat format,\n+ uint32_t layerCount, uint64_t usage,\n+ buffer_handle_t* handle, uint32_t* stride, uint64_t graphicBufferId,\n+ std::string requestorName);\n+\n+ status_t free(buffer_handle_t handle);\n+\n+ uint64_t getTotalSize() const;\n+\n+ void dump(std::string& res, bool less = true) const;\n+ static void dumpToSystemLog(bool less = true);\n+\n+protected:\n+ struct alloc_rec_t {\n+ uint32_t width;\n+ uint32_t height;\n+ uint32_t stride;\n+ PixelFormat format;\n+ uint32_t layerCount;\n+ uint64_t usage;\n+ size_t size;\n+ std::string requestorName;\n+ };\n+\n+ status_t allocateHelper(uint32_t w, uint32_t h, PixelFormat format, uint32_t layerCount,\n+ uint64_t usage, buffer_handle_t* handle, uint32_t* stride,\n+ std::string requestorName, bool importBuffer);\n+\n+ static Mutex sLock;\n+ static KeyedVector<buffer_handle_t, alloc_rec_t> sAllocList;\n+\n+ friend class Singleton<GraphicBufferAllocator>;\n+ GraphicBufferAllocator();\n+ ~GraphicBufferAllocator();\n+\n+ GraphicBufferMapper& mMapper;\n+ std::unique_ptr<const GrallocAllocator> mAllocator;\n+};\n+\n+// ---------------------------------------------------------------------------\n+}; // namespace android\n+\n+#endif // ANDROID_BUFFER_ALLOCATOR_H\n", "prefixes": [ "libcamera-devel", "v2", "2/4" ] }