From 053ebe7c278ba1e5a0c8c9f5559db23fad5a9eba Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 14 Apr 2021 22:41:44 +0200 Subject: backend/drm: terminate display on drmHandleEvent failure --- backend/drm/drm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 032623fa..f064c184 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -1506,12 +1506,17 @@ static void page_flip_handler(int fd, unsigned seq, } int handle_drm_event(int fd, uint32_t mask, void *data) { + struct wlr_drm_backend *drm = data; + drmEventContext event = { .version = 3, .page_flip_handler2 = page_flip_handler, }; - drmHandleEvent(fd, &event); + if (drmHandleEvent(fd, &event) != 0) { + wlr_log(WLR_ERROR, "drmHandleEvent failed"); + wl_display_terminate(drm->display); + } return 1; } @@ -1528,7 +1533,7 @@ void restore_drm_outputs(struct wlr_drm_backend *drm) { time_t timeout = time(NULL) + 5; while (to_close && time(NULL) < timeout) { - handle_drm_event(drm->fd, 0, NULL); + handle_drm_event(drm->fd, 0, drm); size_t i = 0; struct wlr_drm_connector *conn; wl_list_for_each(conn, &drm->outputs, link) { -- cgit v1.2.3