[PATCH weston 4/4] clients & tests: use eglCreatePlatformWindowSurfaceEXT when supported

Pekka Paalanen ppaalanen at gmail.com
Mon Mar 23 03:53:18 PDT 2015


On Fri, 20 Mar 2015 15:26:53 +0100
Jonny Lamb <jonny.lamb at collabora.co.uk> wrote:

> Reviewed-by: Derek Foreman <derekf at osg.samsung.com>
> Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>
> ---
>  clients/nested-client.c   |  7 +++----
>  clients/simple-egl.c      |  7 ++++---
>  clients/subsurfaces.c     |  6 +++---
>  clients/window.c          |  8 ++++----
>  shared/platform.h         | 23 +++++++++++++++++++++++
>  tests/buffer-count-test.c |  7 +++----
>  6 files changed, 40 insertions(+), 18 deletions(-)
> 

> 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 @@ 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)

It returns an EGLSurface, so calling it create_egl_surface would have
been more logical. ;-)

EGL window is sort of a wayland-egl.h concept, wl_egl_window.

> +{
> +#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
> diff --git a/tests/buffer-count-test.c b/tests/buffer-count-test.c
> index 815e1cc..23cbc6e 100644
> --- a/tests/buffer-count-test.c
> +++ b/tests/buffer-count-test.c
> @@ -95,10 +95,9 @@ init_egl(struct test_data *test_data)
>  				     surface->width,
>  				     surface->height);
>  	test_data->egl_surface =
> -		eglCreateWindowSurface(test_data->egl_dpy,
> -				       test_data->egl_conf,
> -				       (EGLNativeWindowType) native_window,
> -				       NULL);
> +		weston_platform_create_egl_window(test_data->egl_dpy,
> +						  test_data->egl_conf,
> +						  native_window, NULL);
>  
>  	ret = eglMakeCurrent(test_data->egl_dpy, test_data->egl_surface,
>  			     test_data->egl_surface, test_data->egl_ctx);

All in all, the series looks fine to me. Just some build fixes are
likely needed to account for the less common builds like --disable-egl.

Again, sorry for being so late in looking at this.


Thanks,
pq


More information about the wayland-devel mailing list