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: AtomicU64Incremented on every display change.
observed: AtomicU64Generation current when the guest last read events_read.
acked: AtomicU64Generation last acknowledged by the guest through events_clear.
Implementations§
Source§impl DisplayEvent
impl DisplayEvent
Sourcepub fn is_pending(&self) -> bool
pub fn is_pending(&self) -> bool
Returns whether there is a display change the guest has not acknowledged.
Sourcepub fn observe_and_is_pending(&self) -> bool
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.
Sourcepub fn acknowledge_observed(&self)
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).
Sourcefn set_pending(&self, pending: bool)
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.