summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2015-03-20 15:26:52 +0100
committerBryce Harrington <bryce@osg.samsung.com>2015-03-20 13:57:14 -0700
commit671148f0649d73011ca2e6b965d82381185fe3b0 (patch)
treed1ff49ec3f4f8a4cb446680c2fefe5269f02aa88 /src
parent51a7ae5f89e9504f49bd98c7cd714e66c2a35580 (diff)
gl-renderer: use eglCreatePlatformWindowSurfaceEXT to get EGLSurfaces
Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/compositor-drm.c3
-rw-r--r--src/compositor-fbdev.c2
-rw-r--r--src/compositor-wayland.c1
-rw-r--r--src/compositor-x11.c5
-rw-r--r--src/gl-renderer.c39
-rw-r--r--src/gl-renderer.h3
6 files changed, 45 insertions, 8 deletions
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 29f0f13b..450920e7 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1627,7 +1627,8 @@ drm_output_init_egl(struct drm_output *output, struct drm_compositor *ec)
return -1;
}
- if (gl_renderer->output_create(&output->base, output->surface,
+ if (gl_renderer->output_create(&output->base,
+ output->surface, output->surface,
gl_renderer->opaque_attribs,
&format) < 0) {
weston_log("failed to create gl renderer output state\n");
diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
index 6e541e89..b71affb8 100644
--- a/src/compositor-fbdev.c
+++ b/src/compositor-fbdev.c
@@ -568,7 +568,7 @@ fbdev_output_create(struct fbdev_compositor *compositor,
} else {
setenv("HYBRIS_EGLPLATFORM", "wayland", 1);
if (gl_renderer->output_create(&output->base,
- (EGLNativeWindowType)NULL,
+ (EGLNativeWindowType)NULL, NULL,
gl_renderer->opaque_attribs,
NULL) < 0) {
weston_log("gl_renderer_output_create failed.\n");
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index b6fd37d1..4f792b14 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -645,6 +645,7 @@ wayland_output_init_gl_renderer(struct wayland_output *output)
if (gl_renderer->output_create(&output->base,
output->gl.egl_window,
+ output->gl.egl_window,
gl_renderer->alpha_attribs,
NULL) < 0)
goto cleanup_window;
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index a435daf9..5654c505 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -904,8 +904,13 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
return NULL;
}
} else {
+ /* eglCreatePlatformWindowSurfaceEXT takes a Window*
+ * but eglCreateWindowSurface takes a Window. */
+ Window xid = (Window) output->window;
+
ret = gl_renderer->output_create(&output->base,
(EGLNativeWindowType) output->window,
+ &xid,
gl_renderer->opaque_attribs,
NULL);
if (ret < 0)
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
index e598d1e9..d4e8f1ef 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -140,6 +140,10 @@ struct gl_renderer {
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage;
#endif
+#ifdef EGL_EXT_platform_base
+ PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window;
+#endif
+
int has_unpack_subimage;
PFNEGLBINDWAYLANDDISPLAYWL bind_display;
@@ -1974,7 +1978,8 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface);
static int
gl_renderer_output_create(struct weston_output *output,
- EGLNativeWindowType window,
+ EGLNativeWindowType window_for_legacy,
+ void *window_for_platform,
const EGLint *attribs,
const EGLint *visual_id)
{
@@ -2001,10 +2006,19 @@ gl_renderer_output_create(struct weston_output *output,
if (go == NULL)
return -1;
- go->egl_surface =
- eglCreateWindowSurface(gr->egl_display,
- egl_config,
- window, NULL);
+#ifdef EGL_EXT_platform_base
+ if (gr->create_platform_window) {
+ go->egl_surface =
+ gr->create_platform_window(gr->egl_display,
+ egl_config,
+ window_for_platform,
+ NULL);
+ } else
+#endif
+ go->egl_surface =
+ eglCreateWindowSurface(gr->egl_display,
+ egl_config,
+ window_for_legacy, NULL);
if (go->egl_surface == EGL_NO_SURFACE) {
weston_log("failed to create egl surface\n");
@@ -2124,6 +2138,21 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
"supported. Performance could be affected.\n");
#endif
+#ifdef EGL_EXT_platform_base
+ extensions =
+ (const char *) eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+ if (!extensions) {
+ weston_log("Retrieving EGL client extension string failed.\n");
+ return -1;
+ }
+
+ if (strstr(extensions, "EGL_EXT_platform_base"))
+ gr->create_platform_window =
+ (void *) eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
+ else
+ weston_log("warning: EGL_EXT_platform_base not supported.\n");
+#endif
+
#ifdef EGL_MESA_configless_context
if (strstr(extensions, "EGL_MESA_configless_context"))
gr->has_configless_context = 1;
diff --git a/src/gl-renderer.h b/src/gl-renderer.h
index bbf0ac61..c5550d1c 100644
--- a/src/gl-renderer.h
+++ b/src/gl-renderer.h
@@ -62,7 +62,8 @@ struct gl_renderer_interface {
EGLDisplay (*display)(struct weston_compositor *ec);
int (*output_create)(struct weston_output *output,
- EGLNativeWindowType window,
+ EGLNativeWindowType window_for_legacy,
+ void *window_for_platform,
const EGLint *attribs,
const EGLint *visual_id);