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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user