clients & tests: use eglCreatePlatformWindowSurfaceEXT when supported

Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
dev
Jonny Lamb 10 years ago committed by Bryce Harrington
parent 671148f064
commit 4bdcb5732b
  1. 3
      clients/nested-client.c
  2. 3
      clients/simple-egl.c
  3. 2
      clients/subsurfaces.c
  4. 6
      clients/window.c
  5. 23
      shared/platform.h
  6. 5
      tests/buffer-count-test.c

@ -307,8 +307,7 @@ nested_client_create(void)
client->native = wl_egl_window_create(client->surface, client->native = wl_egl_window_create(client->surface,
client->width, client->height); client->width, client->height);
client->egl_surface = client->egl_surface = weston_platform_create_egl_window (client->egl_display,
eglCreateWindowSurface(client->egl_display,
client->egl_config, client->egl_config,
client->native, NULL); client->native, NULL);

@ -386,10 +386,11 @@ create_surface(struct window *window)
window->geometry.width, window->geometry.width,
window->geometry.height); window->geometry.height);
window->egl_surface = window->egl_surface =
eglCreateWindowSurface(display->egl.dpy, weston_platform_create_egl_window(display->egl.dpy,
display->egl.conf, display->egl.conf,
window->native, NULL); window->native, NULL);
if (display->shell) { if (display->shell) {
create_xdg_surface(window, display); create_xdg_surface(window, display);
} else if (display->ivi_application ) { } else if (display->ivi_application ) {

@ -422,7 +422,7 @@ triangle_create_egl_surface(struct triangle *tri, int width, int height)
tri->wl_surface = widget_get_wl_surface(tri->widget); tri->wl_surface = widget_get_wl_surface(tri->widget);
tri->egl_window = wl_egl_window_create(tri->wl_surface, width, height); tri->egl_window = wl_egl_window_create(tri->wl_surface, width, height);
tri->egl_surface = eglCreateWindowSurface(tri->egl->dpy, tri->egl_surface = weston_platform_create_egl_window(tri->egl->dpy,
tri->egl->conf, tri->egl->conf,
tri->egl_window, NULL); tri->egl_window, NULL);

@ -640,10 +640,10 @@ egl_window_surface_create(struct display *display,
rectangle->width, rectangle->width,
rectangle->height); rectangle->height);
surface->egl_surface = eglCreateWindowSurface(display->dpy, surface->egl_surface =
weston_platform_create_egl_window(display->dpy,
display->argb_config, display->argb_config,
surface->egl_window, surface->egl_window, NULL);
NULL);
surface->cairo_surface = surface->cairo_surface =
cairo_gl_surface_create_for_egl(display->argb_device, cairo_gl_surface_create_for_egl(display->argb_device,

@ -34,6 +34,7 @@ extern "C" {
#ifdef EGL_EXT_platform_base #ifdef EGL_EXT_platform_base
static PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display_ext = NULL; static PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display_ext = NULL;
static PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window_surface_ext = NULL;
#ifndef EGL_PLATFORM_WAYLAND_KHR #ifndef EGL_PLATFORM_WAYLAND_KHR
#define EGL_PLATFORM_WAYLAND_KHR 0x31D8 #define EGL_PLATFORM_WAYLAND_KHR 0x31D8
@ -51,6 +52,8 @@ weston_platform_get_egl_proc_addresses(void)
|| strstr(extensions, "EGL_KHR_platform_wayland")) { || strstr(extensions, "EGL_KHR_platform_wayland")) {
get_platform_display_ext = get_platform_display_ext =
(void *) eglGetProcAddress("eglGetPlatformDisplayEXT"); (void *) eglGetProcAddress("eglGetPlatformDisplayEXT");
create_platform_window_surface_ext =
(void *) eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
} }
} }
#endif #endif
@ -72,6 +75,26 @@ weston_platform_get_egl_display(EGLenum platform, void *native_display,
return eglGetDisplay((EGLNativeDisplayType) 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 #ifdef __cplusplus
} }
#endif #endif

@ -95,10 +95,9 @@ init_egl(struct test_data *test_data)
surface->width, surface->width,
surface->height); surface->height);
test_data->egl_surface = test_data->egl_surface =
eglCreateWindowSurface(test_data->egl_dpy, weston_platform_create_egl_window(test_data->egl_dpy,
test_data->egl_conf, test_data->egl_conf,
(EGLNativeWindowType) native_window, native_window, NULL);
NULL);
ret = eglMakeCurrent(test_data->egl_dpy, test_data->egl_surface, ret = eglMakeCurrent(test_data->egl_dpy, test_data->egl_surface,
test_data->egl_surface, test_data->egl_ctx); test_data->egl_surface, test_data->egl_ctx);

Loading…
Cancel
Save