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 LayersMessages; michael@0: include protocol PCompositable; michael@0: include protocol PCompositor; michael@0: include protocol PGrallocBuffer; michael@0: include protocol PLayer; michael@0: include protocol PRenderFrame; michael@0: include protocol PTexture; michael@0: michael@0: include "mozilla/GfxMessageUtils.h"; michael@0: michael@0: using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h"; michael@0: using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; michael@0: michael@0: /** michael@0: * The layers protocol is spoken between thread contexts that manage michael@0: * layer (sub)trees. The protocol comprises atomically publishing michael@0: * layer subtrees to a "shadow" thread context (which grafts the michael@0: * subtree into its own tree), and atomically updating a published michael@0: * subtree. ("Atomic" in this sense is wrt painting.) michael@0: */ michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: union MaybeTransform { michael@0: gfx3DMatrix; michael@0: void_t; michael@0: }; michael@0: michael@0: sync protocol PLayerTransaction { michael@0: manager PRenderFrame or PCompositor; michael@0: manages PLayer; michael@0: manages PCompositable; michael@0: manages PGrallocBuffer; michael@0: manages PTexture; michael@0: michael@0: parent: michael@0: /** michael@0: * Only the parent side has privileges to allocate the buffer. michael@0: * Allocation may fail (pmem is a scarce resource), and if so null_t michael@0: * is returned. michael@0: * michael@0: * |format| is an Android PixelFormat (see PixelFormat.h) michael@0: * michael@0: * commonly used PixelFormats are: michael@0: * PIXEL_FORMAT_RGBA_8888 michael@0: * PIXEL_FORMAT_RGBX_8888 michael@0: * PIXEL_FORMAT_BGRA_8888 michael@0: * michael@0: * Note that SurfaceDescriptorGralloc has a "isRBSwapped" boolean michael@0: * that can treat the R/B bytes as swapped when they are rendered michael@0: * to the screen, to help with matching the native pixel format michael@0: * of other rendering engines. michael@0: * michael@0: * |usage| is a USAGE_* mask (see GraphicBuffer.h) michael@0: * michael@0: * commonly used USAGE flags are: michael@0: * USAGE_SW_READ_OFTEN | USAGE_SW_WRITE_OFTEN | USAGE_HW_TEXTURE michael@0: * - used for software rendering to a buffer which the compositor michael@0: * treats as a texture michael@0: * USAGE_HW_RENDER | USAGE_HW_TEXTURE michael@0: * - used for GL rendering to a buffer which the compositor michael@0: * treats as a texture michael@0: */ michael@0: sync PGrallocBuffer(IntSize size, uint32_t format, uint32_t usage) michael@0: returns (MaybeMagicGrallocBufferHandle handle); michael@0: async PLayer(); michael@0: async PCompositable(TextureInfo aTextureInfo); michael@0: async PTexture(SurfaceDescriptor aSharedData, uint32_t aTextureFlags); michael@0: michael@0: // The isFirstPaint flag can be used to indicate that this is the first update michael@0: // for a particular document. michael@0: sync Update(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint, bool scheduleComposite) michael@0: returns (EditReply[] reply); michael@0: michael@0: // Testing APIs michael@0: michael@0: // Enter test mode, set the sample time to sampleTime, and resample michael@0: // animations. sampleTime must not be null. michael@0: sync SetTestSampleTime(TimeStamp sampleTime); michael@0: // Leave test mode and resume normal compositing michael@0: sync LeaveTestMode(); michael@0: michael@0: sync GetOpacity(PLayer layer) returns (float opacity); michael@0: michael@0: // Returns the value of the transform applied to the layer by animation after michael@0: // factoring out translation components introduced to account for the offset michael@0: // of the corresponding frame and transform origin and after converting to CSS michael@0: // pixels. If the layer is not transformed by animation, the return value will michael@0: // be void_t. michael@0: sync GetAnimationTransform(PLayer layer) returns (MaybeTransform transform); michael@0: michael@0: // The next time this layer is composited, add this async scroll offset in michael@0: // CSS pixels. michael@0: // Useful for testing rendering of async scrolling. michael@0: async SetAsyncScrollOffset(PLayer layer, int32_t x, int32_t y); michael@0: michael@0: // We don't need to send a sync transaction if michael@0: // no transaction operate require a swap. michael@0: async UpdateNoSwap(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint, bool scheduleComposite); michael@0: michael@0: // Drop any front buffers that might be retained on the compositor michael@0: // side. michael@0: async ClearCachedResources(); michael@0: michael@0: // Schedule a composite if one isn't already scheduled. michael@0: async ForceComposite(); michael@0: michael@0: async __delete__(); michael@0: }; michael@0: michael@0: } // namespace layers michael@0: } // namespace mozilla