clients & tests: use eglCreatePlatformWindowSurfaceEXT when supported

Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
diff --git a/shared/platform.h b/shared/platform.h
index 7f847fa..fd06046 100644
--- a/shared/platform.h
+++ b/shared/platform.h
@@ -34,6 +34,7 @@
 
 #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 @@
 		    || 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 @@
 		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