class ClientVsyncQueue
Defined at line 37 of file ../../src/graphics/display/drivers/coordinator/client-vsync-queue.h
Traffic shaper for VSync messages sent to a Coordinator client.
Under normal operation, VSync messages are generated at a high frequency.
Clients designed for throughput rather than latency may occasionally take a
long time to process a VSync. Without traffic shaping, this would result in a
long queue of unprocessed FIDL messages, creating memory pressure.
This traffic shaper avoids the situation described above. Clients are
occasionally asked to acknowledge VSync messages, to provide a backpressure
signal. When a client falls behind, a fixed number of VSync messages are
buffered. If the buffer fills up, older messages are discarded in favor of
newer messages.
Instances are not thread-safe. Concurrent access must be synchronized
externally.
Public Members
static const int32_t kThrottleWatermark
static const int32_t kRequestAckWatermark
static const int32_t kThrottleBufferSize
Public Methods
void ClientVsyncQueue ()
Creates a queue that does not deliver received VSync events.
Defined at line 15 of file ../../src/graphics/display/drivers/coordinator/client-vsync-queue.cc
void ClientVsyncQueue (uint64_t cookie_salt)
Provided to make tests deterministic.
Defined at line 13 of file ../../src/graphics/display/drivers/coordinator/client-vsync-queue.cc
void ~ClientVsyncQueue ()
Defined at line 17 of file ../../src/graphics/display/drivers/coordinator/client-vsync-queue.cc
void Push (const Message & message)
Registers a VSync message to be sent to the Coordinator client.
If the queue is full, the oldest VSync message will be overwritten.
`DrainUntilThrottled()` must be called before any other method is called.
Defined at line 19 of file ../../src/graphics/display/drivers/coordinator/client-vsync-queue.cc
bool Acknowledge (display::VsyncAckCookie ack_cookie)
Called when a client acknowledges a VSync.
`ack_cookie` must not be invalid.
Returns false if `ack_cookie` is not a correct acknowledgement cookie.
If this method succeeds, `DrainUntilThrottled()` must be called before any
other method is called.
Defined at line 29 of file ../../src/graphics/display/drivers/coordinator/client-vsync-queue.cc
void ClientVsyncQueue (const ClientVsyncQueue & )
Defined at line 63 of file ../../src/graphics/display/drivers/coordinator/client-vsync-queue.h
ClientVsyncQueue & operator= (const ClientVsyncQueue & )
Defined at line 64 of file ../../src/graphics/display/drivers/coordinator/client-vsync-queue.h
template <typename Callable>
void DrainUntilThrottled (Callable send_message)
Removes all the messages eligible to be sent to the Coordinator client.
`send_message` must take two arguments, a `const
ClientVsyncQueue::Message
&
` and a `display::VsyncAckCookie`, and must
attempt to send the VSync message described by the arguments.
`send_message` must not make any method calls on this queue.
`send_message` receives messages in the same order that they were given to
`Push()`.
Defined at line 131 of file ../../src/graphics/display/drivers/coordinator/client-vsync-queue.h