Skip to main content

FrameEconomy

Struct FrameEconomy 

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

The per-frame present decision, and what it has decided so far.

§The point of it

The win is the skip. When nothing has changed since the last commit, the present loop issues no atomic commit at all — no flip, no reprogram. That is power saved on every panel, and on a panel capable of self-refresh it is what lets the panel stay there.

So the skip is unconditional and consults no PSR capability. Not flipping is a win whether or not the panel can self-refresh, and gating it on a capability would mean burning power on the panels that advertise nothing — which is most of them.

§Threading

Not synchronized: one present loop owns it, the same one that owns the BufferRing.

Implementations§

Source§

impl FrameEconomy

Source

pub const fn new() -> Self

A fresh economy, whose first decision is always a full commit.

Source

pub const fn decide( &mut self, content_changed: bool, damage_available: bool, ) -> FrameAction

Decide this frame.

content_changed is whether a layer produced a new frame or the scene mutated since the last committed one. damage_available is whether the producer supplied a bounded damage rectangle set, so a damaged commit is possible at all.

The first decision after construction or force_full is always FrameAction::CommitFull: the scanout buffer’s contents are otherwise undefined, or a modeset has just discarded them.

Source

pub const fn force_full(&mut self)

Make the next decision a full commit.

For after a modeset, a mode change or a rebind — anything that leaves the previous scanout contents no longer applying, so damage against them would repaint the wrong difference. One-shot: it applies to the next decision and then clears.

Source

pub const fn committed(&self) -> u64

How many frames have been committed.

Source

pub const fn skipped(&self) -> u64

How many frames have been skipped — the ones that cost nothing.

Trait Implementations§

Source§

impl Debug for FrameEconomy

Source§

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

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

impl Default for FrameEconomy

Source§

fn default() -> Self

The same as new: the first decision commits in full.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.