From 962a2f1670d8514e8c6e1be3bf738c8c45626c1d Mon Sep 17 00:00:00 2001 From: Vasilito Date: Wed, 6 May 2026 13:20:02 +0100 Subject: [PATCH] fix: DRM flip re-opens /scheme/drm/card0 instead of try_clone Scheme files on Redox don't support try_clone(). Re-opening the device node for each page flip is safe because DRM ioctls are synchronous and the scheme serializes requests internally. --- .../wayland/redbear-compositor/source/src/main.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/local/recipes/wayland/redbear-compositor/source/src/main.rs b/local/recipes/wayland/redbear-compositor/source/src/main.rs index 472d8ac7c..cadb8d87b 100644 --- a/local/recipes/wayland/redbear-compositor/source/src/main.rs +++ b/local/recipes/wayland/redbear-compositor/source/src/main.rs @@ -163,11 +163,14 @@ mod drm_backend { let cur = self.current.load(Ordering::Relaxed); let next = (cur + 1) % self.fb_ids.len(); let fb_id = self.fb_ids[next]; - let mut f = self.file.try_clone().ok(); - if let Some(ref mut f) = f { - let mut buf = Vec::with_capacity(12); - buf.extend_from_slice(&(DRM_IOCTL_MODE_PAGE_FLIP as u64).to_le_bytes()); - buf.extend_from_slice(&fb_id.to_le_bytes()); + // Page flip: write [u64_le ioctl][u32_le fb_id] to scheme + let mut buf = Vec::with_capacity(12); + buf.extend_from_slice(&(DRM_IOCTL_MODE_PAGE_FLIP as u64).to_le_bytes()); + buf.extend_from_slice(&fb_id.to_le_bytes()); + // Scheme I/O requires mutable access, so we re-open the device. + // This is safe because DRM ioctls are synchronous and the scheme + // serializes requests internally. + if let Ok(mut f) = File::open("/scheme/drm/card0") { let _ = f.write_all(&buf); } self.current.store(next, Ordering::Relaxed);