Mesa (main): meson: allow egl_native_platform to be specified

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 21 23:29:25 UTC 2021


Module: Mesa
Branch: main
Commit: 47946855f19cc7d082fd59e090bb83f5d3930871
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=47946855f19cc7d082fd59e090bb83f5d3930871

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Tue Jul 20 17:52:47 2021 -0700

meson: allow egl_native_platform to be specified

After commit f8dc22bf61c, it was no longer possible to have explicitly
enabled platforms with surfaceless being the EGL native platform.  This
fixes that by adding -Degl-native-platform.

Fixes: f8dc22bf61c ("meson: drop deprecated EGL platform build options")
Signed-off-by: Chia-I Wu <olvaffe at gmail.com>
Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11992>

---

 meson.build       | 26 ++++++++++++++++++++------
 meson_options.txt | 10 ++++++++++
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/meson.build b/meson.build
index 2c3cbdd9b17..9c968a3bcbb 100644
--- a/meson.build
+++ b/meson.build
@@ -358,12 +358,6 @@ with_platform_wayland = _platforms.contains('wayland')
 with_platform_haiku = _platforms.contains('haiku')
 with_platform_windows = _platforms.contains('windows')
 
-if _platforms.length() != 0
-  egl_native_platform = _platforms[0]
-else
-  egl_native_platform = 'surfaceless'
-endif
-
 with_glx = get_option('glx')
 if with_glx == 'auto'
   if with_platform_android
@@ -458,6 +452,26 @@ else
   with_egl = false
 endif
 
+if with_egl
+  _platforms += 'surfaceless'
+  if with_gbm and not with_platform_android
+    _platforms += 'drm'
+  endif
+endif
+
+egl_native_platform = get_option('egl-native-platform')
+if egl_native_platform.contains('auto')
+  if _platforms.length() != 0
+    egl_native_platform = _platforms[0]
+  else
+    egl_native_platform = 'surfaceless'
+  endif
+endif
+
+if with_egl and not _platforms.contains(egl_native_platform)
+  error('-Degl-native-platform does not specify an enabled platform')
+endif
+
 # Android uses emutls for versions <= P/28. For USE_ELF_TLS we need ELF TLS.
 use_elf_tls = false
 if (not ['freebsd', 'openbsd', 'haiku'].contains(host_machine.system()) and
diff --git a/meson_options.txt b/meson_options.txt
index 2c11092eeb4..29c402c4844 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -27,6 +27,16 @@ option(
   ],
   description : 'window systems to support. If this is set to `auto`, all platforms applicable will be enabled.'
 )
+option(
+  'egl-native-platform',
+  type : 'combo',
+  value : 'auto',
+  choices : [
+    'auto', 'x11', 'wayland', 'haiku', 'android', 'windows',
+    'surfaceless', 'drm',
+  ],
+  description : 'the window system EGL assumes for EGL_DEFAULT_DISPLAY',
+)
 option(
   'android-stub',
   type : 'boolean',



More information about the mesa-commit mailing list