blob: e4c0ae3ef542d76e5d43f17334bebb485d1db6d8 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module cc.mojom;
import "cc/ipc/begin_frame_args.mojom";
import "cc/ipc/compositor_frame.mojom";
import "cc/ipc/copy_output_request.mojom";
import "cc/ipc/frame_sink_id.mojom";
import "cc/ipc/local_surface_id.mojom";
import "cc/ipc/surface_id.mojom";
import "cc/ipc/returned_resource.mojom";
import "cc/ipc/surface_sequence.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";
// A MojoCompositorFrameSink is an interface for receiving CompositorFrame
// structs. A CompositorFrame contains the complete output meant for display.
// Each time a client has a graphical update, and receives an OnBeginFrame, it
// is responsible for creating a CompositorFrame to update its portion of the
// screen.
interface MojoCompositorFrameSink {
// Lets the display compositor know that the client wishes to receive the next
// BeginFrame event.
SetNeedsBeginFrame(bool needs_begin_frame);
// Submits a CompositorFrame to the display compositor that will be presented
// to screen the next time frames from all CompositorFrameSinks are aggregated
// to produce a display CompositorFrame. If a client wishes to allocate a new
// surface (e.g. during resize), then it can simply allocate a new
// |local_surface_id|.
// For successful swaps, the implementation must call
// DidReceiveCompositorFrameAck() asynchronously when the frame has been
// processed in order to unthrottle the next frame.
SubmitCompositorFrame(cc.mojom.LocalSurfaceId local_surface_id,
cc.mojom.CompositorFrame frame);
// Notifies the frame sink that a BeginFrame was completed, but that no
// CompositorFrame was produced as a result of it.
DidNotProduceFrame(cc.mojom.BeginFrameAck ack);
// Notify that the surface is no longer in use (and is okay to be evicted) so
// that its resources gets returned in time.
EvictCurrentSurface();
};
interface MojoCompositorFrameSinkClient {
// Notification that the previous CompositorFrame given to
// SubmitCompositorFrame() has been processed and that another frame
// can be submitted. This provides backpressure from the display compositor
// so that frames are submitted only at the rate it can handle them.
// TODO(fsamuel): This method ought not be necessary with unified BeginFrame.
// However, there's a fair amount of cleanup and refactoring necessary to get
// rid of it.
DidReceiveCompositorFrameAck(ReturnedResourceArray resources);
// Notification for the client to generate a CompositorFrame.
OnBeginFrame(BeginFrameArgs args);
// Returns resources sent to SubmitCompositorFrame to be reused or freed.
ReclaimResources(ReturnedResourceArray resources);
};
// MojoCompositorFrameSinkPrivate is used by the display compositor host to
// perform privilieged operations on a CompositorFrameSink such as
// CopyOutputRequests.
interface MojoCompositorFrameSinkPrivate {
// Claims this FrameSinkId will embed |surface_id| so it should own the
// temporary reference to |surface_id|.
ClaimTemporaryReference(SurfaceId surface_id);
// Requests that the renderer send back a copy of the surface that this
// CompositorFrameSink submits to. The result can be in form of a bitmap
// or a texture. See cc::CopyOutputRequest.
RequestCopyOfSurface(cc.mojom.CopyOutputRequest request);
};