Skip to main content

SharedFramebuffer

Struct SharedFramebuffer 

Source
pub(crate) struct SharedFramebuffer {
    opcode: u8,
    id: u32,
    framebuffer: Mapping,
    watch: Mapping,
    event: OwnedFd,
    pub width: u32,
    pub height: u32,
    stride: usize,
    pixel_offset: usize,
    tile: u32,
    tiles_x: u32,
    tiles_y: u32,
}
Expand description

A watch on the framebuffer of the screen of one root window (module docblock).

Fields§

§opcode: u8§id: u32§framebuffer: Mapping§watch: Mapping§event: OwnedFd§width: u32§height: u32§stride: usize§pixel_offset: usize§tile: u32§tiles_x: u32§tiles_y: u32

Implementations§

Source§

impl SharedFramebuffer

Source

pub(crate) fn open(conn: &RustConnection, root: u32) -> Opened

Watch the framebuffer of root’s screen, where the server offers one of 32 bits a pixel.

Source

fn watch(conn: &RustConnection, opcode: u8, root: u32) -> Result<Self, String>

Source

pub(crate) fn close(self, conn: &RustConnection)

End the watch on the server; the mappings go with self.

Source

pub(crate) fn retired(&self) -> bool

Whether the screen has moved to another framebuffer (a resize): the watch is over.

Source

fn words(&self) -> usize

The words of the tile bitmap.

Source

pub(crate) fn drawn(&self) -> bool

Whether any tile was drawn into since the bitmap was last taken.

Source

fn take(&self, into: impl FnMut(usize, u64))

Take the tiles drawn since the last take, handing each nonzero word of the bitmap to into with its index.

Source

pub(crate) fn wait(&self, timeout: Duration) -> bool

Wait at most timeout for a drawing operation to end on a tile not yet taken, or for the framebuffer to retire: true where one did, or already had.

Source

fn settled_seq(&self) -> Option<u64>

The drawing count once no operation runs, or None past DRAW_WAIT.

Source

fn copy_tiles( &self, pending: &[u64], dst: &mut [u8], dst_stride: usize, (x, y, width, height): (u32, u32, u32, u32), )

Copy the tiles pending marks within the region at (x, y) of width x height into dst (dst_stride bytes a row, the region’s top-left at its start). Each row of tiles lands in rows of dst of its own, so a change past PARALLEL_BYTES copies its rows of tiles on COPY_THREADS threads: one thread copying a whole 2560x1600 screen took 1.2 to 6.7 ms, reading what the server had just drawn from another core’s cache, which held a full-screen change back behind an XShm grab, the server’s copy from its own.

Source

fn convert_tiles( &self, pending: &[u64], planes: &mut Nv12Planes, (x, y, width, height): (u32, u32, u32, u32), bands: usize, ) -> bool

Convert the rows of tiles pending marks within the region at (x, y) of width x height to 8-bit 4:2:0 BT.709 limited range in planes (the region’s top-left at their first pixel), as the NV12 x264 encodes in place, across the region’s whole width for each run of such rows, split into bands of rows converted in parallel as the encode thread’s own conversion is: the conversion reads the screen where the server keeps it, in place of copying it out first. False where the conversion refused the geometry.

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more