Patch Detail
Show a patch.
GET /api/patches/24669/?format=api
{ "id": 24669, "url": "https://patchwork.libcamera.org/api/patches/24669/?format=api", "web_url": "https://patchwork.libcamera.org/patch/24669/", "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": "<20251015012251.17508-25-bryan.odonoghue@linaro.org>", "date": "2025-10-15T01:22:36", "name": "[v3,24/39] libcamera: software_isp: gbm: Add in a GBM helper class for GPU surface access", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "b6bc6e7dd82aa4f95587a7690f363af5cb95681c", "submitter": { "id": 175, "url": "https://patchwork.libcamera.org/api/people/175/?format=api", "name": "Bryan O'Donoghue", "email": "bryan.odonoghue@linaro.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/24669/mbox/", "series": [ { "id": 5503, "url": "https://patchwork.libcamera.org/api/series/5503/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5503", "date": "2025-10-15T01:22:12", "name": "Add GLES 2.0 GPUISP to libcamera", "version": 3, "mbox": "https://patchwork.libcamera.org/series/5503/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/24669/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/24669/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 EB84AC3332\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Oct 2025 01:23:33 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7D30D60658;\n\tWed, 15 Oct 2025 03:23:33 +0200 (CEST)", "from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com\n\t[IPv6:2a00:1450:4864:20::62f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 97E0C60642\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Oct 2025 03:23:19 +0200 (CEST)", "by mail-ej1-x62f.google.com with SMTP id\n\ta640c23a62f3a-b40f11a1027so1073927766b.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Oct 2025 18:23:19 -0700 (PDT)", "from inspiron14p-linux.nxsw.local (188-141-3-146.dynamic.upc.ie.\n\t[188.141.3.146]) by smtp.gmail.com with ESMTPSA id\n\ta640c23a62f3a-b5ccd7b202dsm98348466b.82.2025.10.14.18.23.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 14 Oct 2025 18:23:18 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"YOR57/OP\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1760491399; x=1761096199;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=466aSq4HGB3YriCFxyHHrht3jJTico5gS2hMItA4Sxs=;\n\tb=YOR57/OP6fsh6ODo+R4tAtLonc7RqsBSH4Ohv7EteHo4IfEZcyhZki61AnlKKH3cmE\n\tgh/pTfRa8VBGkZ31yQ/hqojIMTsB33vEBLiL02OQueY/NQF9afM2jEK/tovFxX0foXlk\n\tZ93liycGu/I8RRGGcwETT19Wk3c1tC1HY+MW7uOxSDD3/TOwLdb4srYpwD1pUvAFSZnj\n\tet490l7uqM7ICv3Q7CdXE8GtjwlAu+4z4UJsRAP+A76+1MaiCgjMavUI/ACNWEAeJR/X\n\tG1F5BGLTNvWVnMTOaE+OCuG2ZOAQvkwE1asXnR65d9eHvLAYUoICVw4y2LB6CfinV6k4\n\tRofA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1760491399; x=1761096199;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=466aSq4HGB3YriCFxyHHrht3jJTico5gS2hMItA4Sxs=;\n\tb=VqqZPYTpqe7naUR6X9BgjVIYBuonKdavuciOqqKgcSeXyOG7YSiqF52pyFGY09CfAz\n\t4iBan3QzlvZj1VoYuZy3wY19nQSIqjDROoZTto5OPZ/v60iZzLm9wsWcCnV42jqDvMJV\n\tJnYSOvfFKGAAa/pdki3nkEpP6VtfJEqBQbggxnK8IZEsNkbp7kRrgS7gQYRAFn01N/uS\n\tztn3BENnhmi5i9Ytm/LOivi8QE3w2pzIaHYGc+icbF4KgN2431am0+EB6svvIu4ChR1K\n\tVokCzLraO822UW/S/MWOFkPRZK673knQKqQ5P889oZe9xNmVhi2LqoCXdEKWghQ1Gyds\n\t8dSg==", "X-Gm-Message-State": "AOJu0YxeQ1jXPNAqgx+5HNvGsgWk2o/G1pTX6rk9stRAqLdLEMb2iHV5\n\tJghvqhajvGBT6f25rsJfsEg8FpUSbgw1b8GxxK+1CDxY5xosMQ1IxmUvOi4GoHaKxSTOczv49rS\n\t2g2qW", "X-Gm-Gg": "ASbGncsW8LODTOTnlr+Hcq1JDXNUMN4znjC+lwXls65g5UfFmhm2siamB3EpENCl2Mi\n\tdAar4pzH97kmi/bMDbzwgGFZH91h9PBzJqxlWu9vhKh3tN7hTe3E3hRBDHLVKHWveOHKmgLI6Fg\n\tOHDc61nBv7PeXIwUB01c+UJDOkjacOXd/bVQ7KBTEFflSUWoqofSoCfvA+ykjhAvb5zwVXmbUak\n\tHP/jp8572ZyYeyXlxg/2mifruZzhKyw50700IrX6aoajF2zaxtiXvra1S/8W2uMa4Ed0tyTRQek\n\tWtmOqNhPOF78VfS4wxUMb8aNFHduyI817RZatjRW5m66Dg3PFjYw2NRdOHiC5v1bSxizbakCcS+\n\t3cD+m0ZahzLUa37dHaz9rVzIe4Qkv0CiB+1iw7fGyYqtkTu/xMLmxdZH1yqkrsjLnm9vOXMm165\n\ttRohNhlZGe7ho2QRhbLGzjVCbbL9+5bpzQ+P/m1M5B", "X-Google-Smtp-Source": "AGHT+IEbLFo+23cBv+hIoNUpyjs+8eeeCLt8ATt4ow+5eACfYZZEALSAOinpb0sN9oPf5cpHWXlC7w==", "X-Received": "by 2002:a17:907:6e88:b0:b3d:35f6:e3cf with SMTP id\n\ta640c23a62f3a-b50aca0070cmr2883767666b.60.1760491398673; \n\tTue, 14 Oct 2025 18:23:18 -0700 (PDT)", "From": "Bryan O'Donoghue <bryan.odonoghue@linaro.org>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "hdegoede@redhat.com, mzamazal@redhat.com, bryan.odonoghue@linaro.org,\n\tbod.linux@nxsw.ie", "Subject": "[PATCH v3 24/39] libcamera: software_isp: gbm: Add in a GBM helper\n\tclass for GPU surface access", "Date": "Wed, 15 Oct 2025 02:22:36 +0100", "Message-ID": "<20251015012251.17508-25-bryan.odonoghue@linaro.org>", "X-Mailer": "git-send-email 2.51.0", "In-Reply-To": "<20251015012251.17508-1-bryan.odonoghue@linaro.org>", "References": "<20251015012251.17508-1-bryan.odonoghue@linaro.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "A helper class to interact with GBM. This will allow us to specify the\ninternal storage format of the CPU when making a texture for the Debayer\nvertext/fragment shaders and thus ensure we receive an uncompressed and\nuntiled output buffer.\n\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n include/libcamera/internal/gbm.h | 43 ++++++++++++++++++\n include/libcamera/internal/meson.build | 1 +\n src/libcamera/gbm.cpp | 61 ++++++++++++++++++++++++++\n src/libcamera/meson.build | 11 +++++\n 4 files changed, 116 insertions(+)\n create mode 100644 include/libcamera/internal/gbm.h\n create mode 100644 src/libcamera/gbm.cpp", "diff": "diff --git a/include/libcamera/internal/gbm.h b/include/libcamera/internal/gbm.h\nnew file mode 100644\nindex 00000000..41b5e00f\n--- /dev/null\n+++ b/include/libcamera/internal/gbm.h\n@@ -0,0 +1,43 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2024, Linaro Ltd.\n+ *\n+ * Authors:\n+ * Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n+ *\n+ * gbm.h - Helper class for managing GBM interactions.\n+ */\n+\n+#pragma once\n+\n+#include <gbm.h>\n+\n+#include <libcamera/base/log.h>\n+\n+#include <libcamera/formats.h>\n+\n+namespace libcamera {\n+\n+LOG_DECLARE_CATEGORY(GBM)\n+\n+/**\n+ * \\brief Helper class for managing GBM interactions\n+ *\n+ */\n+class GBM\n+{\n+public:\n+\tGBM();\n+\t~GBM();\n+\n+\tint createDevice();\n+\tstruct gbm_device *getDevice() { return gbm_device_; }\n+\tPixelFormat getPixelFormat() { return format_; }\n+\n+private:\n+\tint fd_;\n+\tstruct gbm_device *gbm_device_;\n+\tPixelFormat format_;\n+};\n+\n+} // namespace libcamera\ndiff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build\nindex ecb7c9fa..01a36595 100644\n--- a/include/libcamera/internal/meson.build\n+++ b/include/libcamera/internal/meson.build\n@@ -24,6 +24,7 @@ libcamera_internal_headers = files([\n 'dma_buf_allocator.h',\n 'formats.h',\n 'framebuffer.h',\n+ 'gbm.h',\n 'global_configuration.h',\n 'ipa_data_serializer.h',\n 'ipa_manager.h',\ndiff --git a/src/libcamera/gbm.cpp b/src/libcamera/gbm.cpp\nnew file mode 100644\nindex 00000000..caf9ca1c\n--- /dev/null\n+++ b/src/libcamera/gbm.cpp\n@@ -0,0 +1,61 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2024, Linaro Ltd.\n+ *\n+ * Authors:\n+ * Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n+ *\n+ * egl.cpp - Helper class for managing GBM interactions.\n+ */\n+\n+#include \"libcamera/internal/gbm.h\"\n+\n+#include <fcntl.h>\n+#include <sys/ioctl.h>\n+#include <sys/mman.h>\n+#include <unistd.h>\n+\n+#include <linux/dma-buf.h>\n+#include <linux/dma-heap.h>\n+\n+namespace libcamera {\n+\n+LOG_DEFINE_CATEGORY(GBM)\n+\n+GBM::GBM()\n+{\n+\tfd_ = 0;\n+}\n+\n+GBM::~GBM()\n+{\n+\tif (gbm_device_)\n+\t\tgbm_device_destroy(gbm_device_);\n+\n+\tif (fd_ >= 0)\n+\t\tclose(fd_);\n+}\n+\n+int GBM::createDevice()\n+{\n+\tconst char *dri_node = \"/dev/dri/renderD128\"; //TODO: get from an env or config setting\n+\n+\tfd_ = open(dri_node, O_RDWR | O_CLOEXEC);\n+\tif (fd_ < 0) {\n+\t\tLOG(GBM, Error) << \"Open \" << dri_node << \" fail \" << fd_;\n+\t\treturn fd_;\n+\t}\n+\n+\tgbm_device_ = gbm_create_device(fd_);\n+\tif (!gbm_device_) {\n+\t\tLOG(GBM, Error) << \"gbm_crate_device fail\";\n+\t\tgoto fail;\n+\t}\n+\n+\tformat_ = libcamera::formats::ARGB8888;\n+\n+\treturn 0;\n+fail:\n+\treturn -ENODEV;\n+}\n+} //namespace libcamera\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex 5b9b86f2..fe60c875 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -69,6 +69,16 @@ libcamera_deps = []\n libatomic = cc.find_library('atomic', required : false)\n libthreads = dependency('threads')\n \n+libgbm = cc.find_library('gbm', required: false)\n+gbm_works = cc.check_header('gbm.h', required: false)\n+\n+if libgbm.found() and gbm_works\n+ config_h.set('HAVE_GBM', 1)\n+ libcamera_internal_sources += files([\n+ 'gbm.cpp',\n+ ])\n+endif\n+\n subdir('base')\n subdir('converter')\n subdir('ipa')\n@@ -176,6 +186,7 @@ libcamera_deps += [\n libcamera_base_private,\n libcrypto,\n libdl,\n+ libgbm,\n liblttng,\n libudev,\n libyaml,\n", "prefixes": [ "v3", "24/39" ] }