1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/layers/ipc/PLayerTransaction.ipdl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,121 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * vim: sw=2 ts=8 et : 1.6 + */ 1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.10 + 1.11 +include LayersSurfaces; 1.12 +include LayersMessages; 1.13 +include protocol PCompositable; 1.14 +include protocol PCompositor; 1.15 +include protocol PGrallocBuffer; 1.16 +include protocol PLayer; 1.17 +include protocol PRenderFrame; 1.18 +include protocol PTexture; 1.19 + 1.20 +include "mozilla/GfxMessageUtils.h"; 1.21 + 1.22 +using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h"; 1.23 +using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; 1.24 + 1.25 +/** 1.26 + * The layers protocol is spoken between thread contexts that manage 1.27 + * layer (sub)trees. The protocol comprises atomically publishing 1.28 + * layer subtrees to a "shadow" thread context (which grafts the 1.29 + * subtree into its own tree), and atomically updating a published 1.30 + * subtree. ("Atomic" in this sense is wrt painting.) 1.31 + */ 1.32 + 1.33 +namespace mozilla { 1.34 +namespace layers { 1.35 + 1.36 +union MaybeTransform { 1.37 + gfx3DMatrix; 1.38 + void_t; 1.39 +}; 1.40 + 1.41 +sync protocol PLayerTransaction { 1.42 + manager PRenderFrame or PCompositor; 1.43 + manages PLayer; 1.44 + manages PCompositable; 1.45 + manages PGrallocBuffer; 1.46 + manages PTexture; 1.47 + 1.48 +parent: 1.49 + /** 1.50 + * Only the parent side has privileges to allocate the buffer. 1.51 + * Allocation may fail (pmem is a scarce resource), and if so null_t 1.52 + * is returned. 1.53 + * 1.54 + * |format| is an Android PixelFormat (see PixelFormat.h) 1.55 + * 1.56 + * commonly used PixelFormats are: 1.57 + * PIXEL_FORMAT_RGBA_8888 1.58 + * PIXEL_FORMAT_RGBX_8888 1.59 + * PIXEL_FORMAT_BGRA_8888 1.60 + * 1.61 + * Note that SurfaceDescriptorGralloc has a "isRBSwapped" boolean 1.62 + * that can treat the R/B bytes as swapped when they are rendered 1.63 + * to the screen, to help with matching the native pixel format 1.64 + * of other rendering engines. 1.65 + * 1.66 + * |usage| is a USAGE_* mask (see GraphicBuffer.h) 1.67 + * 1.68 + * commonly used USAGE flags are: 1.69 + * USAGE_SW_READ_OFTEN | USAGE_SW_WRITE_OFTEN | USAGE_HW_TEXTURE 1.70 + * - used for software rendering to a buffer which the compositor 1.71 + * treats as a texture 1.72 + * USAGE_HW_RENDER | USAGE_HW_TEXTURE 1.73 + * - used for GL rendering to a buffer which the compositor 1.74 + * treats as a texture 1.75 + */ 1.76 + sync PGrallocBuffer(IntSize size, uint32_t format, uint32_t usage) 1.77 + returns (MaybeMagicGrallocBufferHandle handle); 1.78 + async PLayer(); 1.79 + async PCompositable(TextureInfo aTextureInfo); 1.80 + async PTexture(SurfaceDescriptor aSharedData, uint32_t aTextureFlags); 1.81 + 1.82 + // The isFirstPaint flag can be used to indicate that this is the first update 1.83 + // for a particular document. 1.84 + sync Update(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint, bool scheduleComposite) 1.85 + returns (EditReply[] reply); 1.86 + 1.87 + // Testing APIs 1.88 + 1.89 + // Enter test mode, set the sample time to sampleTime, and resample 1.90 + // animations. sampleTime must not be null. 1.91 + sync SetTestSampleTime(TimeStamp sampleTime); 1.92 + // Leave test mode and resume normal compositing 1.93 + sync LeaveTestMode(); 1.94 + 1.95 + sync GetOpacity(PLayer layer) returns (float opacity); 1.96 + 1.97 + // Returns the value of the transform applied to the layer by animation after 1.98 + // factoring out translation components introduced to account for the offset 1.99 + // of the corresponding frame and transform origin and after converting to CSS 1.100 + // pixels. If the layer is not transformed by animation, the return value will 1.101 + // be void_t. 1.102 + sync GetAnimationTransform(PLayer layer) returns (MaybeTransform transform); 1.103 + 1.104 + // The next time this layer is composited, add this async scroll offset in 1.105 + // CSS pixels. 1.106 + // Useful for testing rendering of async scrolling. 1.107 + async SetAsyncScrollOffset(PLayer layer, int32_t x, int32_t y); 1.108 + 1.109 + // We don't need to send a sync transaction if 1.110 + // no transaction operate require a swap. 1.111 + async UpdateNoSwap(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint, bool scheduleComposite); 1.112 + 1.113 + // Drop any front buffers that might be retained on the compositor 1.114 + // side. 1.115 + async ClearCachedResources(); 1.116 + 1.117 + // Schedule a composite if one isn't already scheduled. 1.118 + async ForceComposite(); 1.119 + 1.120 + async __delete__(); 1.121 +}; 1.122 + 1.123 +} // namespace layers 1.124 +} // namespace mozilla