diff options
Diffstat (limited to 'backend/drm/backend.c')
-rw-r--r-- | backend/drm/backend.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c index da7ca1e4..769a4a5c 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -6,7 +6,6 @@ #include "backend/drm/backend.h" #include "backend/drm/drm.h" -#include "backend/drm/event.h" #include "backend/drm/session.h" #include "backend/drm/udev.h" #include "common/log.h" @@ -19,12 +18,18 @@ struct wlr_drm_backend *wlr_drm_backend_init(void) return NULL; } + backend->event_loop = wl_event_loop_create(); + if (!backend->event_loop) { + wlr_log(L_ERROR, "Failed to create event loop"); + goto error_backend; + } + if (!wlr_session_start(&backend->session)) { wlr_log(L_ERROR, "Failed to start session"); - goto error; + goto error_loop; } - if (!wlr_udev_init(&backend->udev)) { + if (!wlr_udev_init(backend)) { wlr_log(L_ERROR, "Failed to start udev"); goto error_session; } @@ -40,6 +45,10 @@ struct wlr_drm_backend *wlr_drm_backend_init(void) goto error_fd; } + wl_signal_init(&backend->signals.display_add); + wl_signal_init(&backend->signals.display_rem); + wl_signal_init(&backend->signals.display_render); + wlr_drm_scan_connectors(backend); return backend; @@ -50,7 +59,9 @@ error_udev: wlr_udev_free(&backend->udev); error_session: wlr_session_end(&backend->session); -error: +error_loop: + wl_event_loop_destroy(backend->event_loop); +error_backend: free(backend); return NULL; } @@ -69,7 +80,9 @@ void wlr_drm_backend_free(struct wlr_drm_backend *backend) wlr_session_release_device(&backend->session, backend->fd); wlr_session_end(&backend->session); - free(backend->events); + wl_event_source_remove(backend->event_src.drm); + wl_event_loop_destroy(backend->event_loop); + free(backend->displays); free(backend); } |