To implement exo wp_presentation interface, we need a presentation feedback for every compositor frame. The feedback info includes an accurate timestamp to indicate when a frame was presented to user and a refresh to indicate when the next frame will be presented to user.
WillDrawSurface basically does this but it's a very chatty API: it gets called for every display frame that embeds the given surface ID.
I would suggest the following API:
interface MojoCompostiorFrameSink {
...
SetNeedsDrawCallback(bool needs_callback);
...
};
interface MojoCompositorFrameSinkClient {
...
WillDrawSurface(SurfaceId surface_id);
...
};
WillDrawSurface would only be called if the clients needs the draw callback. If the client no longer needs the draw callback then viz stops calling WillDrawSurface. WDYT?
WillDrawSurface doesn't provide the information which exo needs. I think we need add two new IPC for it. They will look like:
struct FrameMetaData {
..
// A token for presentation feedback. If it is not zero,
// the presentation feedback will be provided via
// DidPresentCompositorFrame or DidDiscardCompositorFrame.
uint32 presentation_token;
...
};
interface MojoCompositorFrameSinkClient {
...
DidPresentCompositorFrame(uint32 presentation_token, TimeTicks timestamp, TimeDelta refresh);
DidDiscardCompositorFrame(uint32 presentation_token);
...
};
Comment 1 by fsam...@chromium.org
, May 30 2017WillDrawSurface basically does this but it's a very chatty API: it gets called for every display frame that embeds the given surface ID. I would suggest the following API: interface MojoCompostiorFrameSink { ... SetNeedsDrawCallback(bool needs_callback); ... }; interface MojoCompositorFrameSinkClient { ... WillDrawSurface(SurfaceId surface_id); ... }; WillDrawSurface would only be called if the clients needs the draw callback. If the client no longer needs the draw callback then viz stops calling WillDrawSurface. WDYT?