mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-02-24 01:40:28 -05:00
xwayland: try flushing immediately in xwm_schedule_flush()
wl_event_source_fd_update() goes through another event loop cycle, which
delays writes. This extra cycle was introduced in 6ada67da9b
("xwayland/xwm: implement somewhat asynchronous request flushing").
Try flushing the X11 WM FD immediately if we can.
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/4044
This commit is contained in:
parent
7cb4e30bfd
commit
90f9f59041
1 changed files with 16 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <drm_fourcc.h>
|
#include <drm_fourcc.h>
|
||||||
|
#include <poll.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wlr/types/wlr_buffer.h>
|
#include <wlr/types/wlr_buffer.h>
|
||||||
|
|
@ -2881,5 +2882,20 @@ xcb_connection_t *wlr_xwayland_get_xwm_connection(
|
||||||
}
|
}
|
||||||
|
|
||||||
void xwm_schedule_flush(struct wlr_xwm *xwm) {
|
void xwm_schedule_flush(struct wlr_xwm *xwm) {
|
||||||
|
struct pollfd pollfd = {
|
||||||
|
.fd = xcb_get_file_descriptor(xwm->xcb_conn),
|
||||||
|
.events = POLLOUT,
|
||||||
|
};
|
||||||
|
if (poll(&pollfd, 1, 0) < 0) {
|
||||||
|
wlr_log(WLR_ERROR, "poll() failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we can write immediately, do so
|
||||||
|
if (pollfd.revents & POLLOUT) {
|
||||||
|
xcb_flush(xwm->xcb_conn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
wl_event_source_fd_update(xwm->event_source, WL_EVENT_READABLE | WL_EVENT_WRITABLE);
|
wl_event_source_fd_update(xwm->event_source, WL_EVENT_READABLE | WL_EVENT_WRITABLE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue