michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=8 et : michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: include LayersSurfaces; michael@0: include protocol PGrallocBuffer; michael@0: include protocol PLayerTransaction; michael@0: include "mozilla/GfxMessageUtils.h"; michael@0: include "nsRegion.h"; michael@0: michael@0: using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; michael@0: using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h"; michael@0: using struct mozilla::layers::FrameMetrics from "FrameMetrics.h"; michael@0: using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h"; michael@0: using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h"; michael@0: using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h"; michael@0: using mozilla::ipc::SharedMemoryBasic::Handle from "mozilla/ipc/SharedMemoryBasic.h"; michael@0: using class mozilla::TimeStamp from "mozilla/TimeStamp.h"; michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: michael@0: /** michael@0: * The PCompositor protocol is used to manage communication between michael@0: * the main thread and the compositor thread context. It's primary michael@0: * purpose is to manage the PLayerTransaction sub protocol. michael@0: */ michael@0: // This should really be 'sync', but we're using 'rpc' as a workaround michael@0: // for Bug 716631. michael@0: intr protocol PCompositor michael@0: { michael@0: // A Compositor manages a single Layer Manager (PLayerTransaction) michael@0: manages PLayerTransaction; michael@0: michael@0: child: michael@0: // The child should invalidate everything so that the whole window is redrawn. michael@0: async InvalidateAll(); michael@0: michael@0: // The compositor completed a layers transaction. id is the layers id michael@0: // of the child layer tree that was composited (or 0 when notifying michael@0: // the root layer tree). michael@0: async DidComposite(uint64_t id); michael@0: michael@0: parent: michael@0: michael@0: // The child is about to be destroyed, so perform any necessary cleanup. michael@0: sync WillStop(); michael@0: michael@0: // Clean up in preparation for own destruction. michael@0: sync Stop(); michael@0: michael@0: // Pause/resume the compositor. These are intended to be used on mobile, when michael@0: // the compositor needs to pause/resume in lockstep with the application. michael@0: sync Pause(); michael@0: sync Resume(); michael@0: michael@0: async NotifyChildCreated(uint64_t id); michael@0: michael@0: // Make a snapshot of the content that would have been drawn to our michael@0: // render target at the time this message is received. If the size michael@0: // or format of |inSnapshot| doesn't match our render target, michael@0: // results are undefined. michael@0: // michael@0: // NB: this message will result in animations, transforms, effects, michael@0: // and so forth being interpolated. That's what we want to happen. michael@0: sync MakeSnapshot(SurfaceDescriptor inSnapshot) michael@0: returns (SurfaceDescriptor outSnapshot); michael@0: michael@0: // Make sure any pending composites are started immediately and michael@0: // block until they are completed. michael@0: sync FlushRendering(); michael@0: michael@0: sync StartFrameTimeRecording(int32_t bufferSize) michael@0: returns (uint32_t startIndex); michael@0: michael@0: sync StopFrameTimeRecording(uint32_t startIndex) michael@0: returns (float[] intervals); michael@0: michael@0: // layersBackendHints is an ordered list of preffered backends where michael@0: // layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE michael@0: // that hint is ignored. michael@0: sync PLayerTransaction(LayersBackend[] layersBackendHints, uint64_t id) michael@0: returns (TextureFactoryIdentifier textureFactoryIdentifier, bool success); michael@0: michael@0: // Notify the compositor that a region of the screen has been invalidated. michael@0: async NotifyRegionInvalidated(nsIntRegion region); michael@0: michael@0: child: michael@0: // Send back Compositor Frame Metrics from APZCs so tiled layers can michael@0: // update progressively. michael@0: async SharedCompositorFrameMetrics(Handle metrics, CrossProcessMutexHandle mutex, uint32_t aAPZCId); michael@0: async ReleaseSharedCompositorFrameMetrics(ViewID aId, uint32_t aAPZCId); michael@0: }; michael@0: michael@0: } // layers michael@0: } // mozilla