clients & tests: use eglCreatePlatformWindowSurfaceEXT when supported
Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
parent
671148f064
commit
4bdcb5732b
@ -307,10 +307,9 @@ nested_client_create(void)
|
||||
client->native = wl_egl_window_create(client->surface,
|
||||
client->width, client->height);
|
||||
|
||||
client->egl_surface =
|
||||
eglCreateWindowSurface(client->egl_display,
|
||||
client->egl_config,
|
||||
client->native, NULL);
|
||||
client->egl_surface = weston_platform_create_egl_window (client->egl_display,
|
||||
client->egl_config,
|
||||
client->native, NULL);
|
||||
|
||||
eglMakeCurrent(client->egl_display, client->egl_surface,
|
||||
client->egl_surface, client->egl_context);
|
||||
|
@ -386,9 +386,10 @@ create_surface(struct window *window)
|
||||
window->geometry.width,
|
||||
window->geometry.height);
|
||||
window->egl_surface =
|
||||
eglCreateWindowSurface(display->egl.dpy,
|
||||
display->egl.conf,
|
||||
window->native, NULL);
|
||||
weston_platform_create_egl_window(display->egl.dpy,
|
||||
display->egl.conf,
|
||||
window->native, NULL);
|
||||
|
||||
|
||||
if (display->shell) {
|
||||
create_xdg_surface(window, display);
|
||||
|
@ -422,9 +422,9 @@ triangle_create_egl_surface(struct triangle *tri, int width, int height)
|
||||
|
||||
tri->wl_surface = widget_get_wl_surface(tri->widget);
|
||||
tri->egl_window = wl_egl_window_create(tri->wl_surface, width, height);
|
||||
tri->egl_surface = eglCreateWindowSurface(tri->egl->dpy,
|
||||
tri->egl->conf,
|
||||
tri->egl_window, NULL);
|
||||
tri->egl_surface = weston_platform_create_egl_window(tri->egl->dpy,
|
||||
tri->egl->conf,
|
||||
tri->egl_window, NULL);
|
||||
|
||||
ret = eglMakeCurrent(tri->egl->dpy, tri->egl_surface,
|
||||
tri->egl_surface, tri->egl->ctx);
|
||||
|
@ -640,10 +640,10 @@ egl_window_surface_create(struct display *display,
|
||||
rectangle->width,
|
||||
rectangle->height);
|
||||
|
||||
surface->egl_surface = eglCreateWindowSurface(display->dpy,
|
||||
display->argb_config,
|
||||
surface->egl_window,
|
||||
NULL);
|
||||
surface->egl_surface =
|
||||
weston_platform_create_egl_window(display->dpy,
|
||||
display->argb_config,
|
||||
surface->egl_window, NULL);
|
||||
|
||||
surface->cairo_surface =
|
||||
cairo_gl_surface_create_for_egl(display->argb_device,
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user