Skip to content

backend: set_max_buffer_size/set_default_max_buffer_size methods, on rs backend and libwayland 1.23+#855

Merged
ids1024 merged 10 commits intomasterfrom
max-buffer-size
Mar 5, 2026
Merged

backend: set_max_buffer_size/set_default_max_buffer_size methods, on rs backend and libwayland 1.23+#855
ids1024 merged 10 commits intomasterfrom
max-buffer-size

Conversation

@ids1024
Copy link
Member

@ids1024 ids1024 commented Dec 30, 2025

Adds a test and rs backend implementation for the function added in #815, based on top of #851.

I still want to add bindings (and rs impls) corresponding to wl_display_set_max_buffer_size and wl_client_set_max_buffer_size, but that shouldn't be hard. The main thing is adding support to the rs backend, and verifying consistent behavior.

We'll need add rounding to the rs backend like get_max_size_bits_for_size in libwayland. Maybe it would be best to use NonZeroUsize in the server and Option<NonZeroUsize> in the client, to express that unbounded buffering is an option, but only in the client...

@ids1024
Copy link
Member Author

ids1024 commented Dec 30, 2025

Hm, I though it was safe to rely on https://gitlab.freedesktop.org/wayland/wayland/-/commit/d074d52902633d8700ce06b484508db0f8fba02b, since the commit is dated 2021, but it was only merged in 2024.

So like #735, we probably want to use Smithay/dlib#22.

@CoffeeImpliesCode
Copy link

is there any way I can help with this? (as mostly an outsider, although I have some Rust experience)

@ids1024
Copy link
Member Author

ids1024 commented Jan 27, 2026

If anyone has an idea why the CI for #851 is hanging or how to reproduce it locally (or a better way to implement the test) that would be helpful, though probably not an easy thing to help with for anyone not already familiar with the internals of wayland-rs.

The other thing is what we want to do with the fact this requires a new libwayland version.

  • Adding a feature flag will require a dlib replace with Allow attributes in macro invocations  dlib#22 (ping @elinorbgr)
    • Though that's a little annoying since without the client_system/server_system feature flag, we don't need a particular libwayland version, since it will use the rs.
      • For instance cosmic-comp has client_system but not server_system, and we probably want to be able to use this in the server code without a dependency on a new libwayland for the client code?
      • We can't really make the methods available if any(not(feature = "server_system"), feature = "wayland_version_whatever") since that isn't additive, as feature flags should be

Otherwise I don't really need help with some of the smaller things that need to be added here; I can just do those if these questions can be worked out, and those shouldn't take too long...

Edit: Oh, and wayland-client/wayland-server can't know if client_system/client_server are enabled in wayland-backend anyway.

@CoffeeImpliesCode
Copy link

It seems like @elinorbgr has left GitHub in 2024 though?

@olafmustafar
Copy link

@ids1024 Is there any way to continue developing this project without relying on dlib (maybe by forking or incorporating it)? As mentioned, @elinorbgr seems to have been inactive for some time now, so the project seems unmaintained.

@ids1024
Copy link
Member Author

ids1024 commented Feb 21, 2026

dlib has been transferred to the smithay Github org now, so that it should be possible to get dlib released soon. So that won't block things, anyway.

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
@ids1024
Copy link
Member Author

ids1024 commented Feb 26, 2026

I've released https://crates.io/crates/dlib/0.5.3, and I think I have a solution for how for to deal with libwayland version feature flags (used in #873), although there's not a perfect way to handle that and the two backends.

So this should be unblocked now.

ids1024 added 3 commits March 2, 2026 19:14
Matches `libwayland`. The name may otherwise be confusing since it only
applies to newly connected clients.
This test fails without the call to this method.
Allows wayland-rs to continue to work with `server_system` and an older
libwayland version.
@ids1024 ids1024 force-pushed the max-buffer-size branch 3 times, most recently from 7fcdc87 to 8c27dbc Compare March 3, 2026 03:38
@ids1024
Copy link
Member Author

ids1024 commented Mar 3, 2026

Adding a feature flag and testing on CI with an older and newer libwayland version seems to work.

ids1024 added 2 commits March 3, 2026 18:58
This should match `libwayland`, and there should be no need to have a
larger buffer here. Once the buffer is full, it will have at least one
complete message.
This is in addition to the `set_default_max_buffer_size()` previously
added to the server API.
@ids1024 ids1024 changed the title WIP Configurable maximum buffer size backend: set_max_buffer_size/set_default_max_buffer_size methods, on rs backend and libwayland 1.23+ Mar 5, 2026
@ids1024 ids1024 marked this pull request as ready for review March 5, 2026 00:26
@ids1024 ids1024 merged commit b65a9f0 into master Mar 5, 2026
17 checks passed
@ids1024 ids1024 deleted the max-buffer-size branch March 5, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants