[PATCH weston 4/7] compositor-drm: Delay egl initialization until all outputs are created
Ander Conselvan de Oliveira
ander.conselvan.de.oliveira at intel.com
Tue Jan 22 08:07:12 PST 2013
---
src/compositor-drm.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 449106e..0f455ba 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1047,8 +1047,13 @@ init_drm(struct drm_compositor *ec, struct udev_device *device)
}
static int
+drm_output_init_egl(struct drm_output *output, struct drm_compositor *ec);
+
+static int
init_egl(struct drm_compositor *ec)
{
+ struct drm_output *output;
+
ec->gbm = gbm_create_device(ec->drm.fd);
if (gl_renderer_create(&ec->base, ec->gbm, gl_renderer_opaque_attribs,
@@ -1057,6 +1062,14 @@ init_egl(struct drm_compositor *ec)
return -1;
}
+ wl_list_for_each(output, &ec->base.output_list, base.link)
+ if (drm_output_init_egl(output, ec) < 0) {
+ weston_log("Failed to init egl state for output %s\n",
+ output->name);
+ weston_output_destroy(&output->base);
+ wl_list_remove(&output->base.link);
+ }
+
return 0;
}
@@ -1421,11 +1434,6 @@ create_output_for_connector(struct drm_compositor *ec,
connector->mmWidth, connector->mmHeight,
o ? o->transform : WL_OUTPUT_TRANSFORM_NORMAL);
- if (drm_output_init_egl(output, ec) < 0) {
- weston_log("Failed to init output gl state\n");
- goto err_output;
- }
-
output->backlight = backlight_init(drm_device,
connector->connector_type);
if (output->backlight) {
@@ -1459,8 +1467,6 @@ create_output_for_connector(struct drm_compositor *ec,
return 0;
-err_output:
- weston_output_destroy(&output->base);
err_free:
wl_list_for_each_safe(drm_mode, next, &output->base.mode_list,
base.link) {
@@ -2249,11 +2255,6 @@ drm_compositor_create(struct wl_display *display,
goto err_udev_dev;
}
- if (init_egl(ec) < 0) {
- weston_log("failed to initialize egl\n");
- goto err_udev_dev;
- }
-
ec->base.destroy = drm_destroy;
ec->base.restore = drm_restore;
@@ -2274,6 +2275,11 @@ drm_compositor_create(struct wl_display *display,
goto err_sprite;
}
+ if (init_egl(ec) < 0) {
+ weston_log("failed to initialize egl\n");
+ goto err_udev_dev;
+ }
+
path = NULL;
evdev_input_create(&ec->base, ec->udev, seat);
--
1.7.10.4
More information about the wayland-devel
mailing list