Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * vim: sw=2 ts=8 et : |
michael@0 | 3 | */ |
michael@0 | 4 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 7 | |
michael@0 | 8 | include LayersSurfaces; |
michael@0 | 9 | include LayersMessages; |
michael@0 | 10 | include protocol PCompositable; |
michael@0 | 11 | include protocol PCompositor; |
michael@0 | 12 | include protocol PGrallocBuffer; |
michael@0 | 13 | include protocol PLayer; |
michael@0 | 14 | include protocol PRenderFrame; |
michael@0 | 15 | include protocol PTexture; |
michael@0 | 16 | |
michael@0 | 17 | include "mozilla/GfxMessageUtils.h"; |
michael@0 | 18 | |
michael@0 | 19 | using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h"; |
michael@0 | 20 | using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; |
michael@0 | 21 | |
michael@0 | 22 | /** |
michael@0 | 23 | * The layers protocol is spoken between thread contexts that manage |
michael@0 | 24 | * layer (sub)trees. The protocol comprises atomically publishing |
michael@0 | 25 | * layer subtrees to a "shadow" thread context (which grafts the |
michael@0 | 26 | * subtree into its own tree), and atomically updating a published |
michael@0 | 27 | * subtree. ("Atomic" in this sense is wrt painting.) |
michael@0 | 28 | */ |
michael@0 | 29 | |
michael@0 | 30 | namespace mozilla { |
michael@0 | 31 | namespace layers { |
michael@0 | 32 | |
michael@0 | 33 | union MaybeTransform { |
michael@0 | 34 | gfx3DMatrix; |
michael@0 | 35 | void_t; |
michael@0 | 36 | }; |
michael@0 | 37 | |
michael@0 | 38 | sync protocol PLayerTransaction { |
michael@0 | 39 | manager PRenderFrame or PCompositor; |
michael@0 | 40 | manages PLayer; |
michael@0 | 41 | manages PCompositable; |
michael@0 | 42 | manages PGrallocBuffer; |
michael@0 | 43 | manages PTexture; |
michael@0 | 44 | |
michael@0 | 45 | parent: |
michael@0 | 46 | /** |
michael@0 | 47 | * Only the parent side has privileges to allocate the buffer. |
michael@0 | 48 | * Allocation may fail (pmem is a scarce resource), and if so null_t |
michael@0 | 49 | * is returned. |
michael@0 | 50 | * |
michael@0 | 51 | * |format| is an Android PixelFormat (see PixelFormat.h) |
michael@0 | 52 | * |
michael@0 | 53 | * commonly used PixelFormats are: |
michael@0 | 54 | * PIXEL_FORMAT_RGBA_8888 |
michael@0 | 55 | * PIXEL_FORMAT_RGBX_8888 |
michael@0 | 56 | * PIXEL_FORMAT_BGRA_8888 |
michael@0 | 57 | * |
michael@0 | 58 | * Note that SurfaceDescriptorGralloc has a "isRBSwapped" boolean |
michael@0 | 59 | * that can treat the R/B bytes as swapped when they are rendered |
michael@0 | 60 | * to the screen, to help with matching the native pixel format |
michael@0 | 61 | * of other rendering engines. |
michael@0 | 62 | * |
michael@0 | 63 | * |usage| is a USAGE_* mask (see GraphicBuffer.h) |
michael@0 | 64 | * |
michael@0 | 65 | * commonly used USAGE flags are: |
michael@0 | 66 | * USAGE_SW_READ_OFTEN | USAGE_SW_WRITE_OFTEN | USAGE_HW_TEXTURE |
michael@0 | 67 | * - used for software rendering to a buffer which the compositor |
michael@0 | 68 | * treats as a texture |
michael@0 | 69 | * USAGE_HW_RENDER | USAGE_HW_TEXTURE |
michael@0 | 70 | * - used for GL rendering to a buffer which the compositor |
michael@0 | 71 | * treats as a texture |
michael@0 | 72 | */ |
michael@0 | 73 | sync PGrallocBuffer(IntSize size, uint32_t format, uint32_t usage) |
michael@0 | 74 | returns (MaybeMagicGrallocBufferHandle handle); |
michael@0 | 75 | async PLayer(); |
michael@0 | 76 | async PCompositable(TextureInfo aTextureInfo); |
michael@0 | 77 | async PTexture(SurfaceDescriptor aSharedData, uint32_t aTextureFlags); |
michael@0 | 78 | |
michael@0 | 79 | // The isFirstPaint flag can be used to indicate that this is the first update |
michael@0 | 80 | // for a particular document. |
michael@0 | 81 | sync Update(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint, bool scheduleComposite) |
michael@0 | 82 | returns (EditReply[] reply); |
michael@0 | 83 | |
michael@0 | 84 | // Testing APIs |
michael@0 | 85 | |
michael@0 | 86 | // Enter test mode, set the sample time to sampleTime, and resample |
michael@0 | 87 | // animations. sampleTime must not be null. |
michael@0 | 88 | sync SetTestSampleTime(TimeStamp sampleTime); |
michael@0 | 89 | // Leave test mode and resume normal compositing |
michael@0 | 90 | sync LeaveTestMode(); |
michael@0 | 91 | |
michael@0 | 92 | sync GetOpacity(PLayer layer) returns (float opacity); |
michael@0 | 93 | |
michael@0 | 94 | // Returns the value of the transform applied to the layer by animation after |
michael@0 | 95 | // factoring out translation components introduced to account for the offset |
michael@0 | 96 | // of the corresponding frame and transform origin and after converting to CSS |
michael@0 | 97 | // pixels. If the layer is not transformed by animation, the return value will |
michael@0 | 98 | // be void_t. |
michael@0 | 99 | sync GetAnimationTransform(PLayer layer) returns (MaybeTransform transform); |
michael@0 | 100 | |
michael@0 | 101 | // The next time this layer is composited, add this async scroll offset in |
michael@0 | 102 | // CSS pixels. |
michael@0 | 103 | // Useful for testing rendering of async scrolling. |
michael@0 | 104 | async SetAsyncScrollOffset(PLayer layer, int32_t x, int32_t y); |
michael@0 | 105 | |
michael@0 | 106 | // We don't need to send a sync transaction if |
michael@0 | 107 | // no transaction operate require a swap. |
michael@0 | 108 | async UpdateNoSwap(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint, bool scheduleComposite); |
michael@0 | 109 | |
michael@0 | 110 | // Drop any front buffers that might be retained on the compositor |
michael@0 | 111 | // side. |
michael@0 | 112 | async ClearCachedResources(); |
michael@0 | 113 | |
michael@0 | 114 | // Schedule a composite if one isn't already scheduled. |
michael@0 | 115 | async ForceComposite(); |
michael@0 | 116 | |
michael@0 | 117 | async __delete__(); |
michael@0 | 118 | }; |
michael@0 | 119 | |
michael@0 | 120 | } // namespace layers |
michael@0 | 121 | } // namespace mozilla |