libcamera: fix softisp-gpu build on GLES-only EGL stacks

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>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Joel Winarske authored and Khem Raj committed 2026-10-14 14:19:27 -07:00
1 parent 88161b7138
commit f52eea223a
2 files changed
+48 -1

No files matched your search

@@ -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
@@ -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"