redbear-compositor: keep DRM fd open across page flips (Gap 3.5)

DrmOutput's _file field was stored but unused; flip() reopened
/scheme/drm/card0 on every page flip. Rename to drm_file, un-
underscore, and use &self.drm_file in flip() to avoid the per-flip
open+close round trip.

This is the implementation of v6.0 plan Phase 3.5 'Fix page
flip to keep DRM fd open'.
This commit is contained in:
2026-06-09 15:28:59 +03:00
parent 6870429b21
commit ddd574ef4f
@@ -201,7 +201,7 @@ mod drm_backend {
pub buffers: Vec<(usize, usize)>,
fb_ids: Vec<u32>,
pub current: AtomicUsize,
_file: File,
drm_file: File,
}
impl DrmOutput {
@@ -420,7 +420,7 @@ mod drm_backend {
buffers,
fb_ids,
current: AtomicUsize::new(0),
_file: file,
drm_file: file,
})
}
@@ -434,9 +434,7 @@ mod drm_backend {
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());
if let Ok(mut f) = File::open("/scheme/drm/card0") {
let _ = f.write_all(&buf);
}
let _ = (&self.drm_file).write_all(&buf);
self.current.store(next, Ordering::Relaxed);
}