Skip to main content

denise_fbdev/
lib.rs

1//! Legacy Linux fbdev backend for Denise.
2//!
3//! # Read this before reaching for it
4//!
5//! This is a fallback, and on any current kernel it is a fallback to DRM through a
6//! longer route. `/dev/fb0` on a modern system is almost always
7//! `CONFIG_DRM_FBDEV_EMULATION` — DRM pretending to be fbdev. The Alpine VM this
8//! was developed against reports its framebuffer's name as `virtio_gpudrmfb`, and
9//! a Raspberry Pi running Bookworm reports `vc4drmfb`. Going through it means
10//! giving up page flips, vsync and buffer age, to reach the same hardware
11//! [`denise_drm`](../denise_drm/index.html) already drives properly.
12//!
13//! So prefer DRM. Use this when:
14//!
15//! - the kernel is old enough to predate a usable DRM driver for the panel,
16//! - the panel has an fbdev driver and no DRM driver at all, which still happens
17//!   with small SPI displays,
18//! - or DRM master cannot be obtained and a degraded picture beats none.
19//!
20//! # What it costs
21//!
22//! No page flip and no vsync, so a frame can tear. Drawing goes through a shadow
23//! buffer and only damaged rows are copied out, which keeps the tear as small as
24//! the change that caused it — the only mitigation available here, and another
25//! reason damage tracking belongs in the core rather than in a backend.
26//!
27//! # Permissions
28//!
29//! Writing to `/dev/fb*` needs the `video` group, or root.
30
31pub mod info;
32
33pub use info::{FbInfo, FbInfoError, PixelLayout};
34
35#[cfg(target_os = "linux")]
36mod error;
37#[cfg(target_os = "linux")]
38mod surface;
39
40#[cfg(target_os = "linux")]
41pub use error::FbdevError;
42#[cfg(target_os = "linux")]
43pub use surface::FbdevSurface;
44
45/// Compiles the examples in this crate's README, so they cannot drift from the API
46/// they claim to demonstrate. Never built except under `cargo test --doc`.
47#[cfg(doctest)]
48#[doc = include_str!("../README.md")]
49struct Readme;