[Mesa-dev] [PATCH mesa 1/3] include: sync eglplatform.h from Khronos

Eric Engestrom eric at engestrom.ch
Sun Jun 10 08:35:51 UTC 2018


An issue [1] was recently raised with the upstream eglplatform.h, as my
upstreaming of the "X11 on Apple" resulted in Apple platforms to always
try to include X11 headers.

The solution [2] was to also upstream our `MESA_EGL_NO_X11_HEADERS`
toggle, inverted as `USE_X11`.

This commit updates our copy of the header, and updates the build system
to use the new define.

[1] https://github.com/KhronosGroup/EGL-Registry/issues/52
[2] https://github.com/KhronosGroup/EGL-Registry/pull/53

Signed-off-by: Eric Engestrom <eric at engestrom.ch>
---
 configure.ac              |  9 ++++-----
 include/EGL/eglplatform.h | 16 ++++++----------
 meson.build               |  5 ++---
 3 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index 75ee1a7c01c9663250e3..97a6cd58a432e8a44d10 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2463,11 +2463,10 @@ fi
 AC_SUBST([EGL_NATIVE_PLATFORM])
 AC_SUBST([EGL_CFLAGS])
 
-# If we don't have the X11 platform, set this define so we don't try to include
-# the X11 headers.
-if ! echo "$platforms" | grep -q 'x11'; then
-    DEFINES="$DEFINES -DMESA_EGL_NO_X11_HEADERS"
-    GL_PC_CFLAGS="$GL_PC_CFLAGS -DMESA_EGL_NO_X11_HEADERS"
+# If we have the X11 platform, set this define so we include the X11 headers.
+if echo "$platforms" | grep -q 'x11'; then
+    DEFINES="$DEFINES -DUSE_X11"
+    GL_PC_CFLAGS="$GL_PC_CFLAGS -DUSE_X11"
 fi
 
 dnl Directory for XVMC libs
diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h
index b0541d52aed6584c63f2..0bc2cb9a7496a5b38d01 100644
--- a/include/EGL/eglplatform.h
+++ b/include/EGL/eglplatform.h
@@ -110,15 +110,7 @@ typedef intptr_t EGLNativeDisplayType;
 typedef intptr_t EGLNativeWindowType;
 typedef intptr_t EGLNativePixmapType;
 
-#elif defined(__unix__) || defined(__APPLE__)
-
-#if defined(MESA_EGL_NO_X11_HEADERS)
-
-typedef void            *EGLNativeDisplayType;
-typedef khronos_uintptr_t EGLNativePixmapType;
-typedef khronos_uintptr_t EGLNativeWindowType;
-
-#else
+#elif defined(__unix__) || defined(USE_X11)
 
 /* X11 (tentative)  */
 #include <X11/Xlib.h>
@@ -128,7 +120,11 @@ typedef Display *EGLNativeDisplayType;
 typedef Pixmap   EGLNativePixmapType;
 typedef Window   EGLNativeWindowType;
 
-#endif /* MESA_EGL_NO_X11_HEADERS */
+#elif defined(__APPLE__)
+
+typedef int   EGLNativeDisplayType;
+typedef void *EGLNativeWindowType;
+typedef void *EGLNativePixmapType;
 
 #elif defined(__HAIKU__)
 
diff --git a/meson.build b/meson.build
index 160bbfa30ba8b2f7c547..26271ae3491389eefa8c 100644
--- a/meson.build
+++ b/meson.build
@@ -638,9 +638,8 @@ if with_platform_x11
       pre_args += '-DGLX_USE_WINDOWSGL'
     endif
   endif
-else
-  pre_args += '-DMESA_EGL_NO_X11_HEADERS'
-  gl_pkgconfig_c_flags += '-DMESA_EGL_NO_X11_HEADERS'
+  pre_args += '-DUSE_X11'
+  gl_pkgconfig_c_flags += '-DUSE_X11'
 endif
 if with_platform_drm
   if with_egl and not with_gbm
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list