gl-renderer: use eglCreatePlatformWindowSurfaceEXT to get EGLSurfaces
Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
committed by
Bryce Harrington
parent
51a7ae5f89
commit
671148f064
@@ -1627,7 +1627,8 @@ drm_output_init_egl(struct drm_output *output, struct drm_compositor *ec)
|
|||||||
return -1;
|
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,
|
gl_renderer->opaque_attribs,
|
||||||
&format) < 0) {
|
&format) < 0) {
|
||||||
weston_log("failed to create gl renderer output state\n");
|
weston_log("failed to create gl renderer output state\n");
|
||||||
|
|||||||
@@ -568,7 +568,7 @@ fbdev_output_create(struct fbdev_compositor *compositor,
|
|||||||
} else {
|
} else {
|
||||||
setenv("HYBRIS_EGLPLATFORM", "wayland", 1);
|
setenv("HYBRIS_EGLPLATFORM", "wayland", 1);
|
||||||
if (gl_renderer->output_create(&output->base,
|
if (gl_renderer->output_create(&output->base,
|
||||||
(EGLNativeWindowType)NULL,
|
(EGLNativeWindowType)NULL, NULL,
|
||||||
gl_renderer->opaque_attribs,
|
gl_renderer->opaque_attribs,
|
||||||
NULL) < 0) {
|
NULL) < 0) {
|
||||||
weston_log("gl_renderer_output_create failed.\n");
|
weston_log("gl_renderer_output_create failed.\n");
|
||||||
|
|||||||
@@ -644,6 +644,7 @@ wayland_output_init_gl_renderer(struct wayland_output *output)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gl_renderer->output_create(&output->base,
|
if (gl_renderer->output_create(&output->base,
|
||||||
|
output->gl.egl_window,
|
||||||
output->gl.egl_window,
|
output->gl.egl_window,
|
||||||
gl_renderer->alpha_attribs,
|
gl_renderer->alpha_attribs,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
|
|||||||
@@ -904,8 +904,13 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/* eglCreatePlatformWindowSurfaceEXT takes a Window*
|
||||||
|
* but eglCreateWindowSurface takes a Window. */
|
||||||
|
Window xid = (Window) output->window;
|
||||||
|
|
||||||
ret = gl_renderer->output_create(&output->base,
|
ret = gl_renderer->output_create(&output->base,
|
||||||
(EGLNativeWindowType) output->window,
|
(EGLNativeWindowType) output->window,
|
||||||
|
&xid,
|
||||||
gl_renderer->opaque_attribs,
|
gl_renderer->opaque_attribs,
|
||||||
NULL);
|
NULL);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|||||||
+34
-5
@@ -140,6 +140,10 @@ struct gl_renderer {
|
|||||||
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage;
|
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef EGL_EXT_platform_base
|
||||||
|
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window;
|
||||||
|
#endif
|
||||||
|
|
||||||
int has_unpack_subimage;
|
int has_unpack_subimage;
|
||||||
|
|
||||||
PFNEGLBINDWAYLANDDISPLAYWL bind_display;
|
PFNEGLBINDWAYLANDDISPLAYWL bind_display;
|
||||||
@@ -1974,7 +1978,8 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface);
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
gl_renderer_output_create(struct weston_output *output,
|
gl_renderer_output_create(struct weston_output *output,
|
||||||
EGLNativeWindowType window,
|
EGLNativeWindowType window_for_legacy,
|
||||||
|
void *window_for_platform,
|
||||||
const EGLint *attribs,
|
const EGLint *attribs,
|
||||||
const EGLint *visual_id)
|
const EGLint *visual_id)
|
||||||
{
|
{
|
||||||
@@ -2001,10 +2006,19 @@ gl_renderer_output_create(struct weston_output *output,
|
|||||||
if (go == NULL)
|
if (go == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
go->egl_surface =
|
#ifdef EGL_EXT_platform_base
|
||||||
eglCreateWindowSurface(gr->egl_display,
|
if (gr->create_platform_window) {
|
||||||
egl_config,
|
go->egl_surface =
|
||||||
window, NULL);
|
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) {
|
if (go->egl_surface == EGL_NO_SURFACE) {
|
||||||
weston_log("failed to create egl surface\n");
|
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");
|
"supported. Performance could be affected.\n");
|
||||||
#endif
|
#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
|
#ifdef EGL_MESA_configless_context
|
||||||
if (strstr(extensions, "EGL_MESA_configless_context"))
|
if (strstr(extensions, "EGL_MESA_configless_context"))
|
||||||
gr->has_configless_context = 1;
|
gr->has_configless_context = 1;
|
||||||
|
|||||||
+2
-1
@@ -62,7 +62,8 @@ struct gl_renderer_interface {
|
|||||||
EGLDisplay (*display)(struct weston_compositor *ec);
|
EGLDisplay (*display)(struct weston_compositor *ec);
|
||||||
|
|
||||||
int (*output_create)(struct weston_output *output,
|
int (*output_create)(struct weston_output *output,
|
||||||
EGLNativeWindowType window,
|
EGLNativeWindowType window_for_legacy,
|
||||||
|
void *window_for_platform,
|
||||||
const EGLint *attribs,
|
const EGLint *attribs,
|
||||||
const EGLint *visual_id);
|
const EGLint *visual_id);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user