1/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: sw=2 ts=8 et : 3 */ 4/* This Source Code Form is subject to the terms of the Mozilla Public 5 * License, v. 2.0. If a copy of the MPL was not distributed with this 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 7 8include LayersSurfaces; 9include LayersMessages; 10include protocol PCompositorBridge; 11include protocol PTexture; 12 13include "mozilla/GfxMessageUtils.h"; 14include "mozilla/layers/LayersMessageUtils.h"; 15 16using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h"; 17using struct mozilla::void_t from "mozilla/ipc/IPCCore.h"; 18using struct mozilla::null_t from "mozilla/ipc/IPCCore.h"; 19using class mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h"; 20using mozilla::layers::FrameUniformityData from "mozilla/layers/FrameUniformityData.h"; 21using mozilla::layers::ScrollableLayerGuid from "mozilla/layers/ScrollableLayerGuid.h"; 22using mozilla::layers::ScrollableLayerGuid::ViewID from "mozilla/layers/ScrollableLayerGuid.h"; 23using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h"; 24using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h"; 25using mozilla::layers::LayerHandle from "mozilla/layers/LayersTypes.h"; 26using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h"; 27using mozilla::layers::LayersObserverEpoch from "mozilla/layers/LayersTypes.h"; 28using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h"; 29 30/** 31 * The layers protocol is spoken between thread contexts that manage 32 * layer (sub)trees. The protocol comprises atomically publishing 33 * layer subtrees to a "shadow" thread context (which grafts the 34 * subtree into its own tree), and atomically updating a published 35 * subtree. ("Atomic" in this sense is wrt painting.) 36 */ 37 38namespace mozilla { 39namespace layers { 40 41/** 42 * The PLayerTransaction protocol manages the layer tree for a single "browser". 43 * The "browser" can be a top-level browser window, in which case the PLayer- 44 * TransactionChild exists in the UI process. The "browser" can also be a content 45 * tab, in which case the PLayerTransactionChild exists in the content process. 46 * In either case, the PLayerTransactionParent exists in the GPU process (if 47 * there is one) or the UI process otherwise. 48 */ 49sync protocol PLayerTransaction { 50 manager PCompositorBridge; 51 52parent: 53 // The isFirstPaint flag can be used to indicate that this is the first update 54 // for a particular document. 55 async Update(TransactionInfo txn); 56 57 async PaintTime(TransactionId id, TimeDuration paintTime); 58 59 async SetLayersObserverEpoch(LayersObserverEpoch aChildEpoch); 60 61 // Create a new Compositable. 62 async NewCompositable(CompositableHandle handle, TextureInfo info); 63 64 // Release an object that is no longer in use. 65 async ReleaseLayer(LayerHandle layer); 66 async ReleaseCompositable(CompositableHandle compositable); 67 68 // Tell the compositor to notify APZ that a layer has been confirmed for an 69 // input event. 70 async SetConfirmedTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] aTargets); 71 72 // Testing APIs 73 74 // Enter test mode, set the sample time to sampleTime, and resample 75 // animations. sampleTime must not be null. 76 sync SetTestSampleTime(TimeStamp sampleTime); 77 // Leave test mode and resume normal compositing 78 sync LeaveTestMode(); 79 80 // Returns |OMTAValue| applied to the layer. 81 sync GetAnimationValue(uint64_t aCompositorAnimationId) returns (OMTAValue value); 82 83 // Returns the value of the transform applied to the layer by animation and 84 // APZC. 85 sync GetTransform(LayerHandle layer) returns (Matrix4x4? transform); 86 87 // The next time the layer tree is composited, add this async scroll offset in 88 // CSS pixels for the given ViewID. 89 // Useful for testing rendering of async scrolling. 90 sync SetAsyncScrollOffset(ViewID id, float x, float y); 91 92 // The next time the layer tree is composited, include this async zoom in 93 // for the given ViewID. 94 // Useful for testing rendering of async zooming. 95 sync SetAsyncZoom(ViewID id, float zoom); 96 97 // Flush any pending APZ repaints to the main thread. 98 async FlushApzRepaints(); 99 100 // Drop any front buffers that might be retained on the compositor 101 // side. 102 async ClearCachedResources(); 103 104 // Schedule a composite if one isn't already scheduled. 105 async ScheduleComposite(); 106 107 // Get a copy of the compositor-side APZ test data instance for this 108 // layers id. 109 sync GetAPZTestData() returns (APZTestData data); 110 111 // Child requests frame uniformity measurements 112 sync GetFrameUniformity() returns (FrameUniformityData data); 113 114 // Query a named property from the last frame 115 sync RequestProperty(nsString property) returns (float value); 116 117 // Return the TextureFactoryIdentifier for this compositor. 118 sync GetTextureFactoryIdentifier() returns (TextureFactoryIdentifier aIdentifier); 119 120 async RecordPaintTimes(PaintTiming timing); 121 122 async Shutdown(); 123 sync ShutdownSync(); 124 125child: 126 async __delete__(); 127}; 128 129} // namespace layers 130} // namespace mozilla 131