[{"id":37751,"web_url":"https://patchwork.libcamera.org/comment/37751/","msgid":"<20260119203754.GA18962@pendragon.ideasonboard.com>","date":"2026-01-19T20:37:54","subject":"Re: [PATCH v2 2/2] Revert \"libcamera: software_isp: gbm: Add a GBM\n\thelper class for GPU surface access\"","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Jan 19, 2026 at 09:28:35PM +0100, Robert Mader wrote:\n> GBM is not used any more - remove the helper class.\n> \n> This results in egl.cpp getting build on some setups where it previously\n> didn't, notably Debian 11 on CI, triggering a build issues. Include a\n> workaround suggested by:\n> Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> \n> This reverts commit c60b1ce8193841c2742b655097bb39ccbcb417c2.\n> \n> Signed-off-by: Robert Mader <robert.mader@collabora.com>\n> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # sm8250/rb5, x1e/Dell Insprion14p\n> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\nThis is an easy one, once 1/2 is ready,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n> \n> Changes in v2:\n>  - Added tags\n>  - Added build issue workaround - hope it's ok to keep the R-Bs.\n> ---\n>  include/libcamera/internal/egl.h       |   5 ++\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              |  12 +--\n>  5 files changed, 6 insertions(+), 174 deletions(-)\n>  delete mode 100644 include/libcamera/internal/gbm.h\n>  delete mode 100644 src/libcamera/gbm.cpp\n> \n> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\n> index 630345ea7..ce386554f 100644\n> --- a/include/libcamera/internal/egl.h\n> +++ b/include/libcamera/internal/egl.h\n> @@ -16,6 +16,11 @@\n>  #include <libcamera/base/span.h>\n>  #include <libcamera/base/utils.h>\n>  \n> +/* Workaround for build issues on Mesa < 23.3, see\n> + * https://github.com/KhronosGroup/EGL-Registry/pull/130\n> + */\n> +#define EGL_NO_X11\n> +\n>  #define EGL_EGLEXT_PROTOTYPES\n>  #include <EGL/egl.h>\n>  #include <EGL/eglext.h>\n> diff --git a/include/libcamera/internal/gbm.h b/include/libcamera/internal/gbm.h\n> deleted file mode 100644\n> index c10be06c1..000000000\n> --- a/include/libcamera/internal/gbm.h\n> +++ /dev/null\n> @@ -1,55 +0,0 @@\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 */\n> diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build\n> index dc48619e5..4d2a09bd7 100644\n> --- a/include/libcamera/internal/meson.build\n> +++ b/include/libcamera/internal/meson.build\n> @@ -24,7 +24,6 @@ libcamera_internal_headers = files([\n>      'formats.h',\n>      'framebuffer.h',\n>      'egl.h',\n> -    'gbm.h',\n>      'global_configuration.h',\n>      'ipa_data_serializer.h',\n>      'ipa_manager.h',\n> diff --git a/src/libcamera/gbm.cpp b/src/libcamera/gbm.cpp\n> deleted file mode 100644\n> index d37808b0c..000000000\n> --- a/src/libcamera/gbm.cpp\n> +++ /dev/null\n> @@ -1,107 +0,0 @@\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 */\n> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> index 6f952bd98..d15943586 100644\n> --- a/src/libcamera/meson.build\n> +++ b/src/libcamera/meson.build\n> @@ -70,15 +70,6 @@ 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>  mesa_works = cc.check_header('EGL/egl.h', required: false)\n>  libegl = dependency('egl', required : false)\n>  libglesv2 = dependency('glesv2', required : false)\n> @@ -91,7 +82,7 @@ if libglesv2.found()\n>      config_h.set('HAVE_GLESV2', 1)\n>  endif\n>  \n> -if mesa_works and gbm_works\n> +if mesa_works\n>      libcamera_internal_sources += files([\n>          'egl.cpp',\n>      ])\n> @@ -209,7 +200,6 @@ libcamera_deps += [\n>      libcrypto,\n>      libdl,\n>      libegl,\n> -    libgbm,\n>      libglesv2,\n>      liblttng,\n>      libudev,","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 887D2C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 19 Jan 2026 20:38:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D45AF61FBF;\n\tMon, 19 Jan 2026 21:38:18 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8C636606D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Jan 2026 21:38:17 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-152.bb.dnainternet.fi\n\t[81.175.209.152])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 7A7E0C1;\n\tMon, 19 Jan 2026 21:37:46 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"HT7Thukq\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1768855066;\n\tbh=yo6VGw/3adxjada98D19ghRX7QqvEkf5KI59BeYEoTE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=HT7ThukqTylCJcNxTOLVya49kjprmUcG7xeQZzAqkyfaIbrVY+1fcmON7v4Tzjl73\n\tws8tYdSBJMqBATbYhLDplxhv04zEU112Z1D40jLuzYarnRNrD/UA+bJ6/u+UiswrNq\n\tqQM3pzXCpoqY6y8pZa+az38aLfqaQ5rjWmOQQKI8=","Date":"Mon, 19 Jan 2026 22:37:54 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Robert Mader <robert.mader@collabora.com>","Cc":"libcamera-devel@lists.libcamera.org, Bryan O'Donoghue\n\t<bryan.odonoghue@linaro.org>, =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?=\n\t<barnabas.pocze@ideasonboard.com>","Subject":"Re: [PATCH v2 2/2] Revert \"libcamera: software_isp: gbm: Add a GBM\n\thelper class for GPU surface access\"","Message-ID":"<20260119203754.GA18962@pendragon.ideasonboard.com>","References":"<20260119202835.372125-1-robert.mader@collabora.com>\n\t<20260119202835.372125-2-robert.mader@collabora.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20260119202835.372125-2-robert.mader@collabora.com>","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>"}}]