-
Notifications
You must be signed in to change notification settings - Fork 144
Expose libWayland wl_display_set_default_max_buffer_size function. #815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This is necessary to increase on higher-end systems (high polling rate hardware/high refresh-rate) to avoid crashing some apps that cannot keep up with the event loop momentarily
I guess we probably need something like this in the ( I also see in that function |
Most of those functions are for libwayland internal, called automatically when a new client connects, except for Right now I don't have time to dig into exact protocol, and how buffers are used, I just wanted to fix this bug in Niri (tested and works). If needed, I can dig into this protocol much deeper and add the patch to the rust backend too after my exams. |
Yeah, the It looks like there are 3 public functions related to this in libwayland:
Though I don't know how commonly the latter two are used. If the |
There is no such behavior (or I don't see it), and even if there was, I would avoid doing it: an unlimited buffer and a frozen app is practically a memory leak. 1MB buffer is enough to be frozen for 1 minute with a 1khz polling rate mouse. If that's not enough, at a point it is better to just kill a dead connection. |
I looked into the rust wayland implemntation (the one contained in this repo) and I was kinda horrified. Allocating bigger buffers for each client with the current behavior will just slow down everything, and may be more than what we should allocate. To make rust wayland have the same default buffer size feature as libwayland has, a lot more work is needed, not just a few exposed function, but actual rewrites of the buffer implementation. And if possible, I would like to keep that refactor out of this PR (simply for merging it faster so Niri can use the feature right away). I see a few options on how we should do the refactoring:
|
This is necessary to increase on higher-end systems (high polling rate hardware/high refresh-rate) to avoid crashing some apps that cannot keep up with the event loop momentarily.
For example, if a mouse has 1000 Hz polling rate (and one pointer event is 20 bytes), it takes only 200 ms to overflow the default, 4 kB buffer. This is not uncommon for an app to fail to receive events when something is loading. (personally it is an issue with Minecraft)
I need this patch upstream in Niri