backend/drm: terminate display on drmHandleEvent failure

This commit is contained in:
Simon Ser 2021-04-14 22:41:44 +02:00 committed by Kenny Levinsen
parent 846e0838d6
commit 053ebe7c27

View file

@ -1506,12 +1506,17 @@ static void page_flip_handler(int fd, unsigned seq,
} }
int handle_drm_event(int fd, uint32_t mask, void *data) { int handle_drm_event(int fd, uint32_t mask, void *data) {
struct wlr_drm_backend *drm = data;
drmEventContext event = { drmEventContext event = {
.version = 3, .version = 3,
.page_flip_handler2 = page_flip_handler, .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; return 1;
} }
@ -1528,7 +1533,7 @@ void restore_drm_outputs(struct wlr_drm_backend *drm) {
time_t timeout = time(NULL) + 5; time_t timeout = time(NULL) + 5;
while (to_close && time(NULL) < timeout) { while (to_close && time(NULL) < timeout) {
handle_drm_event(drm->fd, 0, NULL); handle_drm_event(drm->fd, 0, drm);
size_t i = 0; size_t i = 0;
struct wlr_drm_connector *conn; struct wlr_drm_connector *conn;
wl_list_for_each(conn, &drm->outputs, link) { wl_list_for_each(conn, &drm->outputs, link) {