diff options
author | Michel Dänzer <[email protected]> | 2020-07-02 18:49:26 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-07-03 09:55:50 +0000 |
commit | 31392f837110f17c6037b4861056a891e078c083 (patch) | |
tree | 30c23a75e62e8dec2942a7f988c76089002aa875 /src | |
parent | 02d0b2d5604d4a9e0ddfa8234db4c92682de0e69 (diff) |
Revert "loader/dri3: Check for window destruction in dri3_wait_for_event_locked"
This reverts commit d7d7687829875e401690219d4a72458fb2bbe4de.
It caused freezes with e.g. kwin_x11 due to hitting the 1s timeout.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3214
Reopens: https://gitlab.freedesktop.org/mesa/mesa/-/issues/116
Acked-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5722>
Diffstat (limited to 'src')
-rw-r--r-- | src/loader/loader_dri3_helper.c | 38 | ||||
-rw-r--r-- | src/loader/loader_dri3_helper.h | 1 |
2 files changed, 1 insertions, 38 deletions
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c index 97b5182994a..425faba8f64 100644 --- a/src/loader/loader_dri3_helper.c +++ b/src/loader/loader_dri3_helper.c @@ -22,7 +22,6 @@ */ #include <fcntl.h> -#include <poll.h> #include <stdlib.h> #include <unistd.h> #include <string.h> @@ -533,55 +532,20 @@ dri3_wait_for_event_locked(struct loader_dri3_drawable *draw, xcb_generic_event_t *ev; xcb_present_generic_event_t *ge; - if (draw->window_destroyed) - return false; - xcb_flush(draw->conn); /* Only have one thread waiting for events at a time */ if (draw->has_event_waiter) { cnd_wait(&draw->event_cnd, &draw->mtx); - if (draw->window_destroyed) - return false; if (full_sequence) *full_sequence = draw->last_special_event_sequence; /* Another thread has updated the protected info, so retest. */ return true; } else { - struct pollfd pfds; - draw->has_event_waiter = true; /* Allow other threads access to the drawable while we're waiting. */ mtx_unlock(&draw->mtx); - - pfds.fd = xcb_get_file_descriptor(draw->conn); - pfds.events = POLLIN; - - ev = xcb_poll_for_special_event(draw->conn, draw->special_event); - while (!ev) { - /* Wait up to ~1s for the XCB FD to become readable */ - if (poll(&pfds, 1, 1000) < 1) { - xcb_get_window_attributes_cookie_t cookie; - xcb_get_window_attributes_reply_t *attrib; - xcb_generic_error_t *error; - - /* Check if the window still exists */ - cookie = xcb_get_window_attributes(draw->conn, draw->drawable); - attrib = xcb_get_window_attributes_reply(draw->conn, cookie, &error); - free(attrib); - - if (error) { - if (error->error_code == BadWindow) - draw->window_destroyed = true; - - free(error); - break; - } - } - - ev = xcb_poll_for_special_event(draw->conn, draw->special_event); - } - + ev = xcb_wait_for_special_event(draw->conn, draw->special_event); mtx_lock(&draw->mtx); draw->has_event_waiter = false; cnd_broadcast(&draw->event_cnd); diff --git a/src/loader/loader_dri3_helper.h b/src/loader/loader_dri3_helper.h index 0961534a792..c314e4c5a9d 100644 --- a/src/loader/loader_dri3_helper.h +++ b/src/loader/loader_dri3_helper.h @@ -122,7 +122,6 @@ struct loader_dri3_drawable { uint8_t have_back; uint8_t have_fake_front; uint8_t is_pixmap; - bool window_destroyed; /* Information about the GPU owning the buffer */ __DRIscreen *dri_screen; |