Skip to main content

FbdevSurface

Struct FbdevSurface 

Source
pub struct FbdevSurface { /* private fields */ }
Expand description

A framebuffer, drawn into through a shadow buffer.

§Why a shadow buffer

The mapped framebuffer is being scanned out continuously; there is nothing to flip to. Rendering into it directly would put every intermediate state on screen — the clear before the redraw above all — which reads as flicker on exactly the panels this backend exists for. So drawing goes to memory we own and present copies out only the damaged rows.

That also makes the buffer age honest: the shadow persists frame to frame, so it is BufferAge::Frames(1) and incremental repaint works exactly as it does on DRM.

§What this cannot do

There is no page flip and no vsync. A copy that lands mid-scanout will tear, and nothing here can prevent it — FBIO_WAITFORVSYNC is optional and widely unimplemented. Keeping damage small keeps the tear small, which is the only mitigation fbdev offers.

Implementations§

Source§

impl FbdevSurface

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, FbdevError>

Opens a specific node, such as /dev/fb0.

Source

pub fn open_first() -> Result<Self, FbdevError>

Opens the first framebuffer node that can be read and understood.

Source

pub fn info(&self) -> FbInfo

The geometry in force.

Source

pub fn path(&self) -> &Path

The node this surface was opened from.

Trait Implementations§

Source§

impl Debug for FbdevSurface

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Surface for FbdevSurface

Source§

fn size(&self) -> Size

Visible extent in physical pixels.
Source§

fn scale_factor(&self) -> f32

Physical pixels per logical pixel. 1.0 on a typical panel.
Source§

fn format(&self) -> PixelFormat

Word layout the backend will scan out.
Source§

fn acquire(&mut self) -> Result<Frame<'_>, SurfaceError>

Takes the next drawable buffer.
Source§

fn present(&mut self, damage: &[Rect]) -> Result<(), SurfaceError>

Publishes the frame, telling the backend which regions changed. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.