pub struct ModifierProbeCache { /* private fields */ }Expand description
Memoizes atomic TEST_ONLY verdicts.
An IN_FORMATS that advertises a modifier the hardware cannot actually
program — historically some pre-6.16 MediaTek OVL instances — then costs one
probe rather than one glitch per frame.
Backed by a linear scan: the entry count is bounded by
crtcs * planes * formats actually exercised, which is small, and a scan
beats hashing at this size.
use drmkit_fmt::{Modifier, ModifierProbeCache, Verdict, fourcc};
let mut cache = ModifierProbeCache::new();
assert_eq!(cache.lookup(1, 31, fourcc::XRGB8888, Modifier::LINEAR), Verdict::Unknown);
cache.record(1, 31, fourcc::XRGB8888, Modifier::LINEAR, true);
assert_eq!(cache.lookup(1, 31, fourcc::XRGB8888, Modifier::LINEAR), Verdict::Ok);
// A modeset or hotplug invalidates everything cached for that plane.
cache.invalidate_plane(31);
assert_eq!(cache.lookup(1, 31, fourcc::XRGB8888, Modifier::LINEAR), Verdict::Unknown);Implementations§
Source§impl ModifierProbeCache
impl ModifierProbeCache
Sourcepub fn lookup(
&self,
crtc: u32,
plane: u32,
fourcc: u32,
modifier: Modifier,
) -> Verdict
pub fn lookup( &self, crtc: u32, plane: u32, fourcc: u32, modifier: Modifier, ) -> Verdict
The cached verdict, or Verdict::Unknown.
Sourcepub fn record(
&mut self,
crtc: u32,
plane: u32,
fourcc: u32,
modifier: Modifier,
ok: bool,
)
pub fn record( &mut self, crtc: u32, plane: u32, fourcc: u32, modifier: Modifier, ok: bool, )
Record a probe outcome, replacing any previous verdict for the tuple.
Sourcepub fn invalidate_plane(&mut self, plane: u32)
pub fn invalidate_plane(&mut self, plane: u32)
Drop every verdict for a plane. Call on hotplug or modeset, after which a previously rejected modifier may well be accepted.
Trait Implementations§
Source§impl Clone for ModifierProbeCache
impl Clone for ModifierProbeCache
Source§impl Debug for ModifierProbeCache
impl Debug for ModifierProbeCache
Auto Trait Implementations§
impl Freeze for ModifierProbeCache
impl RefUnwindSafe for ModifierProbeCache
impl Send for ModifierProbeCache
impl Sync for ModifierProbeCache
impl Unpin for ModifierProbeCache
impl UnsafeUnpin for ModifierProbeCache
impl UnwindSafe for ModifierProbeCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more