Files
fml13v01-buildroot/package/mesa3d/0045-meson-allow-libGL-to-be-built-without-GLX.patch
T

141 lines
4.5 KiB
Diff

From 43662126e9973c6cff496ba32fae3cf372e0646b Mon Sep 17 00:00:00 2001
From: Brendan King <Brendan.King@imgtec.com>
Date: Thu, 11 Jun 2020 12:29:51 +0100
Subject: [PATCH 45/50] meson: allow libGL to be built without GLX
If Meson is run with option "glx" set to "null", build the
OpenGL library without GLX.
The "eglBindAPI workaround for dEQP bug" change to eglcurrent.h
(commit 2d46c91040aeb8ebad486214159c34417fbc87db) has been
modified to use a new EGL_WITH_OPENGL define, which indicates
whether OpneGL is present or not. This allows EGL to be used
with OpenGL on platforms other than X11.
---
meson.build | 8 ++++++--
meson_options.txt | 2 +-
src/egl/main/eglcurrent.h | 7 +++----
src/glx/meson.build | 16 ++++++++++++----
src/meson.build | 2 +-
5 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/meson.build b/meson.build
index 3c55447b6eb..af020203752 100644
--- a/meson.build
+++ b/meson.build
@@ -459,6 +459,10 @@ else
with_egl = false
endif
+if with_egl and with_opengl and with_glx != 'disabled'
+ pre_args += '-DEGL_WITH_OPENGL'
+endif
+
# Android uses emutls for versions <= P/28. For USE_ELF_TLS we need ELF TLS.
use_elf_tls = false
if not ['windows', 'freebsd', 'openbsd', 'haiku'].contains(host_machine.system()) and (not with_platform_android or get_option('platform-sdk-version') >= 29)
@@ -466,7 +470,7 @@ if not ['windows', 'freebsd', 'openbsd', 'haiku'].contains(host_machine.system()
use_elf_tls = true
endif
-if with_glx != 'disabled'
+if with_glx != 'disabled' and with_glx != 'null'
if not (with_platform_x11 and with_any_opengl)
error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
elif with_glx == 'gallium-xlib'
@@ -528,7 +532,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
error('Vulkan drivers require dri3 for X11 support')
endif
if with_dri
- if with_glx == 'disabled' and not with_egl and not with_gbm
+ if (with_glx == 'disabled' or with_glx == 'null') and not with_egl and not with_gbm
error('building dri drivers require at least one windowing system')
endif
endif
diff --git a/meson_options.txt b/meson_options.txt
index 9073223e8f5..4038629544e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -267,7 +267,7 @@ option(
'glx',
type : 'combo',
value : 'auto',
- choices : ['auto', 'disabled', 'dri', 'xlib', 'gallium-xlib'],
+ choices : ['auto', 'disabled', 'dri', 'xlib', 'gallium-xlib', 'null'],
description : 'Build support for GLX platform'
)
option(
diff --git a/src/egl/main/eglcurrent.h b/src/egl/main/eglcurrent.h
index 32570970947..dcc418afd6f 100644
--- a/src/egl/main/eglcurrent.h
+++ b/src/egl/main/eglcurrent.h
@@ -71,11 +71,10 @@ struct _egl_thread_info
static inline EGLBoolean
_eglIsApiValid(EGLenum api)
{
-#ifndef HAVE_X11_PLATFORM
- /* OpenGL is not a valid/supported API on Android */
- return api == EGL_OPENGL_ES_API;
-#else
+#ifdef EGL_WITH_OPENGL
return (api == EGL_OPENGL_ES_API || api == EGL_OPENGL_API);
+#else
+ return api == EGL_OPENGL_ES_API;
#endif
}
diff --git a/src/glx/meson.build b/src/glx/meson.build
index 58f9e1aa896..41ca936b8f4 100644
--- a/src/glx/meson.build
+++ b/src/glx/meson.build
@@ -126,7 +126,11 @@ gl_lib_cargs = [
'-D_REENTRANT',
]
-libglx = static_library(
+if with_glx == 'null'
+ libglx_link = [libglapi]
+ libglx_link_whole = [libglapi_static]
+else
+ libglx = static_library(
'glx',
[files_libglx, glx_generated],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_glapi, inc_loader],
@@ -143,13 +147,17 @@ libglx = static_library(
idep_mesautil, idep_xmlconfig,
dep_libdrm, dep_dri2proto, dep_glproto, dep_x11, dep_glvnd,
],
-)
+ )
+
+ libglx_link = [libglapi_static,libglapi]
+ libglx_link_whole = [libglx]
+endif
libgl = shared_library(
gl_lib_name,
[],
- link_with : [libglapi_static, libglapi],
- link_whole : libglx,
+ link_with : libglx_link,
+ link_whole : libglx_link_whole,
link_args : [ld_args_bsymbolic, ld_args_gc_sections, extra_ld_args_libgl],
dependencies : [
dep_libdrm, dep_dl, dep_m, dep_thread, dep_x11, dep_xcb_glx, dep_xcb,
diff --git a/src/meson.build b/src/meson.build
index d96c754a63d..a92580b2dd5 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -104,7 +104,7 @@ subdir('loader')
if with_platform_haiku
subdir('hgl')
endif
-if with_glx == 'dri'
+if with_glx == 'dri' or with_glx == 'null'
subdir('glx')
endif
if with_gbm
--
2.17.1