Struct DisplayEvent

Source
pub struct DisplayEvent {
    generation: AtomicU64,
    observed: AtomicU64,
    acked: AtomicU64,
}
Expand description

Pending state of the VIRTIO_GPU_EVENT_DISPLAY config event.

The guest reads events_read, queries the display info and then writes events_clear. A display change landing between that read and write must stay pending, or the guest never learns about it. So the event is a generation counter, and events_clear only acknowledges the generation the guest saw in events_read.

Fields§

§generation: AtomicU64

Incremented on every display change.

§observed: AtomicU64

Generation current when the guest last read events_read.

§acked: AtomicU64

Generation last acknowledged by the guest through events_clear.

Implementations§

Source§

impl DisplayEvent

Source

pub fn signal(&self)

Records a display change to report to the guest.

Source

pub fn is_pending(&self) -> bool

Returns whether there is a display change the guest has not acknowledged.

Source

pub fn observe_and_is_pending(&self) -> bool

Records the current generation for a later events_clear and returns whether it is pending (called when the guest reads events_read). Both come from a single load of the generation, so the guest acknowledges exactly the state reported to it.

Source

pub fn acknowledge_observed(&self)

Acknowledges up to the generation last seen by observe_and_is_pending (called when the guest writes VIRTIO_GPU_EVENT_DISPLAY to events_clear).

Source

fn set_pending(&self, pending: bool)

Restores the pending state from a snapshot, which only stores a bool.

When pending is true, observed stays behind generation, so an events_clear in flight across snapshot/restore does not drop the event.

Trait Implementations§

Source§

impl Default for DisplayEvent

Source§

fn default() -> DisplayEvent

Returns the “default value” for a type. 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V