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);