-
Notifications
You must be signed in to change notification settings - Fork 51
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
Improvements to wayland backend, and build on FreeBSD #35
Conversation
- Use wayland-client `0.30.0-beta.14` - Use `memfd` instead of temporary file - Make sure buffer and buffer pool objects are destroyed
This was merged into https://github.com/rust-windowing/swbuf, which is now incorporated into this repository. |
"Failed to instantiate Wayland Shm", | ||
)?; | ||
let name = CStr::from_bytes_with_nul_unchecked("softbuffer\0".as_bytes()); | ||
let tempfile_fd = unwrap( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a fallback or else this only works on Freebsd and Linux. See sctk for the fallback.
surface, shm, tempfile, | ||
buffer: None | ||
impl WaylandImpl { | ||
pub unsafe fn new<W: HasRawWindowHandle>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should deny unsafe_op_in_unsafe_fn
in the whole crate.
_: &Connection, | ||
_: &QueueHandle<State>, | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to handle release in the future, this needs a todo comment.
globals.bind(&qh, 1..=1, ()), | ||
"Failed to instantiate Wayland Shm", | ||
)?; | ||
let name = CStr::from_bytes_with_nul_unchecked("softbuffer\0".as_bytes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this fail if a file of the same name exists?
let shm: wl_shm::WlShm = unwrap( | ||
globals.bind(&qh, 1..=1, ()), | ||
"Failed to instantiate Wayland Shm", | ||
)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do a roundtrip after this to ensure it is initialized.
self.buffer = Some(WaylandBuffer{ | ||
fn ensure_buffer_size(&mut self, width: i32, height: i32) { | ||
if !self.check_buffer_size_equals(width, height) { | ||
let pool = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause an fd leak, we don't destroy the old pool of it did exist.
)?; | ||
let name = CStr::from_bytes_with_nul_unchecked("softbuffer\0".as_bytes()); | ||
let tempfile_fd = unwrap( | ||
memfd_create(name, MemFdCreateFlag::MFD_CLOEXEC), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we seal the file if supported by the platform to be nice to compositors?
0.30.0-beta.14
memfd
instead of temporary file