Older versions of Mesa provided header definitions for the
EGL_WL_bind_wayland_display extension, but an earlier version of the
extension which only provided the (un)bind entrypoints, and not
QueryWaylandBuffer. Detect this half-provision and make sure we export
the QueryWaylandBuffer definitions as well.

Fixes build failure with EGL on Ubuntu 12.04.

Signed-off-by: Daniel Stone <[email protected]>
---
 src/weston-egl-ext.h | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/weston-egl-ext.h b/src/weston-egl-ext.h
index 4888323..145322b 100644
--- a/src/weston-egl-ext.h
+++ b/src/weston-egl-ext.h
@@ -33,6 +33,29 @@
 #ifndef EGL_WL_bind_wayland_display
 #define EGL_WL_bind_wayland_display 1
 
+struct wl_display;
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglBindWaylandDisplayWL(EGLDisplay dpy, struct 
wl_display *display);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct 
wl_display *display);
+#endif
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, 
struct wl_display *display);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWL) (EGLDisplay 
dpy, struct wl_display *display);
+#endif
+
+/*
+ * This is a little different to the tests shipped with EGL implementations,
+ * which wrap the entire thing in #ifndef EGL_WL_bind_wayland_display, then go
+ * on to define both BindWaylandDisplay and QueryWaylandBuffer.
+ *
+ * Unfortunately, some implementations (particularly the version of Mesa 
shipped
+ * in Ubuntu 12.04) define EGL_WL_bind_wayland_display, but then only provide
+ * prototypes for (Un)BindWaylandDisplay, completely omitting
+ * QueryWaylandBuffer.
+ *
+ * Detect this, and provide our own definitions if necessary.
+ */
+#ifndef EGL_WAYLAND_BUFFER_WL
 #define EGL_WAYLAND_BUFFER_WL          0x31D5 /* eglCreateImageKHR target */
 #define EGL_WAYLAND_PLANE_WL           0x31D6 /* eglCreateImageKHR target */
 
@@ -41,15 +64,10 @@
 #define EGL_TEXTURE_Y_XUXV_WL           0x31D9
 #define EGL_TEXTURE_EXTERNAL_WL         0x31DA
 
-struct wl_display;
 struct wl_resource;
 #ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglBindWaylandDisplayWL(EGLDisplay dpy, struct 
wl_display *display);
-EGLAPI EGLBoolean EGLAPIENTRY eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct 
wl_display *display);
 EGLAPI EGLBoolean EGLAPIENTRY eglQueryWaylandBufferWL(EGLDisplay dpy, struct 
wl_resource *buffer, EGLint attribute, EGLint *value);
 #endif
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, 
struct wl_display *display);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWL) (EGLDisplay 
dpy, struct wl_display *display);
 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYWAYLANDBUFFERWL) (EGLDisplay dpy, 
struct wl_resource *buffer, EGLint attribute, EGLint *value);
 #endif
 
-- 
2.1.0

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to