diff mbox series

[meta-multimedia] libcamera: fix softisp-gpu build on GLES-only EGL stacks

Message ID 20261014181217.1428614-1-joel.winarske@linux.com
State Under Review
Headers show
Series [meta-multimedia] libcamera: fix softisp-gpu build on GLES-only EGL stacks | expand

Commit Message

Joel Winarske Oct. 14, 2026, 6:12 p.m. UTC
The GPU software ISP renders with GLES 2 through EGL and never uses
desktop GL, so depend on virtual/libgles2 instead of virtual/libgl.
Requiring virtual/libgl breaks machines whose GPU stack only provides
EGL and GLES, e.g. StarFive JH7110 with the PowerVR mesa-pvr.

Also carry a patch so libcamera doesn't redefine EGL_NO_X11 when an
older Mesa's egl.pc already passes -DEGL_NO_X11, which fails the build
with -Werror.

Signed-off-by: Joel Winarske <joel.winarske@linux.com>
---
 ...camera-egl-Don-t-redefine-EGL_NO_X11.patch | 46 +++++++++++++++++++
 .../libcamera/libcamera_0.7.2.bb              |  3 +-
 2 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 meta-multimedia/recipes-multimedia/libcamera/libcamera/0002-libcamera-egl-Don-t-redefine-EGL_NO_X11.patch
diff mbox series

Patch

diff --git a/meta-multimedia/recipes-multimedia/libcamera/libcamera/0002-libcamera-egl-Don-t-redefine-EGL_NO_X11.patch b/meta-multimedia/recipes-multimedia/libcamera/libcamera/0002-libcamera-egl-Don-t-redefine-EGL_NO_X11.patch
new file mode 100644
index 0000000000..eace529b06
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/libcamera/libcamera/0002-libcamera-egl-Don-t-redefine-EGL_NO_X11.patch
@@ -0,0 +1,46 @@ 
+From 998b5c7ee5cabd51292ac216ccb390c35f989a78 Mon Sep 17 00:00:00 2001
+From: Joel Winarske <joel.winarske@linux.com>
+Date: Mon, 12 Oct 2026 18:20:01 -0700
+Subject: [PATCH] libcamera: egl: Don't redefine EGL_NO_X11
+
+Mesa built without the X11 platform exports -DEGL_NO_X11 via egl.pc
+Cflags, from mesa!2226 (19.3) until mesa!18848 (22.3) moved Xlib
+inclusion behind USE_X11. This affects non-glvnd builds, where egl.pc
+comes from Mesa rather than libglvnd, e.g. the PowerVR mesa-pvr (22.1)
+used on StarFive JH7110.
+
+The -D defines the macro as 1, so the unconditional empty define in
+egl.h is a redefinition, which is an error with -Werror:
+
+  include/libcamera/internal/egl.h:23:9: error: 'EGL_NO_X11' redefined [-Werror]
+
+The define is still needed for EGL headers predating
+KhronosGroup/EGL-Registry#130, which otherwise pull in Xlib.h, so only
+define it when it isn't already set.
+
+Upstream-Status: Submitted [https://patchwork.libcamera.org/patch/28452/]
+
+Signed-off-by: Joel Winarske <joel.winarske@linux.com>
+Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
+Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
+---
+ include/libcamera/internal/egl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
+index 1e31d490b..aeb4da80d 100644
+--- a/include/libcamera/internal/egl.h
++++ b/include/libcamera/internal/egl.h
+@@ -20,7 +20,9 @@
+  * Workaround for build issues on Mesa <= 22.2, see
+  * https://github.com/KhronosGroup/EGL-Registry/pull/130
+  */
++#ifndef EGL_NO_X11
+ #define EGL_NO_X11
++#endif
+ 
+ #define EGL_EGLEXT_PROTOTYPES
+ #include <EGL/egl.h>
+-- 
+2.56.0
+
diff --git a/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.7.2.bb b/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.7.2.bb
index 955cf041ba..22e1058459 100644
--- a/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.7.2.bb
+++ b/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.7.2.bb
@@ -12,6 +12,7 @@  LIC_FILES_CHKSUM = "\
 SRC_URI = " \
         git://git.libcamera.org/libcamera/libcamera.git;protocol=https;branch=master;tag=v${PV} \
         file://0001-ipa_data_serializer-Mark-vector-readPOD-overload-as-m.patch \
+        file://0002-libcamera-egl-Don-t-redefine-EGL_NO_X11.patch \
 "
 
 SRCREV = "191e202178f02430b5942397c70d215cdd2056fa"
@@ -33,7 +34,7 @@  PACKAGECONFIG[compliance] = "-Dlc-compliance=enabled,-Dlc-compliance=disabled,gt
 PACKAGECONFIG[gst] = "-Dgstreamer=enabled,-Dgstreamer=disabled,gstreamer1.0 gstreamer1.0-plugins-base"
 PACKAGECONFIG[jpeg] = "-Dcam-jpeg=enabled,-Dcam-jpeg=disabled,libjpeg-turbo"
 PACKAGECONFIG[kms] = "-Dcam-output-kms=enabled,-Dcam-output-kms=disabled,libdrm"
-PACKAGECONFIG[opengl] = "-Dsoftisp-gpu=enabled,-Dsoftisp-gpu=disabled,virtual/libgl virtual/egl"
+PACKAGECONFIG[opengl] = "-Dsoftisp-gpu=enabled,-Dsoftisp-gpu=disabled,virtual/egl virtual/libgles2"
 PACKAGECONFIG[python] = "-Dpycamera=enabled,-Dpycamera=disabled,python3-pybind11"
 PACKAGECONFIG[raspberrypi] = ",,libpisp"
 PACKAGECONFIG[sdl] = "-Dcam-output-sdl2=enabled,-Dcam-output-sdl2=disabled,virtual/libsdl2"