Move weston_output EGL state into gles2-renderer.
This introduces callbacks for output creation and destruction for the
gles2-renderer. This enables the gles2-renderer to have per-output
state. EGL surface creation is now done by the output_create callback
and the EGL surface is stored in the new per-output gles2-renderer
state. On the first output_create call, the gles2-renderer will setup
it's GL context. This is because EGL requires a EGL surface to be able
to use the GL context.
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 56759fc..db97713 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -317,9 +317,9 @@
wayland_output_destroy(struct weston_output *output_base)
{
struct wayland_output *output = (struct wayland_output *) output_base;
- struct weston_compositor *ec = output->base.compositor;
- eglDestroySurface(ec->egl_display, output->base.egl_surface);
+ gles2_renderer_output_destroy(output_base);
+
wl_egl_window_destroy(output->parent.egl_window);
free(output);
@@ -373,13 +373,9 @@
goto cleanup_output;
}
- output->base.egl_surface =
- eglCreateWindowSurface(c->base.egl_display, c->base.egl_config,
- output->parent.egl_window, NULL);
- if (!output->base.egl_surface) {
- weston_log("failed to create window surface\n");
+ if (gles2_renderer_output_create(&output->base,
+ output->parent.egl_window) < 0)
goto cleanup_window;
- }
output->parent.shell_surface =
wl_shell_get_shell_surface(c->parent.shell,
@@ -846,10 +842,6 @@
if (wayland_compositor_create_output(c, width, height) < 0)
goto err_display;
- /* requires wayland_compositor_create_output */
- if (gles2_renderer_init(&c->base) < 0)
- goto err_display;
-
/* requires gles2_renderer_init */
create_border(c);