| Message ID | 20260120122344.28283-2-robert.mader@collabora.com |
|---|---|
| State | Accepted |
| Headers | show |
| Series |
|
| Related | show |
On Tue, Jan 20, 2026 at 01:23:44PM +0100, Robert Mader wrote: > GBM is not used any more - remove the helper class. > > This results in egl.cpp getting build on some setups where it previously > didn't, notably Debian 11 on CI, triggering a build issues. Include a > workaround suggested by: > Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > > This reverts commit c60b1ce8193841c2742b655097bb39ccbcb417c2. > > Signed-off-by: Robert Mader <robert.mader@collabora.com> > Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # sm8250/rb5, x1e/Dell Insprion14p > Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > --- > > Changes in v3: > - Added Laurents R-B > > Changes in v2: > - Added tags > - Added build issue workaround - hope it's ok to keep the R-Bs. > --- > include/libcamera/internal/egl.h | 5 ++ > include/libcamera/internal/gbm.h | 55 ------------- > include/libcamera/internal/meson.build | 1 - > src/libcamera/gbm.cpp | 107 ------------------------- > src/libcamera/meson.build | 12 +-- > 5 files changed, 6 insertions(+), 174 deletions(-) > delete mode 100644 include/libcamera/internal/gbm.h > delete mode 100644 src/libcamera/gbm.cpp > > diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h > index 630345ea7..ce386554f 100644 > --- a/include/libcamera/internal/egl.h > +++ b/include/libcamera/internal/egl.h > @@ -16,6 +16,11 @@ > #include <libcamera/base/span.h> > #include <libcamera/base/utils.h> > > +/* Workaround for build issues on Mesa < 23.3, see > + * https://github.com/KhronosGroup/EGL-Registry/pull/130 > + */ /* * Workaround for build issues on Mesa < 23.3, see * https://github.com/KhronosGroup/EGL-Registry/pull/130 */ No need for a v4, this can be fixed when applying. Buuut... now that I notice this, this would belong to a separate patch, it's not part of the revert. > +#define EGL_NO_X11 > + > #define EGL_EGLEXT_PROTOTYPES > #include <EGL/egl.h> > #include <EGL/eglext.h> > diff --git a/include/libcamera/internal/gbm.h b/include/libcamera/internal/gbm.h > deleted file mode 100644 > index c10be06c1..000000000 > --- a/include/libcamera/internal/gbm.h > +++ /dev/null > @@ -1,55 +0,0 @@ > -/* SPDX-License-Identifier: LGPL-2.1-or-later */ > -/* > - * Copyright (C) 2024, Linaro Ltd. > - * > - * Authors: > - * Bryan O'Donoghue <bryan.odonoghue@linaro.org> > - * > - * Helper class for managing GBM interactions > - */ > - > -#pragma once > - > -#include <gbm.h> > - > -#include <libcamera/base/log.h> > -#include <libcamera/base/unique_fd.h> > - > -#include <libcamera/formats.h> > - > -namespace libcamera { > - > -LOG_DECLARE_CATEGORY(GBM) > - > -class GBM > -{ > -public: > - GBM(); > - ~GBM(); > - > - int createDevice(); > - > - /** > - * \brief Retrieve the GBM device handle > - * > - * \return Pointer to the gbm_device structure, or nullptr if the device > - * has not been created > - */ > - struct gbm_device *device() const { return gbmDevice_; } > - > - /** > - * \brief Retrieve the pixel format > - * > - * \return The PixelFormat used by this GBM instance (ARGB8888) > - */ > - PixelFormat format() const { return format_; } > - > -private: > - LIBCAMERA_DISABLE_COPY_AND_MOVE(GBM) > - > - UniqueFD fd_; > - struct gbm_device *gbmDevice_ = nullptr; > - PixelFormat format_; > -}; > - > -} /* namespace libcamera */ > diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build > index dc48619e5..4d2a09bd7 100644 > --- a/include/libcamera/internal/meson.build > +++ b/include/libcamera/internal/meson.build > @@ -24,7 +24,6 @@ libcamera_internal_headers = files([ > 'formats.h', > 'framebuffer.h', > 'egl.h', > - 'gbm.h', > 'global_configuration.h', > 'ipa_data_serializer.h', > 'ipa_manager.h', > diff --git a/src/libcamera/gbm.cpp b/src/libcamera/gbm.cpp > deleted file mode 100644 > index d37808b0c..000000000 > --- a/src/libcamera/gbm.cpp > +++ /dev/null > @@ -1,107 +0,0 @@ > -/* SPDX-License-Identifier: LGPL-2.1-or-later */ > -/* > - * Copyright (C) 2024, Linaro Ltd. > - * > - * Authors: > - * Bryan O'Donoghue <bryan.odonoghue@linaro.org> > - * > - * Helper class for managing GBM interactions > - */ > - > -#include "libcamera/internal/gbm.h" > - > -#include <errno.h> > -#include <fcntl.h> > -#include <sys/ioctl.h> > -#include <sys/mman.h> > -#include <unistd.h> > - > -#include <linux/dma-buf.h> > -#include <linux/dma-heap.h> > - > -namespace libcamera { > - > -LOG_DEFINE_CATEGORY(GBM) > - > -/** > - * \class GBM > - * \brief Helper class for managing GBM interactions > - * > - * The GBM class provides a simplified interface for creating and managing > - * GBM devices. It handles the initialization and teardown of GBM devices > - * used for buffer allocation in graphics and camera pipelines. > - * > - * This class is responsible for opening a DRI render node, creating a GBM > - * device, and providing access to the device and its associated pixel format. > - */ > - > -/** > - *\var GBM::fd_ > - *\brief file descriptor to DRI device > - */ > - > -/** > - *\var GBM::gbmDevice_ > - *\brief Pointer to GBM device structure derived from fd_ > - */ > - > -/** > - *\var GBM::format_ > - *\brief Pixel format the GBM surface was created in > - */ > - > -/** > - *\brief GBM constructor. > - * > - * Creates a GBM instance with uninitialised state. > - */ > -GBM::GBM() > -{ > -} > - > -/** > - *\brief GBM destructor > - * > - * Cleans up the GBM device if it was successfully created, and closes > - * the associated file descriptor. > - */ > -GBM::~GBM() > -{ > - if (gbmDevice_) > - gbm_device_destroy(gbmDevice_); > -} > - > -/** > - * \brief Create and initialize a GBM device > - * > - * \todo Get dri device name from envOption setting > - * > - * Opens the DRI render node (/dev/dri/renderD128) and creates a GBM > - * device using the libgbm library. Sets the default pixel format to > - * ARGB8888. > - * > - * \return 0 on success, or a negative error code on failure > - */ > -int GBM::createDevice() > -{ > - const char dri_node[] = "/dev/dri/renderD128"; > - > - int fd = open(dri_node, O_RDWR | O_CLOEXEC | O_NOCTTY); > - if (fd < 0) { > - LOG(GBM, Error) << "Open " << dri_node << " fail " << strerror(errno); > - return -errno; > - } > - fd_ = UniqueFD(fd); > - > - gbmDevice_ = gbm_create_device(fd_.get()); > - if (!gbmDevice_) { > - LOG(GBM, Error) << "gbm_create_device fail" << strerror(errno); > - return -errno; > - } > - > - format_ = libcamera::formats::ARGB8888; > - > - return 0; > -} > - > -} /* namespace libcamera */ > diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build > index 6f952bd98..d15943586 100644 > --- a/src/libcamera/meson.build > +++ b/src/libcamera/meson.build > @@ -70,15 +70,6 @@ libcamera_deps = [] > libatomic = cc.find_library('atomic', required : false) > libthreads = dependency('threads') > > -libgbm = dependency('gbm', required : false) > -gbm_works = cc.check_header('gbm.h', required: false) > - > -if libgbm.found() and gbm_works > - libcamera_internal_sources += files([ > - 'gbm.cpp', > - ]) > -endif > - > mesa_works = cc.check_header('EGL/egl.h', required: false) > libegl = dependency('egl', required : false) > libglesv2 = dependency('glesv2', required : false) > @@ -91,7 +82,7 @@ if libglesv2.found() > config_h.set('HAVE_GLESV2', 1) > endif > > -if mesa_works and gbm_works > +if mesa_works > libcamera_internal_sources += files([ > 'egl.cpp', > ]) > @@ -209,7 +200,6 @@ libcamera_deps += [ > libcrypto, > libdl, > libegl, > - libgbm, > libglesv2, > liblttng, > libudev,
On 20.01.26 16:17, Laurent Pinchart wrote: > On Tue, Jan 20, 2026 at 01:23:44PM +0100, Robert Mader wrote: >> GBM is not used any more - remove the helper class. >> >> This results in egl.cpp getting build on some setups where it previously >> didn't, notably Debian 11 on CI, triggering a build issues. Include a >> workaround suggested by: >> Barnabás Pőcze <barnabas.pocze@ideasonboard.com> >> >> This reverts commit c60b1ce8193841c2742b655097bb39ccbcb417c2. >> >> Signed-off-by: Robert Mader <robert.mader@collabora.com> >> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> >> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # sm8250/rb5, x1e/Dell Insprion14p >> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> >> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> >> >> --- >> >> Changes in v3: >> - Added Laurents R-B >> >> Changes in v2: >> - Added tags >> - Added build issue workaround - hope it's ok to keep the R-Bs. >> --- >> include/libcamera/internal/egl.h | 5 ++ >> include/libcamera/internal/gbm.h | 55 ------------- >> include/libcamera/internal/meson.build | 1 - >> src/libcamera/gbm.cpp | 107 ------------------------- >> src/libcamera/meson.build | 12 +-- >> 5 files changed, 6 insertions(+), 174 deletions(-) >> delete mode 100644 include/libcamera/internal/gbm.h >> delete mode 100644 src/libcamera/gbm.cpp >> >> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h >> index 630345ea7..ce386554f 100644 >> --- a/include/libcamera/internal/egl.h >> +++ b/include/libcamera/internal/egl.h >> @@ -16,6 +16,11 @@ >> #include <libcamera/base/span.h> >> #include <libcamera/base/utils.h> >> >> +/* Workaround for build issues on Mesa < 23.3, see >> + * https://github.com/KhronosGroup/EGL-Registry/pull/130 >> + */ > /* > * Workaround for build issues on Mesa < 23.3, see > * https://github.com/KhronosGroup/EGL-Registry/pull/130 > */ > > No need for a v4, this can be fixed when applying. > > Buuut... now that I notice this, this would belong to a separate patch, > it's not part of the revert. I generally agree and first did that - however I then pulled it in as otherwise the commit would break bi-secting on certain setups. Can do whatever you prefer. > >> +#define EGL_NO_X11 >> + >> #define EGL_EGLEXT_PROTOTYPES >> #include <EGL/egl.h> >> #include <EGL/eglext.h> >> diff --git a/include/libcamera/internal/gbm.h b/include/libcamera/internal/gbm.h >> deleted file mode 100644 >> index c10be06c1..000000000 >> --- a/include/libcamera/internal/gbm.h >> +++ /dev/null >> @@ -1,55 +0,0 @@ >> -/* SPDX-License-Identifier: LGPL-2.1-or-later */ >> -/* >> - * Copyright (C) 2024, Linaro Ltd. >> - * >> - * Authors: >> - * Bryan O'Donoghue <bryan.odonoghue@linaro.org> >> - * >> - * Helper class for managing GBM interactions >> - */ >> - >> -#pragma once >> - >> -#include <gbm.h> >> - >> -#include <libcamera/base/log.h> >> -#include <libcamera/base/unique_fd.h> >> - >> -#include <libcamera/formats.h> >> - >> -namespace libcamera { >> - >> -LOG_DECLARE_CATEGORY(GBM) >> - >> -class GBM >> -{ >> -public: >> - GBM(); >> - ~GBM(); >> - >> - int createDevice(); >> - >> - /** >> - * \brief Retrieve the GBM device handle >> - * >> - * \return Pointer to the gbm_device structure, or nullptr if the device >> - * has not been created >> - */ >> - struct gbm_device *device() const { return gbmDevice_; } >> - >> - /** >> - * \brief Retrieve the pixel format >> - * >> - * \return The PixelFormat used by this GBM instance (ARGB8888) >> - */ >> - PixelFormat format() const { return format_; } >> - >> -private: >> - LIBCAMERA_DISABLE_COPY_AND_MOVE(GBM) >> - >> - UniqueFD fd_; >> - struct gbm_device *gbmDevice_ = nullptr; >> - PixelFormat format_; >> -}; >> - >> -} /* namespace libcamera */ >> diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build >> index dc48619e5..4d2a09bd7 100644 >> --- a/include/libcamera/internal/meson.build >> +++ b/include/libcamera/internal/meson.build >> @@ -24,7 +24,6 @@ libcamera_internal_headers = files([ >> 'formats.h', >> 'framebuffer.h', >> 'egl.h', >> - 'gbm.h', >> 'global_configuration.h', >> 'ipa_data_serializer.h', >> 'ipa_manager.h', >> diff --git a/src/libcamera/gbm.cpp b/src/libcamera/gbm.cpp >> deleted file mode 100644 >> index d37808b0c..000000000 >> --- a/src/libcamera/gbm.cpp >> +++ /dev/null >> @@ -1,107 +0,0 @@ >> -/* SPDX-License-Identifier: LGPL-2.1-or-later */ >> -/* >> - * Copyright (C) 2024, Linaro Ltd. >> - * >> - * Authors: >> - * Bryan O'Donoghue <bryan.odonoghue@linaro.org> >> - * >> - * Helper class for managing GBM interactions >> - */ >> - >> -#include "libcamera/internal/gbm.h" >> - >> -#include <errno.h> >> -#include <fcntl.h> >> -#include <sys/ioctl.h> >> -#include <sys/mman.h> >> -#include <unistd.h> >> - >> -#include <linux/dma-buf.h> >> -#include <linux/dma-heap.h> >> - >> -namespace libcamera { >> - >> -LOG_DEFINE_CATEGORY(GBM) >> - >> -/** >> - * \class GBM >> - * \brief Helper class for managing GBM interactions >> - * >> - * The GBM class provides a simplified interface for creating and managing >> - * GBM devices. It handles the initialization and teardown of GBM devices >> - * used for buffer allocation in graphics and camera pipelines. >> - * >> - * This class is responsible for opening a DRI render node, creating a GBM >> - * device, and providing access to the device and its associated pixel format. >> - */ >> - >> -/** >> - *\var GBM::fd_ >> - *\brief file descriptor to DRI device >> - */ >> - >> -/** >> - *\var GBM::gbmDevice_ >> - *\brief Pointer to GBM device structure derived from fd_ >> - */ >> - >> -/** >> - *\var GBM::format_ >> - *\brief Pixel format the GBM surface was created in >> - */ >> - >> -/** >> - *\brief GBM constructor. >> - * >> - * Creates a GBM instance with uninitialised state. >> - */ >> -GBM::GBM() >> -{ >> -} >> - >> -/** >> - *\brief GBM destructor >> - * >> - * Cleans up the GBM device if it was successfully created, and closes >> - * the associated file descriptor. >> - */ >> -GBM::~GBM() >> -{ >> - if (gbmDevice_) >> - gbm_device_destroy(gbmDevice_); >> -} >> - >> -/** >> - * \brief Create and initialize a GBM device >> - * >> - * \todo Get dri device name from envOption setting >> - * >> - * Opens the DRI render node (/dev/dri/renderD128) and creates a GBM >> - * device using the libgbm library. Sets the default pixel format to >> - * ARGB8888. >> - * >> - * \return 0 on success, or a negative error code on failure >> - */ >> -int GBM::createDevice() >> -{ >> - const char dri_node[] = "/dev/dri/renderD128"; >> - >> - int fd = open(dri_node, O_RDWR | O_CLOEXEC | O_NOCTTY); >> - if (fd < 0) { >> - LOG(GBM, Error) << "Open " << dri_node << " fail " << strerror(errno); >> - return -errno; >> - } >> - fd_ = UniqueFD(fd); >> - >> - gbmDevice_ = gbm_create_device(fd_.get()); >> - if (!gbmDevice_) { >> - LOG(GBM, Error) << "gbm_create_device fail" << strerror(errno); >> - return -errno; >> - } >> - >> - format_ = libcamera::formats::ARGB8888; >> - >> - return 0; >> -} >> - >> -} /* namespace libcamera */ >> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build >> index 6f952bd98..d15943586 100644 >> --- a/src/libcamera/meson.build >> +++ b/src/libcamera/meson.build >> @@ -70,15 +70,6 @@ libcamera_deps = [] >> libatomic = cc.find_library('atomic', required : false) >> libthreads = dependency('threads') >> >> -libgbm = dependency('gbm', required : false) >> -gbm_works = cc.check_header('gbm.h', required: false) >> - >> -if libgbm.found() and gbm_works >> - libcamera_internal_sources += files([ >> - 'gbm.cpp', >> - ]) >> -endif >> - >> mesa_works = cc.check_header('EGL/egl.h', required: false) >> libegl = dependency('egl', required : false) >> libglesv2 = dependency('glesv2', required : false) >> @@ -91,7 +82,7 @@ if libglesv2.found() >> config_h.set('HAVE_GLESV2', 1) >> endif >> >> -if mesa_works and gbm_works >> +if mesa_works >> libcamera_internal_sources += files([ >> 'egl.cpp', >> ]) >> @@ -209,7 +200,6 @@ libcamera_deps += [ >> libcrypto, >> libdl, >> libegl, >> - libgbm, >> libglesv2, >> liblttng, >> libudev,
On Tue, Jan 20, 2026 at 04:19:39PM +0100, Robert Mader wrote: > On 20.01.26 16:17, Laurent Pinchart wrote: > > On Tue, Jan 20, 2026 at 01:23:44PM +0100, Robert Mader wrote: > >> GBM is not used any more - remove the helper class. > >> > >> This results in egl.cpp getting build on some setups where it previously > >> didn't, notably Debian 11 on CI, triggering a build issues. Include a > >> workaround suggested by: > >> Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > >> > >> This reverts commit c60b1ce8193841c2742b655097bb39ccbcb417c2. > >> > >> Signed-off-by: Robert Mader <robert.mader@collabora.com> > >> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > >> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # sm8250/rb5, x1e/Dell Insprion14p > >> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > >> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > >> > >> --- > >> > >> Changes in v3: > >> - Added Laurents R-B > >> > >> Changes in v2: > >> - Added tags > >> - Added build issue workaround - hope it's ok to keep the R-Bs. > >> --- > >> include/libcamera/internal/egl.h | 5 ++ > >> include/libcamera/internal/gbm.h | 55 ------------- > >> include/libcamera/internal/meson.build | 1 - > >> src/libcamera/gbm.cpp | 107 ------------------------- > >> src/libcamera/meson.build | 12 +-- > >> 5 files changed, 6 insertions(+), 174 deletions(-) > >> delete mode 100644 include/libcamera/internal/gbm.h > >> delete mode 100644 src/libcamera/gbm.cpp > >> > >> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h > >> index 630345ea7..ce386554f 100644 > >> --- a/include/libcamera/internal/egl.h > >> +++ b/include/libcamera/internal/egl.h > >> @@ -16,6 +16,11 @@ > >> #include <libcamera/base/span.h> > >> #include <libcamera/base/utils.h> > >> > >> +/* Workaround for build issues on Mesa < 23.3, see > >> + * https://github.com/KhronosGroup/EGL-Registry/pull/130 > >> + */ > > /* > > * Workaround for build issues on Mesa < 23.3, see > > * https://github.com/KhronosGroup/EGL-Registry/pull/130 > > */ > > > > No need for a v4, this can be fixed when applying. > > > > Buuut... now that I notice this, this would belong to a separate patch, > > it's not part of the revert. > > I generally agree and first did that - however I then pulled it in as > otherwise the commit would break bi-secting on certain setups. Can do > whatever you prefer. Would it break bisection if we define EGL_NO_X11 first and then revert the addition of gbm.{h,cpp} ? > >> +#define EGL_NO_X11 > >> + > >> #define EGL_EGLEXT_PROTOTYPES > >> #include <EGL/egl.h> > >> #include <EGL/eglext.h> > >> diff --git a/include/libcamera/internal/gbm.h b/include/libcamera/internal/gbm.h > >> deleted file mode 100644 > >> index c10be06c1..000000000 > >> --- a/include/libcamera/internal/gbm.h > >> +++ /dev/null > >> @@ -1,55 +0,0 @@ > >> -/* SPDX-License-Identifier: LGPL-2.1-or-later */ > >> -/* > >> - * Copyright (C) 2024, Linaro Ltd. > >> - * > >> - * Authors: > >> - * Bryan O'Donoghue <bryan.odonoghue@linaro.org> > >> - * > >> - * Helper class for managing GBM interactions > >> - */ > >> - > >> -#pragma once > >> - > >> -#include <gbm.h> > >> - > >> -#include <libcamera/base/log.h> > >> -#include <libcamera/base/unique_fd.h> > >> - > >> -#include <libcamera/formats.h> > >> - > >> -namespace libcamera { > >> - > >> -LOG_DECLARE_CATEGORY(GBM) > >> - > >> -class GBM > >> -{ > >> -public: > >> - GBM(); > >> - ~GBM(); > >> - > >> - int createDevice(); > >> - > >> - /** > >> - * \brief Retrieve the GBM device handle > >> - * > >> - * \return Pointer to the gbm_device structure, or nullptr if the device > >> - * has not been created > >> - */ > >> - struct gbm_device *device() const { return gbmDevice_; } > >> - > >> - /** > >> - * \brief Retrieve the pixel format > >> - * > >> - * \return The PixelFormat used by this GBM instance (ARGB8888) > >> - */ > >> - PixelFormat format() const { return format_; } > >> - > >> -private: > >> - LIBCAMERA_DISABLE_COPY_AND_MOVE(GBM) > >> - > >> - UniqueFD fd_; > >> - struct gbm_device *gbmDevice_ = nullptr; > >> - PixelFormat format_; > >> -}; > >> - > >> -} /* namespace libcamera */ > >> diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build > >> index dc48619e5..4d2a09bd7 100644 > >> --- a/include/libcamera/internal/meson.build > >> +++ b/include/libcamera/internal/meson.build > >> @@ -24,7 +24,6 @@ libcamera_internal_headers = files([ > >> 'formats.h', > >> 'framebuffer.h', > >> 'egl.h', > >> - 'gbm.h', > >> 'global_configuration.h', > >> 'ipa_data_serializer.h', > >> 'ipa_manager.h', > >> diff --git a/src/libcamera/gbm.cpp b/src/libcamera/gbm.cpp > >> deleted file mode 100644 > >> index d37808b0c..000000000 > >> --- a/src/libcamera/gbm.cpp > >> +++ /dev/null > >> @@ -1,107 +0,0 @@ > >> -/* SPDX-License-Identifier: LGPL-2.1-or-later */ > >> -/* > >> - * Copyright (C) 2024, Linaro Ltd. > >> - * > >> - * Authors: > >> - * Bryan O'Donoghue <bryan.odonoghue@linaro.org> > >> - * > >> - * Helper class for managing GBM interactions > >> - */ > >> - > >> -#include "libcamera/internal/gbm.h" > >> - > >> -#include <errno.h> > >> -#include <fcntl.h> > >> -#include <sys/ioctl.h> > >> -#include <sys/mman.h> > >> -#include <unistd.h> > >> - > >> -#include <linux/dma-buf.h> > >> -#include <linux/dma-heap.h> > >> - > >> -namespace libcamera { > >> - > >> -LOG_DEFINE_CATEGORY(GBM) > >> - > >> -/** > >> - * \class GBM > >> - * \brief Helper class for managing GBM interactions > >> - * > >> - * The GBM class provides a simplified interface for creating and managing > >> - * GBM devices. It handles the initialization and teardown of GBM devices > >> - * used for buffer allocation in graphics and camera pipelines. > >> - * > >> - * This class is responsible for opening a DRI render node, creating a GBM > >> - * device, and providing access to the device and its associated pixel format. > >> - */ > >> - > >> -/** > >> - *\var GBM::fd_ > >> - *\brief file descriptor to DRI device > >> - */ > >> - > >> -/** > >> - *\var GBM::gbmDevice_ > >> - *\brief Pointer to GBM device structure derived from fd_ > >> - */ > >> - > >> -/** > >> - *\var GBM::format_ > >> - *\brief Pixel format the GBM surface was created in > >> - */ > >> - > >> -/** > >> - *\brief GBM constructor. > >> - * > >> - * Creates a GBM instance with uninitialised state. > >> - */ > >> -GBM::GBM() > >> -{ > >> -} > >> - > >> -/** > >> - *\brief GBM destructor > >> - * > >> - * Cleans up the GBM device if it was successfully created, and closes > >> - * the associated file descriptor. > >> - */ > >> -GBM::~GBM() > >> -{ > >> - if (gbmDevice_) > >> - gbm_device_destroy(gbmDevice_); > >> -} > >> - > >> -/** > >> - * \brief Create and initialize a GBM device > >> - * > >> - * \todo Get dri device name from envOption setting > >> - * > >> - * Opens the DRI render node (/dev/dri/renderD128) and creates a GBM > >> - * device using the libgbm library. Sets the default pixel format to > >> - * ARGB8888. > >> - * > >> - * \return 0 on success, or a negative error code on failure > >> - */ > >> -int GBM::createDevice() > >> -{ > >> - const char dri_node[] = "/dev/dri/renderD128"; > >> - > >> - int fd = open(dri_node, O_RDWR | O_CLOEXEC | O_NOCTTY); > >> - if (fd < 0) { > >> - LOG(GBM, Error) << "Open " << dri_node << " fail " << strerror(errno); > >> - return -errno; > >> - } > >> - fd_ = UniqueFD(fd); > >> - > >> - gbmDevice_ = gbm_create_device(fd_.get()); > >> - if (!gbmDevice_) { > >> - LOG(GBM, Error) << "gbm_create_device fail" << strerror(errno); > >> - return -errno; > >> - } > >> - > >> - format_ = libcamera::formats::ARGB8888; > >> - > >> - return 0; > >> -} > >> - > >> -} /* namespace libcamera */ > >> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build > >> index 6f952bd98..d15943586 100644 > >> --- a/src/libcamera/meson.build > >> +++ b/src/libcamera/meson.build > >> @@ -70,15 +70,6 @@ libcamera_deps = [] > >> libatomic = cc.find_library('atomic', required : false) > >> libthreads = dependency('threads') > >> > >> -libgbm = dependency('gbm', required : false) > >> -gbm_works = cc.check_header('gbm.h', required: false) > >> - > >> -if libgbm.found() and gbm_works > >> - libcamera_internal_sources += files([ > >> - 'gbm.cpp', > >> - ]) > >> -endif > >> - > >> mesa_works = cc.check_header('EGL/egl.h', required: false) > >> libegl = dependency('egl', required : false) > >> libglesv2 = dependency('glesv2', required : false) > >> @@ -91,7 +82,7 @@ if libglesv2.found() > >> config_h.set('HAVE_GLESV2', 1) > >> endif > >> > >> -if mesa_works and gbm_works > >> +if mesa_works > >> libcamera_internal_sources += files([ > >> 'egl.cpp', > >> ]) > >> @@ -209,7 +200,6 @@ libcamera_deps += [ > >> libcrypto, > >> libdl, > >> libegl, > >> - libgbm, > >> libglesv2, > >> liblttng, > >> libudev,
On 20.01.26 18:46, Laurent Pinchart wrote: > On Tue, Jan 20, 2026 at 04:19:39PM +0100, Robert Mader wrote: >> On 20.01.26 16:17, Laurent Pinchart wrote: >>> On Tue, Jan 20, 2026 at 01:23:44PM +0100, Robert Mader wrote: >>>> GBM is not used any more - remove the helper class. >>>> >>>> This results in egl.cpp getting build on some setups where it previously >>>> didn't, notably Debian 11 on CI, triggering a build issues. Include a >>>> workaround suggested by: >>>> Barnabás Pőcze<barnabas.pocze@ideasonboard.com> >>>> >>>> This reverts commit c60b1ce8193841c2742b655097bb39ccbcb417c2. >>>> >>>> Signed-off-by: Robert Mader<robert.mader@collabora.com> >>>> Reviewed-by: Bryan O'Donoghue<bryan.odonoghue@linaro.org> >>>> Tested-by: Bryan O'Donoghue<bryan.odonoghue@linaro.org> # sm8250/rb5, x1e/Dell Insprion14p >>>> Reviewed-by: Barnabás Pőcze<barnabas.pocze@ideasonboard.com> >>>> Reviewed-by: Laurent Pinchart<laurent.pinchart@ideasonboard.com> >>>> >>>> --- >>>> >>>> Changes in v3: >>>> - Added Laurents R-B >>>> >>>> Changes in v2: >>>> - Added tags >>>> - Added build issue workaround - hope it's ok to keep the R-Bs. >>>> --- >>>> include/libcamera/internal/egl.h | 5 ++ >>>> include/libcamera/internal/gbm.h | 55 ------------- >>>> include/libcamera/internal/meson.build | 1 - >>>> src/libcamera/gbm.cpp | 107 ------------------------- >>>> src/libcamera/meson.build | 12 +-- >>>> 5 files changed, 6 insertions(+), 174 deletions(-) >>>> delete mode 100644 include/libcamera/internal/gbm.h >>>> delete mode 100644 src/libcamera/gbm.cpp >>>> >>>> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h >>>> index 630345ea7..ce386554f 100644 >>>> --- a/include/libcamera/internal/egl.h >>>> +++ b/include/libcamera/internal/egl.h >>>> @@ -16,6 +16,11 @@ >>>> #include <libcamera/base/span.h> >>>> #include <libcamera/base/utils.h> >>>> >>>> +/* Workaround for build issues on Mesa < 23.3, see >>>> + *https://github.com/KhronosGroup/EGL-Registry/pull/130 >>>> + */ >>> /* >>> * Workaround for build issues on Mesa < 23.3, see >>> *https://github.com/KhronosGroup/EGL-Registry/pull/130 >>> */ >>> >>> No need for a v4, this can be fixed when applying. >>> >>> Buuut... now that I notice this, this would belong to a separate patch, >>> it's not part of the revert. >> I generally agree and first did that - however I then pulled it in as >> otherwise the commit would break bi-secting on certain setups. Can do >> whatever you prefer. > Would it break bisection if we define EGL_NO_X11 first and then revert > the addition of gbm.{h,cpp} ? Errr, good point 😅 Will send a v4 tomorrow! >>>> +#define EGL_NO_X11 >>>> + >>>> #define EGL_EGLEXT_PROTOTYPES >>>> #include <EGL/egl.h> >>>> #include <EGL/eglext.h> >>>> diff --git a/include/libcamera/internal/gbm.h b/include/libcamera/internal/gbm.h >>>> deleted file mode 100644 >>>> index c10be06c1..000000000 >>>> --- a/include/libcamera/internal/gbm.h >>>> +++ /dev/null >>>> @@ -1,55 +0,0 @@ >>>> -/* SPDX-License-Identifier: LGPL-2.1-or-later */ >>>> -/* >>>> - * Copyright (C) 2024, Linaro Ltd. >>>> - * >>>> - * Authors: >>>> - * Bryan O'Donoghue<bryan.odonoghue@linaro.org> >>>> - * >>>> - * Helper class for managing GBM interactions >>>> - */ >>>> - >>>> -#pragma once >>>> - >>>> -#include <gbm.h> >>>> - >>>> -#include <libcamera/base/log.h> >>>> -#include <libcamera/base/unique_fd.h> >>>> - >>>> -#include <libcamera/formats.h> >>>> - >>>> -namespace libcamera { >>>> - >>>> -LOG_DECLARE_CATEGORY(GBM) >>>> - >>>> -class GBM >>>> -{ >>>> -public: >>>> - GBM(); >>>> - ~GBM(); >>>> - >>>> - int createDevice(); >>>> - >>>> - /** >>>> - * \brief Retrieve the GBM device handle >>>> - * >>>> - * \return Pointer to the gbm_device structure, or nullptr if the device >>>> - * has not been created >>>> - */ >>>> - struct gbm_device *device() const { return gbmDevice_; } >>>> - >>>> - /** >>>> - * \brief Retrieve the pixel format >>>> - * >>>> - * \return The PixelFormat used by this GBM instance (ARGB8888) >>>> - */ >>>> - PixelFormat format() const { return format_; } >>>> - >>>> -private: >>>> - LIBCAMERA_DISABLE_COPY_AND_MOVE(GBM) >>>> - >>>> - UniqueFD fd_; >>>> - struct gbm_device *gbmDevice_ = nullptr; >>>> - PixelFormat format_; >>>> -}; >>>> - >>>> -} /* namespace libcamera */ >>>> diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build >>>> index dc48619e5..4d2a09bd7 100644 >>>> --- a/include/libcamera/internal/meson.build >>>> +++ b/include/libcamera/internal/meson.build >>>> @@ -24,7 +24,6 @@ libcamera_internal_headers = files([ >>>> 'formats.h', >>>> 'framebuffer.h', >>>> 'egl.h', >>>> - 'gbm.h', >>>> 'global_configuration.h', >>>> 'ipa_data_serializer.h', >>>> 'ipa_manager.h', >>>> diff --git a/src/libcamera/gbm.cpp b/src/libcamera/gbm.cpp >>>> deleted file mode 100644 >>>> index d37808b0c..000000000 >>>> --- a/src/libcamera/gbm.cpp >>>> +++ /dev/null >>>> @@ -1,107 +0,0 @@ >>>> -/* SPDX-License-Identifier: LGPL-2.1-or-later */ >>>> -/* >>>> - * Copyright (C) 2024, Linaro Ltd. >>>> - * >>>> - * Authors: >>>> - * Bryan O'Donoghue<bryan.odonoghue@linaro.org> >>>> - * >>>> - * Helper class for managing GBM interactions >>>> - */ >>>> - >>>> -#include "libcamera/internal/gbm.h" >>>> - >>>> -#include <errno.h> >>>> -#include <fcntl.h> >>>> -#include <sys/ioctl.h> >>>> -#include <sys/mman.h> >>>> -#include <unistd.h> >>>> - >>>> -#include <linux/dma-buf.h> >>>> -#include <linux/dma-heap.h> >>>> - >>>> -namespace libcamera { >>>> - >>>> -LOG_DEFINE_CATEGORY(GBM) >>>> - >>>> -/** >>>> - * \class GBM >>>> - * \brief Helper class for managing GBM interactions >>>> - * >>>> - * The GBM class provides a simplified interface for creating and managing >>>> - * GBM devices. It handles the initialization and teardown of GBM devices >>>> - * used for buffer allocation in graphics and camera pipelines. >>>> - * >>>> - * This class is responsible for opening a DRI render node, creating a GBM >>>> - * device, and providing access to the device and its associated pixel format. >>>> - */ >>>> - >>>> -/** >>>> - *\var GBM::fd_ >>>> - *\brief file descriptor to DRI device >>>> - */ >>>> - >>>> -/** >>>> - *\var GBM::gbmDevice_ >>>> - *\brief Pointer to GBM device structure derived from fd_ >>>> - */ >>>> - >>>> -/** >>>> - *\var GBM::format_ >>>> - *\brief Pixel format the GBM surface was created in >>>> - */ >>>> - >>>> -/** >>>> - *\brief GBM constructor. >>>> - * >>>> - * Creates a GBM instance with uninitialised state. >>>> - */ >>>> -GBM::GBM() >>>> -{ >>>> -} >>>> - >>>> -/** >>>> - *\brief GBM destructor >>>> - * >>>> - * Cleans up the GBM device if it was successfully created, and closes >>>> - * the associated file descriptor. >>>> - */ >>>> -GBM::~GBM() >>>> -{ >>>> - if (gbmDevice_) >>>> - gbm_device_destroy(gbmDevice_); >>>> -} >>>> - >>>> -/** >>>> - * \brief Create and initialize a GBM device >>>> - * >>>> - * \todo Get dri device name from envOption setting >>>> - * >>>> - * Opens the DRI render node (/dev/dri/renderD128) and creates a GBM >>>> - * device using the libgbm library. Sets the default pixel format to >>>> - * ARGB8888. >>>> - * >>>> - * \return 0 on success, or a negative error code on failure >>>> - */ >>>> -int GBM::createDevice() >>>> -{ >>>> - const char dri_node[] = "/dev/dri/renderD128"; >>>> - >>>> - int fd = open(dri_node, O_RDWR | O_CLOEXEC | O_NOCTTY); >>>> - if (fd < 0) { >>>> - LOG(GBM, Error) << "Open " << dri_node << " fail " << strerror(errno); >>>> - return -errno; >>>> - } >>>> - fd_ = UniqueFD(fd); >>>> - >>>> - gbmDevice_ = gbm_create_device(fd_.get()); >>>> - if (!gbmDevice_) { >>>> - LOG(GBM, Error) << "gbm_create_device fail" << strerror(errno); >>>> - return -errno; >>>> - } >>>> - >>>> - format_ = libcamera::formats::ARGB8888; >>>> - >>>> - return 0; >>>> -} >>>> - >>>> -} /* namespace libcamera */ >>>> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build >>>> index 6f952bd98..d15943586 100644 >>>> --- a/src/libcamera/meson.build >>>> +++ b/src/libcamera/meson.build >>>> @@ -70,15 +70,6 @@ libcamera_deps = [] >>>> libatomic = cc.find_library('atomic', required : false) >>>> libthreads = dependency('threads') >>>> >>>> -libgbm = dependency('gbm', required : false) >>>> -gbm_works = cc.check_header('gbm.h', required: false) >>>> - >>>> -if libgbm.found() and gbm_works >>>> - libcamera_internal_sources += files([ >>>> - 'gbm.cpp', >>>> - ]) >>>> -endif >>>> - >>>> mesa_works = cc.check_header('EGL/egl.h', required: false) >>>> libegl = dependency('egl', required : false) >>>> libglesv2 = dependency('glesv2', required : false) >>>> @@ -91,7 +82,7 @@ if libglesv2.found() >>>> config_h.set('HAVE_GLESV2', 1) >>>> endif >>>> >>>> -if mesa_works and gbm_works >>>> +if mesa_works >>>> libcamera_internal_sources += files([ >>>> 'egl.cpp', >>>> ]) >>>> @@ -209,7 +200,6 @@ libcamera_deps += [ >>>> libcrypto, >>>> libdl, >>>> libegl, >>>> - libgbm, >>>> libglesv2, >>>> liblttng, >>>> libudev,
On Tue, Jan 20, 2026 at 10:28:17PM +0100, Robert Mader wrote: > On 20.01.26 18:46, Laurent Pinchart wrote: > > On Tue, Jan 20, 2026 at 04:19:39PM +0100, Robert Mader wrote: > >> On 20.01.26 16:17, Laurent Pinchart wrote: > >>> On Tue, Jan 20, 2026 at 01:23:44PM +0100, Robert Mader wrote: > >>>> GBM is not used any more - remove the helper class. > >>>> > >>>> This results in egl.cpp getting build on some setups where it previously > >>>> didn't, notably Debian 11 on CI, triggering a build issues. Include a > >>>> workaround suggested by: > >>>> Barnabás Pőcze<barnabas.pocze@ideasonboard.com> > >>>> > >>>> This reverts commit c60b1ce8193841c2742b655097bb39ccbcb417c2. > >>>> > >>>> Signed-off-by: Robert Mader<robert.mader@collabora.com> > >>>> Reviewed-by: Bryan O'Donoghue<bryan.odonoghue@linaro.org> > >>>> Tested-by: Bryan O'Donoghue<bryan.odonoghue@linaro.org> # sm8250/rb5, x1e/Dell Insprion14p > >>>> Reviewed-by: Barnabás Pőcze<barnabas.pocze@ideasonboard.com> > >>>> Reviewed-by: Laurent Pinchart<laurent.pinchart@ideasonboard.com> > >>>> > >>>> --- > >>>> > >>>> Changes in v3: > >>>> - Added Laurents R-B > >>>> > >>>> Changes in v2: > >>>> - Added tags > >>>> - Added build issue workaround - hope it's ok to keep the R-Bs. > >>>> --- > >>>> include/libcamera/internal/egl.h | 5 ++ > >>>> include/libcamera/internal/gbm.h | 55 ------------- > >>>> include/libcamera/internal/meson.build | 1 - > >>>> src/libcamera/gbm.cpp | 107 ------------------------- > >>>> src/libcamera/meson.build | 12 +-- > >>>> 5 files changed, 6 insertions(+), 174 deletions(-) > >>>> delete mode 100644 include/libcamera/internal/gbm.h > >>>> delete mode 100644 src/libcamera/gbm.cpp > >>>> > >>>> diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h > >>>> index 630345ea7..ce386554f 100644 > >>>> --- a/include/libcamera/internal/egl.h > >>>> +++ b/include/libcamera/internal/egl.h > >>>> @@ -16,6 +16,11 @@ > >>>> #include <libcamera/base/span.h> > >>>> #include <libcamera/base/utils.h> > >>>> > >>>> +/* Workaround for build issues on Mesa < 23.3, see > >>>> + *https://github.com/KhronosGroup/EGL-Registry/pull/130 > >>>> + */ > >>> > >>> /* > >>> * Workaround for build issues on Mesa < 23.3, see > >>> *https://github.com/KhronosGroup/EGL-Registry/pull/130 > >>> */ > >>> > >>> No need for a v4, this can be fixed when applying. > >>> > >>> Buuut... now that I notice this, this would belong to a separate patch, > >>> it's not part of the revert. > >> > >> I generally agree and first did that - however I then pulled it in as > >> otherwise the commit would break bi-secting on certain setups. Can do > >> whatever you prefer. > > > > Would it break bisection if we define EGL_NO_X11 first and then revert > > the addition of gbm.{h,cpp} ? > > Errr, good point 😅 Will send a v4 tomorrow! Sorry for not noticing it earlier. Let's merge v4 :-) > >>>> +#define EGL_NO_X11 > >>>> + > >>>> #define EGL_EGLEXT_PROTOTYPES > >>>> #include <EGL/egl.h> > >>>> #include <EGL/eglext.h> > >>>> diff --git a/include/libcamera/internal/gbm.h b/include/libcamera/internal/gbm.h > >>>> deleted file mode 100644 > >>>> index c10be06c1..000000000 > >>>> --- a/include/libcamera/internal/gbm.h > >>>> +++ /dev/null > >>>> @@ -1,55 +0,0 @@ > >>>> -/* SPDX-License-Identifier: LGPL-2.1-or-later */ > >>>> -/* > >>>> - * Copyright (C) 2024, Linaro Ltd. > >>>> - * > >>>> - * Authors: > >>>> - * Bryan O'Donoghue<bryan.odonoghue@linaro.org> > >>>> - * > >>>> - * Helper class for managing GBM interactions > >>>> - */ > >>>> - > >>>> -#pragma once > >>>> - > >>>> -#include <gbm.h> > >>>> - > >>>> -#include <libcamera/base/log.h> > >>>> -#include <libcamera/base/unique_fd.h> > >>>> - > >>>> -#include <libcamera/formats.h> > >>>> - > >>>> -namespace libcamera { > >>>> - > >>>> -LOG_DECLARE_CATEGORY(GBM) > >>>> - > >>>> -class GBM > >>>> -{ > >>>> -public: > >>>> - GBM(); > >>>> - ~GBM(); > >>>> - > >>>> - int createDevice(); > >>>> - > >>>> - /** > >>>> - * \brief Retrieve the GBM device handle > >>>> - * > >>>> - * \return Pointer to the gbm_device structure, or nullptr if the device > >>>> - * has not been created > >>>> - */ > >>>> - struct gbm_device *device() const { return gbmDevice_; } > >>>> - > >>>> - /** > >>>> - * \brief Retrieve the pixel format > >>>> - * > >>>> - * \return The PixelFormat used by this GBM instance (ARGB8888) > >>>> - */ > >>>> - PixelFormat format() const { return format_; } > >>>> - > >>>> -private: > >>>> - LIBCAMERA_DISABLE_COPY_AND_MOVE(GBM) > >>>> - > >>>> - UniqueFD fd_; > >>>> - struct gbm_device *gbmDevice_ = nullptr; > >>>> - PixelFormat format_; > >>>> -}; > >>>> - > >>>> -} /* namespace libcamera */ > >>>> diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build > >>>> index dc48619e5..4d2a09bd7 100644 > >>>> --- a/include/libcamera/internal/meson.build > >>>> +++ b/include/libcamera/internal/meson.build > >>>> @@ -24,7 +24,6 @@ libcamera_internal_headers = files([ > >>>> 'formats.h', > >>>> 'framebuffer.h', > >>>> 'egl.h', > >>>> - 'gbm.h', > >>>> 'global_configuration.h', > >>>> 'ipa_data_serializer.h', > >>>> 'ipa_manager.h', > >>>> diff --git a/src/libcamera/gbm.cpp b/src/libcamera/gbm.cpp > >>>> deleted file mode 100644 > >>>> index d37808b0c..000000000 > >>>> --- a/src/libcamera/gbm.cpp > >>>> +++ /dev/null > >>>> @@ -1,107 +0,0 @@ > >>>> -/* SPDX-License-Identifier: LGPL-2.1-or-later */ > >>>> -/* > >>>> - * Copyright (C) 2024, Linaro Ltd. > >>>> - * > >>>> - * Authors: > >>>> - * Bryan O'Donoghue<bryan.odonoghue@linaro.org> > >>>> - * > >>>> - * Helper class for managing GBM interactions > >>>> - */ > >>>> - > >>>> -#include "libcamera/internal/gbm.h" > >>>> - > >>>> -#include <errno.h> > >>>> -#include <fcntl.h> > >>>> -#include <sys/ioctl.h> > >>>> -#include <sys/mman.h> > >>>> -#include <unistd.h> > >>>> - > >>>> -#include <linux/dma-buf.h> > >>>> -#include <linux/dma-heap.h> > >>>> - > >>>> -namespace libcamera { > >>>> - > >>>> -LOG_DEFINE_CATEGORY(GBM) > >>>> - > >>>> -/** > >>>> - * \class GBM > >>>> - * \brief Helper class for managing GBM interactions > >>>> - * > >>>> - * The GBM class provides a simplified interface for creating and managing > >>>> - * GBM devices. It handles the initialization and teardown of GBM devices > >>>> - * used for buffer allocation in graphics and camera pipelines. > >>>> - * > >>>> - * This class is responsible for opening a DRI render node, creating a GBM > >>>> - * device, and providing access to the device and its associated pixel format. > >>>> - */ > >>>> - > >>>> -/** > >>>> - *\var GBM::fd_ > >>>> - *\brief file descriptor to DRI device > >>>> - */ > >>>> - > >>>> -/** > >>>> - *\var GBM::gbmDevice_ > >>>> - *\brief Pointer to GBM device structure derived from fd_ > >>>> - */ > >>>> - > >>>> -/** > >>>> - *\var GBM::format_ > >>>> - *\brief Pixel format the GBM surface was created in > >>>> - */ > >>>> - > >>>> -/** > >>>> - *\brief GBM constructor. > >>>> - * > >>>> - * Creates a GBM instance with uninitialised state. > >>>> - */ > >>>> -GBM::GBM() > >>>> -{ > >>>> -} > >>>> - > >>>> -/** > >>>> - *\brief GBM destructor > >>>> - * > >>>> - * Cleans up the GBM device if it was successfully created, and closes > >>>> - * the associated file descriptor. > >>>> - */ > >>>> -GBM::~GBM() > >>>> -{ > >>>> - if (gbmDevice_) > >>>> - gbm_device_destroy(gbmDevice_); > >>>> -} > >>>> - > >>>> -/** > >>>> - * \brief Create and initialize a GBM device > >>>> - * > >>>> - * \todo Get dri device name from envOption setting > >>>> - * > >>>> - * Opens the DRI render node (/dev/dri/renderD128) and creates a GBM > >>>> - * device using the libgbm library. Sets the default pixel format to > >>>> - * ARGB8888. > >>>> - * > >>>> - * \return 0 on success, or a negative error code on failure > >>>> - */ > >>>> -int GBM::createDevice() > >>>> -{ > >>>> - const char dri_node[] = "/dev/dri/renderD128"; > >>>> - > >>>> - int fd = open(dri_node, O_RDWR | O_CLOEXEC | O_NOCTTY); > >>>> - if (fd < 0) { > >>>> - LOG(GBM, Error) << "Open " << dri_node << " fail " << strerror(errno); > >>>> - return -errno; > >>>> - } > >>>> - fd_ = UniqueFD(fd); > >>>> - > >>>> - gbmDevice_ = gbm_create_device(fd_.get()); > >>>> - if (!gbmDevice_) { > >>>> - LOG(GBM, Error) << "gbm_create_device fail" << strerror(errno); > >>>> - return -errno; > >>>> - } > >>>> - > >>>> - format_ = libcamera::formats::ARGB8888; > >>>> - > >>>> - return 0; > >>>> -} > >>>> - > >>>> -} /* namespace libcamera */ > >>>> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build > >>>> index 6f952bd98..d15943586 100644 > >>>> --- a/src/libcamera/meson.build > >>>> +++ b/src/libcamera/meson.build > >>>> @@ -70,15 +70,6 @@ libcamera_deps = [] > >>>> libatomic = cc.find_library('atomic', required : false) > >>>> libthreads = dependency('threads') > >>>> > >>>> -libgbm = dependency('gbm', required : false) > >>>> -gbm_works = cc.check_header('gbm.h', required: false) > >>>> - > >>>> -if libgbm.found() and gbm_works > >>>> - libcamera_internal_sources += files([ > >>>> - 'gbm.cpp', > >>>> - ]) > >>>> -endif > >>>> - > >>>> mesa_works = cc.check_header('EGL/egl.h', required: false) > >>>> libegl = dependency('egl', required : false) > >>>> libglesv2 = dependency('glesv2', required : false) > >>>> @@ -91,7 +82,7 @@ if libglesv2.found() > >>>> config_h.set('HAVE_GLESV2', 1) > >>>> endif > >>>> > >>>> -if mesa_works and gbm_works > >>>> +if mesa_works > >>>> libcamera_internal_sources += files([ > >>>> 'egl.cpp', > >>>> ]) > >>>> @@ -209,7 +200,6 @@ libcamera_deps += [ > >>>> libcrypto, > >>>> libdl, > >>>> libegl, > >>>> - libgbm, > >>>> libglesv2, > >>>> liblttng, > >>>> libudev,
diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h index 630345ea7..ce386554f 100644 --- a/include/libcamera/internal/egl.h +++ b/include/libcamera/internal/egl.h @@ -16,6 +16,11 @@ #include <libcamera/base/span.h> #include <libcamera/base/utils.h> +/* Workaround for build issues on Mesa < 23.3, see + * https://github.com/KhronosGroup/EGL-Registry/pull/130 + */ +#define EGL_NO_X11 + #define EGL_EGLEXT_PROTOTYPES #include <EGL/egl.h> #include <EGL/eglext.h> diff --git a/include/libcamera/internal/gbm.h b/include/libcamera/internal/gbm.h deleted file mode 100644 index c10be06c1..000000000 --- a/include/libcamera/internal/gbm.h +++ /dev/null @@ -1,55 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2024, Linaro Ltd. - * - * Authors: - * Bryan O'Donoghue <bryan.odonoghue@linaro.org> - * - * Helper class for managing GBM interactions - */ - -#pragma once - -#include <gbm.h> - -#include <libcamera/base/log.h> -#include <libcamera/base/unique_fd.h> - -#include <libcamera/formats.h> - -namespace libcamera { - -LOG_DECLARE_CATEGORY(GBM) - -class GBM -{ -public: - GBM(); - ~GBM(); - - int createDevice(); - - /** - * \brief Retrieve the GBM device handle - * - * \return Pointer to the gbm_device structure, or nullptr if the device - * has not been created - */ - struct gbm_device *device() const { return gbmDevice_; } - - /** - * \brief Retrieve the pixel format - * - * \return The PixelFormat used by this GBM instance (ARGB8888) - */ - PixelFormat format() const { return format_; } - -private: - LIBCAMERA_DISABLE_COPY_AND_MOVE(GBM) - - UniqueFD fd_; - struct gbm_device *gbmDevice_ = nullptr; - PixelFormat format_; -}; - -} /* namespace libcamera */ diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index dc48619e5..4d2a09bd7 100644 --- a/include/libcamera/internal/meson.build +++ b/include/libcamera/internal/meson.build @@ -24,7 +24,6 @@ libcamera_internal_headers = files([ 'formats.h', 'framebuffer.h', 'egl.h', - 'gbm.h', 'global_configuration.h', 'ipa_data_serializer.h', 'ipa_manager.h', diff --git a/src/libcamera/gbm.cpp b/src/libcamera/gbm.cpp deleted file mode 100644 index d37808b0c..000000000 --- a/src/libcamera/gbm.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2024, Linaro Ltd. - * - * Authors: - * Bryan O'Donoghue <bryan.odonoghue@linaro.org> - * - * Helper class for managing GBM interactions - */ - -#include "libcamera/internal/gbm.h" - -#include <errno.h> -#include <fcntl.h> -#include <sys/ioctl.h> -#include <sys/mman.h> -#include <unistd.h> - -#include <linux/dma-buf.h> -#include <linux/dma-heap.h> - -namespace libcamera { - -LOG_DEFINE_CATEGORY(GBM) - -/** - * \class GBM - * \brief Helper class for managing GBM interactions - * - * The GBM class provides a simplified interface for creating and managing - * GBM devices. It handles the initialization and teardown of GBM devices - * used for buffer allocation in graphics and camera pipelines. - * - * This class is responsible for opening a DRI render node, creating a GBM - * device, and providing access to the device and its associated pixel format. - */ - -/** - *\var GBM::fd_ - *\brief file descriptor to DRI device - */ - -/** - *\var GBM::gbmDevice_ - *\brief Pointer to GBM device structure derived from fd_ - */ - -/** - *\var GBM::format_ - *\brief Pixel format the GBM surface was created in - */ - -/** - *\brief GBM constructor. - * - * Creates a GBM instance with uninitialised state. - */ -GBM::GBM() -{ -} - -/** - *\brief GBM destructor - * - * Cleans up the GBM device if it was successfully created, and closes - * the associated file descriptor. - */ -GBM::~GBM() -{ - if (gbmDevice_) - gbm_device_destroy(gbmDevice_); -} - -/** - * \brief Create and initialize a GBM device - * - * \todo Get dri device name from envOption setting - * - * Opens the DRI render node (/dev/dri/renderD128) and creates a GBM - * device using the libgbm library. Sets the default pixel format to - * ARGB8888. - * - * \return 0 on success, or a negative error code on failure - */ -int GBM::createDevice() -{ - const char dri_node[] = "/dev/dri/renderD128"; - - int fd = open(dri_node, O_RDWR | O_CLOEXEC | O_NOCTTY); - if (fd < 0) { - LOG(GBM, Error) << "Open " << dri_node << " fail " << strerror(errno); - return -errno; - } - fd_ = UniqueFD(fd); - - gbmDevice_ = gbm_create_device(fd_.get()); - if (!gbmDevice_) { - LOG(GBM, Error) << "gbm_create_device fail" << strerror(errno); - return -errno; - } - - format_ = libcamera::formats::ARGB8888; - - return 0; -} - -} /* namespace libcamera */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 6f952bd98..d15943586 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -70,15 +70,6 @@ libcamera_deps = [] libatomic = cc.find_library('atomic', required : false) libthreads = dependency('threads') -libgbm = dependency('gbm', required : false) -gbm_works = cc.check_header('gbm.h', required: false) - -if libgbm.found() and gbm_works - libcamera_internal_sources += files([ - 'gbm.cpp', - ]) -endif - mesa_works = cc.check_header('EGL/egl.h', required: false) libegl = dependency('egl', required : false) libglesv2 = dependency('glesv2', required : false) @@ -91,7 +82,7 @@ if libglesv2.found() config_h.set('HAVE_GLESV2', 1) endif -if mesa_works and gbm_works +if mesa_works libcamera_internal_sources += files([ 'egl.cpp', ]) @@ -209,7 +200,6 @@ libcamera_deps += [ libcrypto, libdl, libegl, - libgbm, libglesv2, liblttng, libudev,