summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2015-03-20 15:26:53 +0100
committerBryce Harrington <bryce@osg.samsung.com>2015-03-20 13:57:24 -0700
commit4bdcb5732b431b7778eb0e419a49e4e4b5f5e8cb (patch)
tree11da88ea107c66bacf1a5fffea237bbd8a4f4593 /shared
parent671148f0649d73011ca2e6b965d82381185fe3b0 (diff)
clients & tests: use eglCreatePlatformWindowSurfaceEXT when supported
Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'shared')
-rw-r--r--shared/platform.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/shared/platform.h b/shared/platform.h
index 7f847fa2..fd06046b 100644
--- a/shared/platform.h
+++ b/shared/platform.h
@@ -34,6 +34,7 @@ extern "C" {
#ifdef EGL_EXT_platform_base
static PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display_ext = NULL;
+static PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window_surface_ext = NULL;
#ifndef EGL_PLATFORM_WAYLAND_KHR
#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
@@ -51,6 +52,8 @@ weston_platform_get_egl_proc_addresses(void)
|| strstr(extensions, "EGL_KHR_platform_wayland")) {
get_platform_display_ext =
(void *) eglGetProcAddress("eglGetPlatformDisplayEXT");
+ create_platform_window_surface_ext =
+ (void *) eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
}
}
#endif
@@ -72,6 +75,26 @@ weston_platform_get_egl_display(EGLenum platform, void *native_display,
return eglGetDisplay((EGLNativeDisplayType) native_display);
}
+static inline EGLSurface
+weston_platform_create_egl_window(EGLDisplay dpy, EGLConfig config,
+ void *native_window,
+ const EGLint *attrib_list)
+{
+#ifdef EGL_EXT_platform_base
+ if (!create_platform_window_surface_ext)
+ weston_platform_get_egl_proc_addresses();
+
+ if (create_platform_window_surface_ext)
+ return create_platform_window_surface_ext(dpy, config,
+ native_window,
+ attrib_list);
+#endif
+
+ return eglCreateWindowSurface(dpy, config,
+ (EGLNativeWindowType) native_window,
+ attrib_list);
+}
+
#ifdef __cplusplus
}
#endif