diff mbox series

[3/3] egl_mesa_platform_surfaceless: Use EXT functions for surfaces

Message ID 1495062017-6955-3-git-send-email-daniel.diaz@linaro.org
State Accepted
Commit ebbb9c5dcc6a637884d54e06eb430a8c14993413
Headers show
Series [1/3] util/egl: Honour Surfaceless MESA in get_default_display | expand

Commit Message

Daniel Díaz May 17, 2017, 11 p.m. UTC
These EXT symbols are guaranteed to exist since they require
EGL_EXT_platform_base.

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
---
 .../egl_mesa_platform_surfaceless.c                | 23 ++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tests/egl/spec/egl_mesa_platform_surfaceless/egl_mesa_platform_surfaceless.c b/tests/egl/spec/egl_mesa_platform_surfaceless/egl_mesa_platform_surfaceless.c
index 81a3919..264ed71 100644
--- a/tests/egl/spec/egl_mesa_platform_surfaceless/egl_mesa_platform_surfaceless.c
+++ b/tests/egl/spec/egl_mesa_platform_surfaceless/egl_mesa_platform_surfaceless.c
@@ -24,6 +24,24 @@ 
 #include "piglit-util.h"
 #include "piglit-util-egl.h"
 
+/* Extension function pointers.
+ *
+ * Use prefix 'pegl' (piglit egl) instead of 'egl' to avoid collisions with
+ * prototypes in eglext.h. */
+EGLSurface (*peglCreatePlatformPixmapSurfaceEXT)(EGLDisplay display, EGLConfig config,
+	    NativePixmapType native_pixmap, const EGLint *attrib_list);
+EGLSurface (*peglCreatePlatformWindowSurfaceEXT)(EGLDisplay display, EGLConfig config,
+	    NativeWindowType native_window, const EGLint *attrib_list);
+
+static void
+init_egl_extension_funcs(void)
+{
+	peglCreatePlatformPixmapSurfaceEXT = (void*)
+		eglGetProcAddress("eglCreatePlatformPixmapSurfaceEXT");
+	peglCreatePlatformWindowSurfaceEXT = (void*)
+		eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
+}
+
 static void
 test_setup(EGLDisplay *dpy)
 {
@@ -72,7 +90,7 @@  test_create_window(void *test_data)
 
 	test_setup(&dpy);
 
-	surf = eglCreatePlatformWindowSurface(dpy, EGL_NO_CONFIG_KHR,
+	surf = peglCreatePlatformWindowSurfaceEXT(dpy, EGL_NO_CONFIG_KHR,
 					      /*native_window*/ NULL,
 					      /*attrib_list*/ NULL);
 	if (surf) {
@@ -103,7 +121,7 @@  test_create_pixmap(void *test_data)
 
 	test_setup(&dpy);
 
-	surf = eglCreatePlatformPixmapSurface(dpy, EGL_NO_CONFIG_KHR,
+	surf = peglCreatePlatformPixmapSurfaceEXT(dpy, EGL_NO_CONFIG_KHR,
 					      /*native_window*/ NULL,
 					      /*attrib_list*/ NULL);
 	if (surf) {
@@ -205,6 +223,7 @@  main(int argc, char **argv)
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
+	init_egl_extension_funcs();
 	result = piglit_run_selected_subtests(subtests, selected_names,
 					      num_selected, result);
 	piglit_report_result(result);