Skip to main content

Renderer

Struct Renderer 

Source
pub struct Renderer<'a> { /* private fields */ }
Expand description

A cursor on a plane.

Borrows the device: the buffers and the framebuffers registered for them belong to it, and outliving it would leave this holding ids the kernel has recycled.

Implementations§

Source§

impl<'a> Renderer<'a>

Source

pub fn create( device: &'a Device, registry: &PlaneRegistry, config: &RendererConfig, ) -> Result<Self, CursorError>

Set up a cursor on config.crtc_id.

Chooses a plane, settles a buffer size by asking the kernel what it will take, and allocates. No cursor is loaded yet.

§Errors
Source

pub const fn plane(&self) -> SelectedPlane

The plane this is drawing on.

Source

pub const fn reserved_plane_id(&self) -> u32

The plane the cursor occupies, for a caller keeping its own commits off it: the plane it draws on on the atomic paths; on the legacy path, the CRTC’s cursor plane the kernel drives when RendererConfig::prefer_legacy chose the legacy ioctls over it, else 0.

Source

pub const fn size(&self) -> (u32, u32)

The size of the cursor buffer, in pixels.

Source

pub fn set_rotation(&mut self, rotation: Rotation) -> Result<(), CursorError>

Change which way up the cursor is, redrawing it.

§Errors
Source

pub fn set_cursor(&mut self, cursor: Cursor) -> Result<(), CursorError>

Load a cursor and draw its first frame.

§Errors

CursorError::Io if the buffer cannot be mapped.

Source

pub const fn move_to(&mut self, x: i32, y: i32)

Move the pointer.

Source

pub const fn set_visible(&mut self, visible: bool)

Show or hide the cursor without unloading it.

Source

pub fn tick(&mut self, elapsed: Duration) -> Result<bool, CursorError>

Advance an animation, drawing a new frame if one is due.

Returns whether the buffer changed, so a caller can skip a commit that would publish the same pixels. A static cursor never changes.

§Errors

CursorError::Io if the buffer cannot be mapped.

Source

pub fn stage_into( &self, request: &mut AtomicRequest, ) -> Result<usize, CursorError>

Write the cursor’s current state into request.

For coalescing with the rest of a frame. The caller commits, and calls Renderer::published afterwards.

§Errors

CursorError::MissingProperty if the plane lacks a required property – always, on PlanePath::Legacy, which has no plane to stage: use Renderer::commit there.

Source

pub const fn published(&mut self)

Note that a commit carrying Renderer::stage_into’s writes landed.

See PingPong::published for what happens when it did not.

Source

pub fn commit(&mut self) -> Result<(), CursorError>

Stage and commit on their own.

For callers with nothing to coalesce with. A compositor should prefer Renderer::stage_into.

§Errors

CursorError::MissingProperty from staging, or CursorError::Io if the kernel refuses the commit.

Source

pub fn pause(self) -> Paused

Give up the device for a session pause.

See Paused for what is released and what cannot be.

Trait Implementations§

Source§

impl<'a> Debug for Renderer<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Renderer<'a>

§

impl<'a> RefUnwindSafe for Renderer<'a>

§

impl<'a> Send for Renderer<'a>

§

impl<'a> Sync for Renderer<'a>

§

impl<'a> Unpin for Renderer<'a>

§

impl<'a> UnsafeUnpin for Renderer<'a>

§

impl<'a> UnwindSafe for Renderer<'a>

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.