From patchwork Wed Jan 21 09:08:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Mader X-Patchwork-Id: 25903 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 4E25AC3220 for ; Wed, 21 Jan 2026 09:09:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7AF59615B2; Wed, 21 Jan 2026 10:09:37 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=robert.mader@collabora.com header.b="N0P/CKRz"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6F198615B2 for ; Wed, 21 Jan 2026 10:09:35 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; t=1768986570; cv=none; d=zohomail.com; s=zohoarc; b=V68lifQhstoNhYLPGKjRPp40ol19r3iamDGq/1kQ760gw5LMCmAZO9WLJYchHBST0KMrYvVhwYLafrWmlpbGMe4Tm9tM0Yk0jWk3nN3AFak6BDnHius0wmUlG4pFtEjcH0QQ0kjjMNSNPtnOC3wgBSxLAUZuZWZZy+Ag9uOKuxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768986570; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZWT5oBnml50K6Fm+ocsguHWNgGl5nobzdBEbiYg2BcU=; b=QfyzBZU4N8ohxPQ+DoJ2Srb+6Bhnc2y8j25sD3iTPAiZhV219wSCtD2zK0TBslJhsF+E1jhXw5NZcHopwjkrLUVtxbvNJnSqjFGg3rNb0FM1Q7ZH+UDtyVfsUop1VwrIEgR1YLtJZWJDCAuUpQvI99ow3t95w/ZmU1tcl85ipmU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=robert.mader@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1768986570; s=zohomail; d=collabora.com; i=robert.mader@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=ZWT5oBnml50K6Fm+ocsguHWNgGl5nobzdBEbiYg2BcU=; b=N0P/CKRzVsOgtAedr2bs/Z7CkiRCyMdv17P1MofVlqI2lPg2vyglZUsIWhRekkyf rkO+bb1mIbBl1RUAkzyBhgruXxH3+BMJg4tswp42jJBBHM2uiIQ+HlujGyoSi3+KLa5 VEbpTQg9d3C8KGOYVmdF5oBh4uKrpcfJcFZ/VS5o= Received: by mx.zohomail.com with SMTPS id 1768986568344684.6026434509452; Wed, 21 Jan 2026 01:09:28 -0800 (PST) From: Robert Mader To: libcamera-devel@lists.libcamera.org Cc: Robert Mader , Bryan O'Donoghue , Milan Zamazal , =?utf-8?b?QmFybmFiw6FzIFDFkWN6?= =?utf-8?q?e?= , Laurent Pinchart Subject: [PATCH v4 1/3] egl: Use the Mesa surfaceless platform instead of GBM Date: Wed, 21 Jan 2026 10:08:52 +0100 Message-ID: <20260121090854.27483-1-robert.mader@collabora.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Mesa surfaceless platform appears to be a better fit for the use-case at hand: 1. Like GBM it is Mesa specific, so no change in supported setups is expected. If ever required, a fallback to the generic device platform could be added on top. 2. It leaves the complexity of selecting a renderer device to the driver, reducing code and dependencies. 3. It allows to use llvmpipe / software drivers without dri device, which can be useful on CI or debugging (with LIBGL_ALWAYS_SOFTWARE=1). Signed-off-by: Robert Mader Reviewed-by: Bryan O'Donoghue Tested-by: Bryan O'Donoghue # sm8250/rb5, x1e/Dell Insprion14p Reviewed-by: Milan Zamazal Tested-by: Milan Zamazal # TI AM69 Tested-by: Barnabás Pőcze # ThinkPad X1 Yoga Gen 7 + ov2740 Reviewed-by: Laurent Pinchart --- Changes in v3: - Minor commit message improvement - Use EGL_DEFAULT_DISPLAY instead of nullptr (no change in behavior) - Improve comment formating - Add Laurents R-B Changes in v2: - Add tags --- include/libcamera/internal/egl.h | 4 +--- src/libcamera/egl.cpp | 14 +++++++------- src/libcamera/software_isp/debayer_egl.cpp | 9 +++------ src/libcamera/software_isp/debayer_egl.h | 1 - 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h index f007f448a..630345ea7 100644 --- a/include/libcamera/internal/egl.h +++ b/include/libcamera/internal/egl.h @@ -16,8 +16,6 @@ #include #include -#include "libcamera/internal/gbm.h" - #define EGL_EGLEXT_PROTOTYPES #include #include @@ -96,7 +94,7 @@ public: eGL(); ~eGL(); - int initEGLContext(GBM *gbmContext); + int initEGLContext(); int createInputDMABufTexture2D(eGLImage &eglImage, int fd); int createOutputDMABufTexture2D(eGLImage &eglImage, int fd); diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp index da563ee09..5b9bbf410 100644 --- a/src/libcamera/egl.cpp +++ b/src/libcamera/egl.cpp @@ -256,24 +256,22 @@ void eGL::createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint /** * \brief Initialise the EGL context - * \param[in] gbmContext Pointer to initialised GBM context * - * Sets up the EGL display from the GBM device, creates an OpenGL ES 2.0 - * context, and retrieves function pointers for required extensions - * including: + * Sets up the EGL display, creates an OpenGL ES 2.0 context, and retrieves + * function pointers for required extensions including: * - eglCreateImageKHR / eglDestroyImageKHR * - glEGLImageTargetTexture2DOES * * \return 0 on success, or -ENODEV on failure */ -int eGL::initEGLContext(GBM *gbmContext) +int eGL::initEGLContext() { EGLint configAttribs[] = { EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; @@ -291,7 +289,9 @@ int eGL::initEGLContext(GBM *gbmContext) goto fail; } - display_ = eglGetDisplay(gbmContext->device()); + display_ = eglGetPlatformDisplay(EGL_PLATFORM_SURFACELESS_MESA, + EGL_DEFAULT_DISPLAY, + nullptr); if (display_ == EGL_NO_DISPLAY) { LOG(eGL, Error) << "Unable to get EGL display"; goto fail; diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index 9693d7252..37c44e8b1 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -141,8 +141,8 @@ int DebayerEGL::initBayerShaders(PixelFormat inputFormat, PixelFormat outputForm egl_.pushEnv(shaderEnv, "#extension GL_OES_EGL_image_external: enable"); /* - * Tell shaders how to re-order output taking account of how the - * pixels are actually stored by GBM + * Tell shaders how to re-order output taking account of how the pixels + * are actually stored by EGL. */ switch (outputFormat) { case formats::ARGB8888: @@ -586,10 +586,7 @@ int DebayerEGL::start() { GLint maxTextureImageUnits; - if (gbmSurface_.createDevice()) - return -ENODEV; - - if (egl_.initEGLContext(&gbmSurface_)) + if (egl_.initEGLContext()) return -ENODEV; glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureImageUnits); diff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h index a5033bc63..cfbaf8e9d 100644 --- a/src/libcamera/software_isp/debayer_egl.h +++ b/src/libcamera/software_isp/debayer_egl.h @@ -113,7 +113,6 @@ private: Rectangle window_; std::unique_ptr stats_; eGL egl_; - GBM gbmSurface_; uint32_t width_; uint32_t height_; GLint glFormat_; From patchwork Wed Jan 21 09:08:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Mader X-Patchwork-Id: 25904 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 82D2EC3220 for ; Wed, 21 Jan 2026 09:09:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3514A61FC8; Wed, 21 Jan 2026 10:09:41 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=robert.mader@collabora.com header.b="fX2wiysW"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7D8A961FC4 for ; Wed, 21 Jan 2026 10:09:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; t=1768986576; cv=none; d=zohomail.com; s=zohoarc; b=ZfinL/nhq6DRQpIG/h/XQdUVWumlJy07t8NB7ouhr8vCJ1Ot1oI9q7ZPBKUeljGaedk1Wnmgqs8WdoiPLGy4b8Ckc99VkMZIsWqJtT3vUut9v1iVXxnW4nsEY/Nc2jnYdS91vszORZC9FrZDCBiZp4V5gwudvDsVfb8rRnJCHtM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768986576; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=itY7biLqCAllWqA6C4kfZnzkwFvdl1kmXHpnGgg6qJU=; b=PJfCc8W4Pna6NMDod4tmYnpyC5ktcSWLcxGD8GFYTb4T1ef7tatWOvy+av8Or/+VJQ9GIB7Q+DM+fqLHX/vV3nwyys4lIE4v9jUKKCevsrYTQR0yrL9VGS+2YQqbPiCXaJeylY1Xkp3zpaeojwlIa+PKv73PXStN4741YqHAtmQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=robert.mader@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1768986576; s=zohomail; d=collabora.com; i=robert.mader@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=itY7biLqCAllWqA6C4kfZnzkwFvdl1kmXHpnGgg6qJU=; b=fX2wiysWVcPyUm1Ci+cO3lvrcH82fkBHGCp1ZA9cAh95vQKKu+Q+MRCOeQyUSyFH kV2EbFirL+QMhYkOZpuns8lW93/IxKrrgUV4hnvhkN+DwBJKQMKMXVU4dR2PgzqLWcE /V0fKa8s5DcPOktnhK+VcDx7XIvKr+bR6KdfPEXM= Received: by mx.zohomail.com with SMTPS id 1768986574441237.22933348087736; Wed, 21 Jan 2026 01:09:34 -0800 (PST) From: Robert Mader To: libcamera-devel@lists.libcamera.org Cc: Robert Mader , =?utf-8?q?Barnab=C3=A1s_P?= =?utf-8?b?xZFjemU=?= Subject: [PATCH v4 2/3] egl: Add workaround for Mesa <= 22.2 Date: Wed, 21 Jan 2026 10:08:53 +0100 Message-ID: <20260121090854.27483-2-robert.mader@collabora.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260121090854.27483-1-robert.mader@collabora.com> References: <20260121090854.27483-1-robert.mader@collabora.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Older Mesa versions with EGL headers missing the change from https://github.com/KhronosGroup/EGL-Registry/pull/130 pull in Xlib headers, causing build issues. This notably happens on the Debian 11 CI image, which until now does not build the shared EGL code due to missing GBM dependencies. That will change in the following commit, thus include a workaround. Suggested-by: Barnabás Pőcze Signed-off-by: Robert Mader Reviewed-by: Laurent Pinchart --- Changes in v4: - Pulled this change into a dedicated commit - Fixed comment style - Fixed Mesa version in comment --- include/libcamera/internal/egl.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h index 630345ea7..8a2d96d7a 100644 --- a/include/libcamera/internal/egl.h +++ b/include/libcamera/internal/egl.h @@ -16,6 +16,12 @@ #include #include +/* + * Workaround for build issues on Mesa <= 22.2, see + * https://github.com/KhronosGroup/EGL-Registry/pull/130 + */ +#define EGL_NO_X11 + #define EGL_EGLEXT_PROTOTYPES #include #include From patchwork Wed Jan 21 09:08:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Mader X-Patchwork-Id: 25905 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 605A6C327D for ; Wed, 21 Jan 2026 09:09:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1456F61FCA; Wed, 21 Jan 2026 10:09:43 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=robert.mader@collabora.com header.b="CevMCeWg"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 92DAE61FC6 for ; Wed, 21 Jan 2026 10:09:41 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; t=1768986578; cv=none; d=zohomail.com; s=zohoarc; b=J0GeMHo0OtZZAvdjtrudC7gYghdBk9k2EO3edOwyzJNx7jvWX7hpfs66oZSPgnunlG7iM6KP33pm6nWOw9/QEDr18qnxI52038Z55wMnRtSErvd6jo5QCNOJ6TxOMbEnKt46GyLROzApz1Et2weKovlo6EfKWtg5DE1d0FrUQnI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768986578; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=mmnoGi96Frg3kdzUbwoxFDl6Sr66ra4OaelTZOEvRdI=; b=IRjOHT4wPWk1zQAZ0pWJU+7rjr21yd7DIc2VZCWLNCfN0PkXw9Og1z3QrpLw/QqOHouMxcTChLy3zqKiuXzVmPVuvyyMEL14ZhnpWg8YoYMxQBqOmkJypcOB+45nrjiSISLWGn9S/0u8XzNruzcqBC8+8JiDlw75LuVsxcnz85M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=robert.mader@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1768986578; s=zohomail; d=collabora.com; i=robert.mader@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=mmnoGi96Frg3kdzUbwoxFDl6Sr66ra4OaelTZOEvRdI=; b=CevMCeWgJ4R34nkL3V4hcAx7Wtipg8wI3Vef6AoY2/g6AndgKVmO7/TvuLx/xkCd BPfE38Fj54DY9hpZCTVmcnOdrDlX6RVqp+pSPCN9zEypz5n0U2+5TjOlT5eq2JYBLQ8 HoLJTMuP1A3Jsoq4PlxMooLpgPvWg7UF3Uf+d5SU= Received: by mx.zohomail.com with SMTPS id 1768986577158128.48417700906577; Wed, 21 Jan 2026 01:09:37 -0800 (PST) From: Robert Mader To: libcamera-devel@lists.libcamera.org Cc: Robert Mader , Bryan O'Donoghue , =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= , Laurent Pinchart Subject: [PATCH v4 3/3] Revert "libcamera: software_isp: gbm: Add a GBM helper class for GPU surface access" Date: Wed, 21 Jan 2026 10:08:54 +0100 Message-ID: <20260121090854.27483-3-robert.mader@collabora.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260121090854.27483-1-robert.mader@collabora.com> References: <20260121090854.27483-1-robert.mader@collabora.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" GBM is not used any more - remove the helper class. This reverts commit c60b1ce8193841c2742b655097bb39ccbcb417c2. Signed-off-by: Robert Mader Reviewed-by: Bryan O'Donoghue Tested-by: Bryan O'Donoghue # sm8250/rb5, x1e/Dell Insprion14p Reviewed-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart --- Changes in v4: - Move build workaround into a dedicated commit 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/gbm.h | 55 ------------- include/libcamera/internal/meson.build | 1 - src/libcamera/gbm.cpp | 107 ------------------------- src/libcamera/meson.build | 12 +-- 4 files changed, 1 insertion(+), 174 deletions(-) delete mode 100644 include/libcamera/internal/gbm.h delete mode 100644 src/libcamera/gbm.cpp 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 - * - * Helper class for managing GBM interactions - */ - -#pragma once - -#include - -#include -#include - -#include - -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 - * - * Helper class for managing GBM interactions - */ - -#include "libcamera/internal/gbm.h" - -#include -#include -#include -#include -#include - -#include -#include - -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,