aboutsummaryrefslogtreecommitdiff
path: root/backend/drm/drm.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-04-14 22:41:44 +0200
committerKenny Levinsen <kl@kl.wtf>2021-04-14 23:56:56 +0200
commit053ebe7c278ba1e5a0c8c9f5559db23fad5a9eba (patch)
treed26f43f41e84c49d9f7ebe5b304f2eff88441da4 /backend/drm/drm.c
parent846e0838d658bdd4f03628396ba83fd5bba74320 (diff)
backend/drm: terminate display on drmHandleEvent failure
Diffstat (limited to 'backend/drm/drm.c')
-rw-r--r--backend/drm/drm.c9
1 files 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) {