// Copyright 2015 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 mojo; import "ui/mojo/geometry/geometry.mojom"; import "components/view_manager/public/interfaces/quads.mojom"; enum ResourceFormat { RGBA_8888, RGBA_4444, BGRA_8888, ALPHA_8, LUMINANCE_8, RGB_565, ETC1, }; // See src/cc/resources/returned_resource.h. struct ReturnedResource { uint32 id; uint32 sync_point; int32 count; bool lost; }; // See src/gpu/command_buffer/common/mailbox.h. struct Mailbox { array name; }; // See src/gpu/command_buffer/common/mailbox_holder.h. struct MailboxHolder { Mailbox mailbox; uint32 texture_target; uint32 sync_point; }; // A TransferableResource is a graphics resource such as a texture or a bitmap // in shared memory (software mode) that is shared between the View Manager and // a client. This data structure is used to manage reuse of // the memory once it is no longer needed by the View Manager and GPU service. struct TransferableResource { // |id| is an integer that uniquely identifies this resource in the client so // that the View Manager can return this resource back to the client. uint32 id; ResourceFormat format; uint32 filter; Size size; MailboxHolder mailbox_holder; bool is_repeated; bool is_software; }; // See cc/output/compositor_frame_metadata.h. struct CompositorFrameMetadata { float device_scale_factor; }; // See src/cc/output/compositor_frame.h. struct CompositorFrame { CompositorFrameMetadata metadata; array resources; array passes; }; // A Surface is an interface for receiving CompositorFrame structs. This is a // separate interface to allow CompositorFrames to be delivered from // supplementary (not main) threads of a mojo app. interface Surface { // After the submitted frame is drawn for the first time, the receiver will // respond to the SubmitFrame message. Clients should use this acknowledgement // to ratelimit frame submissions. SubmitCompositorFrame(CompositorFrame frame) => (); }; interface SurfaceClient { ReturnResources(array resources); };