Show a patch.

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

{
    "id": 25655,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/25655/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25655/",
    "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": "<20260106170059.56193-3-bryan.odonoghue@linaro.org>",
    "date": "2026-01-06T17:00:37",
    "name": "[v11,02/24] libcamera: software_isp: gbm: Add a GBM helper class for GPU surface access",
    "commit_ref": "c60b1ce8193841c2742b655097bb39ccbcb417c2",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "586ee348ce1a47596b83bcb6f0972a6556fbce8e",
    "submitter": {
        "id": 175,
        "url": "https://patchwork.libcamera.org/api/1.1/people/175/?format=api",
        "name": "Bryan O'Donoghue",
        "email": "bryan.odonoghue@linaro.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/25655/mbox/",
    "series": [
        {
            "id": 5689,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5689/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5689",
            "date": "2026-01-06T17:00:35",
            "name": "Add GLES 2.0 GPUISP to libcamera",
            "version": 10,
            "mbox": "https://patchwork.libcamera.org/series/5689/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/25655/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25655/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 4229EBDCC0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  6 Jan 2026 17:01:10 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EE4C661FE8;\n\tTue,  6 Jan 2026 18:01:09 +0100 (CET)",
            "from mail-wr1-x444.google.com (mail-wr1-x444.google.com\n\t[IPv6:2a00:1450:4864:20::444])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 20B9E61F9F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  6 Jan 2026 18:01:07 +0100 (CET)",
            "by mail-wr1-x444.google.com with SMTP id\n\tffacd0b85a97d-42fb2314eb0so867968f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 06 Jan 2026 09:01:07 -0800 (PST)",
            "from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie.\n\t[188.141.3.146]) by smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-432bd0dadcfsm5515322f8f.3.2026.01.06.09.01.03\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 06 Jan 2026 09:01:04 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"xzGK2tgl\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1767718866; x=1768323666;\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=dIJd7ak0Ig7Al4IlYwKYLFZCqKzLA54/kQmBA9xRHAI=;\n\tb=xzGK2tglHLszAl7ZIq9mP52yJcMbKtfEqNBVMXGMYEGaPEg7U+2HnLRt5aVvPGodAP\n\t3tuhhc75y7FQnCsvCwhj7hoAFy1YsZAObzJfa14u0JPEek309X9MXQcH45fx2jvoN06N\n\tffGd3dl83DPl+j6vGg1AGgVbriPBCTD/KbMisaYiORZN0+9qhmyNff2JaDeCLK6I67Fc\n\t1RFxFPgOhRLOTRsWVsKzw2e4BONI/WPcS5mA2zy6ni2CVss+zD8fU1fDMwYKKAHmWEiF\n\tcUXy3kyQsSIkMy38mUsisXU514FyPpnMLGSuzhfyS4CCfhvkKJoPEmifrvfpo42tU0SS\n\tRIVQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1767718866; x=1768323666;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=dIJd7ak0Ig7Al4IlYwKYLFZCqKzLA54/kQmBA9xRHAI=;\n\tb=uQ6FHI7kRq9upyS2R2P5ZbtJ6sWN/IRzU4ompzOSzw/AcYi0OYIa0Ns18M2SoDGJlZ\n\tV7poQU0i0yK65GVR+CxN55xy9bYkxSdZy1eB6KMfenh3UguRV1nWLTJcyuSVIVx9lOmh\n\t18DOn/2shyi8i/CuBWkHpw5bNm6AUlBn/y+waEseDDX4GZe7WoY3Do0KsiPSMGD6dsfH\n\tgrJ72IzHpbjsmNwqFvaKgnZl2IKdQy8aLNL/Dk1az3G+nCKCh5Vyq7qB5y4VDtVBJGQt\n\tfFz6q6MmEsUmWSgXuMuZu4DWPtlqp9obGP8rEMUyc0g3KHyXfbx9wYQBXOWlGrPKksTW\n\tF4QA==",
        "X-Gm-Message-State": "AOJu0YyOTds5KUqIlKQh5ck3hyPgTwfAGyMgjHMLOha4x5WlRWQuwwm7\n\tGSeVi/gegxx35VVV8NBMnYeaoaajOZVYbjeUAbCWLJ3C6UrCX/d+NFuQRbxpMdFmZ7k5eFPndPs\n\tFdnvfATeHZw==",
        "X-Gm-Gg": "AY/fxX7u5Mx75AgFgf5nPEVrRk+5/T6WolyEaP09UPH1emih1CtVgznSj08Vefck05W\n\tZcDnoWfra+KhU/52kNhKhpC+J8qs7007CWRa1HAEr+qY9fTNVPftes9v2Gp+lkrr9P/+8PKmNVp\n\t5IFi734NkSC6Tni6bDp3t02BTYY+6A510G1wIVNpjM705LmMwtC4BShKBPFSApSILusDoxB+UQw\n\te2gxZnWkTueuWCGMOcnPdBLFKFeD4Wi/IO3/guIX0zGkSggxvamGvwRefSuqhH53BBEtiimSTV+\n\tMr2uPyPiAXV7AiZI225Yi03cEIk7DgxQtM7uRlMAGwbBcetnKExrjMM6cZKlH0jh+AKgUMgTooc\n\tgoA/wAGINmoKPauTkqpttoZY9H7OaziErdGXf81+FZrlPFSf6MK1lLCJg/RchXUL/jcpkBm9l7G\n\tJcvGtw2eIsnPZlpXXlGYUjs+h4zRjqOwoXJ8BL5nFqxtNrp5wK6ZOgLq17ItXukE86+xo=",
        "X-Google-Smtp-Source": "AGHT+IEoSutKybrCsXzaTsn4ULJhLID7aLMymrnwLWy0LjOLzCpA8KF6SlkklKOxarC6nDXI08k0UQ==",
        "X-Received": "by 2002:a05:6000:420f:b0:430:fd9f:e6e2 with SMTP id\n\tffacd0b85a97d-432bca18993mr4224564f8f.9.1767718864770; \n\tTue, 06 Jan 2026 09:01:04 -0800 (PST)",
        "From": "Bryan O'Donoghue <bryan.odonoghue@linaro.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "pavel@ucw.cz, Bryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tMilan Zamazal <mzamazal@redhat.com>,\n\tRobert Mader <robert.mader@collabora.com>,\n\tHans de Goede <johannes.goede@qualcomm.com>",
        "Subject": "[PATCH v11 02/24] libcamera: software_isp: gbm: Add a GBM helper\n\tclass for GPU surface access",
        "Date": "Tue,  6 Jan 2026 17:00:37 +0000",
        "Message-ID": "<20260106170059.56193-3-bryan.odonoghue@linaro.org>",
        "X-Mailer": "git-send-email 2.52.0",
        "In-Reply-To": "<20260106170059.56193-1-bryan.odonoghue@linaro.org>",
        "References": "<20260106170059.56193-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 GPU when making a texture for the Debayer\nvertex/fragment shaders and thus ensure we receive an uncompressed and\nuntiled output buffer.\n\nAcked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\nReviewed-by: Robert Mader <robert.mader@collabora.com>\nTested-by: Hans de Goede <johannes.goede@qualcomm.com> # ThinkPad T14s gen 6 (arm64) ov02c10 + X1c gen 12 ov08x40\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n include/libcamera/internal/gbm.h       |  55 +++++++++++++\n include/libcamera/internal/meson.build |   1 +\n src/libcamera/gbm.cpp                  | 107 +++++++++++++++++++++++++\n src/libcamera/meson.build              |  10 +++\n 4 files changed, 173 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 000000000..c10be06c1\n--- /dev/null\n+++ b/include/libcamera/internal/gbm.h\n@@ -0,0 +1,55 @@\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+ * Helper class for managing GBM interactions\n+ */\n+\n+#pragma once\n+\n+#include <gbm.h>\n+\n+#include <libcamera/base/log.h>\n+#include <libcamera/base/unique_fd.h>\n+\n+#include <libcamera/formats.h>\n+\n+namespace libcamera {\n+\n+LOG_DECLARE_CATEGORY(GBM)\n+\n+class GBM\n+{\n+public:\n+\tGBM();\n+\t~GBM();\n+\n+\tint createDevice();\n+\n+\t/**\n+\t * \\brief Retrieve the GBM device handle\n+\t *\n+\t * \\return Pointer to the gbm_device structure, or nullptr if the device\n+\t * has not been created\n+\t */\n+\tstruct gbm_device *device() const { return gbmDevice_; }\n+\n+\t/**\n+\t * \\brief Retrieve the pixel format\n+\t *\n+\t * \\return The PixelFormat used by this GBM instance (ARGB8888)\n+\t */\n+\tPixelFormat format() const { return format_; }\n+\n+private:\n+\tLIBCAMERA_DISABLE_COPY_AND_MOVE(GBM)\n+\n+\tUniqueFD fd_;\n+\tstruct gbm_device *gbmDevice_ = nullptr;\n+\tPixelFormat format_;\n+};\n+\n+} /* namespace libcamera */\ndiff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build\nindex e9540a2f7..b8324996b 100644\n--- a/include/libcamera/internal/meson.build\n+++ b/include/libcamera/internal/meson.build\n@@ -23,6 +23,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 000000000..d37808b0c\n--- /dev/null\n+++ b/src/libcamera/gbm.cpp\n@@ -0,0 +1,107 @@\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+ * Helper class for managing GBM interactions\n+ */\n+\n+#include \"libcamera/internal/gbm.h\"\n+\n+#include <errno.h>\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+/**\n+ * \\class GBM\n+ * \\brief Helper class for managing GBM interactions\n+ *\n+ * The GBM class provides a simplified interface for creating and managing\n+ * GBM devices. It handles the initialization and teardown of GBM devices\n+ * used for buffer allocation in graphics and camera pipelines.\n+ *\n+ * This class is responsible for opening a DRI render node, creating a GBM\n+ * device, and providing access to the device and its associated pixel format.\n+ */\n+\n+/**\n+ *\\var GBM::fd_\n+ *\\brief file descriptor to DRI device\n+ */\n+\n+/**\n+ *\\var GBM::gbmDevice_\n+ *\\brief Pointer to GBM device structure derived from fd_\n+ */\n+\n+/**\n+ *\\var GBM::format_\n+ *\\brief Pixel format the GBM surface was created in\n+ */\n+\n+/**\n+ *\\brief GBM constructor.\n+ *\n+ * Creates a GBM instance with uninitialised state.\n+ */\n+GBM::GBM()\n+{\n+}\n+\n+/**\n+ *\\brief GBM destructor\n+ *\n+ * Cleans up the GBM device if it was successfully created, and closes\n+ * the associated file descriptor.\n+ */\n+GBM::~GBM()\n+{\n+\tif (gbmDevice_)\n+\t\tgbm_device_destroy(gbmDevice_);\n+}\n+\n+/**\n+ * \\brief Create and initialize a GBM device\n+ *\n+ * \\todo Get dri device name from envOption setting\n+ *\n+ * Opens the DRI render node (/dev/dri/renderD128) and creates a GBM\n+ * device using the libgbm library. Sets the default pixel format to\n+ * ARGB8888.\n+ *\n+ * \\return 0 on success, or a negative error code on failure\n+ */\n+int GBM::createDevice()\n+{\n+\tconst char dri_node[] = \"/dev/dri/renderD128\";\n+\n+\tint fd = open(dri_node, O_RDWR | O_CLOEXEC | O_NOCTTY);\n+\tif (fd < 0) {\n+\t\tLOG(GBM, Error) << \"Open \" << dri_node << \" fail \" << strerror(errno);\n+\t\treturn -errno;\n+\t}\n+\tfd_ = UniqueFD(fd);\n+\n+\tgbmDevice_ = gbm_create_device(fd_.get());\n+\tif (!gbmDevice_) {\n+\t\tLOG(GBM, Error) << \"gbm_create_device fail\" << strerror(errno);\n+\t\treturn -errno;\n+\t}\n+\n+\tformat_ = libcamera::formats::ARGB8888;\n+\n+\treturn 0;\n+}\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex 575408b2c..cb7863852 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -70,6 +70,15 @@ libcamera_deps = []\n libatomic = cc.find_library('atomic', required : false)\n libthreads = dependency('threads')\n \n+libgbm = dependency('gbm', required : false)\n+gbm_works = cc.check_header('gbm.h', required: false)\n+\n+if libgbm.found() and gbm_works\n+    libcamera_internal_sources += files([\n+        'gbm.cpp',\n+    ])\n+endif\n+\n subdir('base')\n subdir('converter')\n subdir('ipa')\n@@ -178,6 +187,7 @@ libcamera_deps += [\n     libcamera_base_private,\n     libcrypto,\n     libdl,\n+    libgbm,\n     liblttng,\n     libudev,\n     libyaml,\n",
    "prefixes": [
        "v11",
        "02/24"
    ]
}