The X11 backend used System-V shared memory to communicate shared
buffers to the server, but rustix does not support SysV SHM so we had to
use libc in this backend. However, there is an alternate X11 API which
uses POSIX shared memory, which rustix does support. This PR switches
the X11 backend to POSIX shared memory and purges the previous
usages of libc.
The goal is to remove libc totally. Therefore this PR also removes the
default libc dependency from rustix.
Signed-off-by: John Nunley <dev@notgull.net>
Partly addresses
https://github.com/rust-windowing/softbuffer/issues/147, though it would
still be desirable to have a good safe API for SYSV shm in Rustix. But
using `libc` directly for now is no worse than using the `nix::libc`
re-export, so we don't lose anything.
Softbuffer is broken on recent builds of Redox without the fix here, so
it's helpful to have a new release that fixes it. We seem to have
accumulated a few non-breaking fixes, so it seems like a good enough
time to do a release anyway.
Disabling `fetch` on Windows could be considered breaking, but it
doesn't change the API, was broken anyway, and is likely unused. So I
don't think that's an issue.
This adds a DRM/KMS based backend to the system, as per #42. This system finds a CRTC and a connector, then uses that to create a frame buffer and a DUMB buffer that it can render to.
There's much more to do, and is left as an exercise for anyone with a significant DRM-based use case to pick up and fix.
Signed-off-by: John Nunley <dev@notgull.net>
My new tiny-xlib crate takes up a fraction of the space that the x11-dl crate uses, supports
feature-based static linking and involves less of Xlib's ridiculous surface.
* On MacOS, the contents scale is updated when set_buffer() is called, to adapt when the window is on a new screen (#68).
* **Breaking:** Split the `GraphicsContext` type into `Context` and `Surface` (#64).
* On Web, cache the document in the `Context` type (#66).
* **Breaking:** Introduce a new "owned buffer" for no-copy presentation (#65).
* Enable support for multi-threaded WASM (#77).
* Fix buffer resizing on X11 (#69).
* Add a set of functions for handling buffer damage (#99).
* Add a `fetch()` function for getting the window contents (#104).
* Bump MSRV to 1.64 (#81).
This function is useful for testing the window contents in certain cases. In addition,
this means that we can now have reliable tests for softbuffer's actual functionality.
Signed-off-by: John Nunley <jtnunley01@gmail.com>
Co-authored-by: dAxpeDDa <daxpedda@gmail.com>
This is based on the API that will be used for no-copy presentation. But
wraps it in `set_buffer`.
This also fixes the Wayland buffer code to set `self.width` and
`self.height` on resize, and set the length of the shared memory file
when the buffer is created.
Co-authored-by: jtnunley <jtnunley01@gmail.com>
Using the latest `winit` version in examples fixes resizing behavior on
Wayland, so the workaround for that in the `winit` example is also
removed here.
This adds a fallback using `shm_open`/`shm_unlink` for platforms where
`memfd_create` doesn't exist. This seems to be how this is normally
handled, though it's a bit ugly.
This also builds the wayland/x11 code for NetBSD/OpenBSD/DragonFlyBSD.
Add CI builds for FreeBSD and NetBSD. We would need some kind of
virtualisation though to actually run tests on such targets.
I've tested the `shm_open` logic on Linux, but haven't run it on any
BSDs.
Previously, `softbuffer` wouldn't successfully build on its own on Windows; the examples only worked because dependencies happened to enable the needed features.