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 "mozilla/GfxMessageUtils.h";
11include "mozilla/layers/WebRenderMessageUtils.h";
12
13include WebRenderMessages;
14include protocol PCompositorBridge;
15include protocol PTexture;
16
17using mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h";
18using mozilla::layers::FrameUniformityData from "mozilla/layers/FrameUniformityData.h";
19using mozilla::layers::ScrollableLayerGuid from "mozilla/layers/ScrollableLayerGuid.h";
20using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
21using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
22using mozilla::layers::CompositionPayload from "mozilla/layers/LayersTypes.h";
23using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
24using mozilla::wr::BuiltDisplayListDescriptor from "mozilla/webrender/webrender_ffi.h";
25using mozilla::wr::RenderReasons from "mozilla/webrender/webrender_ffi.h";
26using mozilla::wr::IdNamespace from "mozilla/webrender/WebRenderTypes.h";
27using mozilla::wr::MaybeIdNamespace from "mozilla/webrender/WebRenderTypes.h";
28using mozilla::wr::ExternalImageKeyPair from "mozilla/webrender/WebRenderTypes.h";
29[MoveOnly] using mozilla::layers::DisplayListData from "mozilla/layers/RenderRootTypes.h";
30[MoveOnly] using mozilla::layers::MaybeTransactionData from "mozilla/layers/RenderRootTypes.h";
31using mozilla::layers::FocusTarget from "mozilla/layers/FocusTarget.h";
32using mozilla::layers::LayersObserverEpoch from "mozilla/layers/LayersTypes.h";
33using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h";
34using mozilla::VsyncId from "mozilla/VsyncDispatcher.h";
35
36namespace mozilla {
37namespace layers {
38
39[ManualDealloc, ParentImpl=virtual]
40sync protocol PWebRenderBridge
41{
42  manager PCompositorBridge;
43
44parent:
45  sync EnsureConnected()
46    returns (TextureFactoryIdentifier textureFactoryIdentifier, MaybeIdNamespace maybeIdNamespace, nsCString error);
47
48  async NewCompositable(CompositableHandle handle, TextureInfo info);
49  async ReleaseCompositable(CompositableHandle compositable);
50
51  async DeleteCompositorAnimations(uint64_t[] aIds);
52  async SetDisplayList(DisplayListData displayList,
53                       OpDestroy[] toDestroy, uint64_t fwdTransactionId, TransactionId transactionId,
54                       bool containsSVGGroup,
55                       VsyncId vsyncId, TimeStamp vsyncStartTime,
56                       TimeStamp refreshStartTime, TimeStamp txnStartTime, nsCString txnURL, TimeStamp fwdTime,
57                       CompositionPayload[] payloads);
58  async EmptyTransaction(FocusTarget focusTarget,
59                         MaybeTransactionData transationData,
60                         OpDestroy[] toDestroy, uint64_t fwdTransactionId, TransactionId transactionId,
61                         VsyncId vsyncId, TimeStamp vsyncStartTime,
62                         TimeStamp refreshStartTime, TimeStamp txnStartTime,
63                         nsCString txnURL, TimeStamp fwdTime,
64                         CompositionPayload[] payloads);
65  async SetFocusTarget(FocusTarget focusTarget);
66  async UpdateResources(IdNamespace aIdNamespace, OpUpdateResource[] aResourceUpdates,
67                        RefCountedShmem[] aSmallShmems, Shmem[] aLargeShmems);
68  async ParentCommands(WebRenderParentCommand[] commands);
69  sync GetSnapshot(PTexture texture) returns (bool aNeedsYFlip);
70  async SetLayersObserverEpoch(LayersObserverEpoch childEpoch);
71  async ClearCachedResources();
72  async SetDefaultClearColor(uint32_t aColor);
73  // Invalidate rendered frame
74  async InvalidateRenderedFrame();
75  // Schedule a composite if one isn't already scheduled.
76  async ScheduleComposite(RenderReasons aReasons);
77  // Save the frame capture to disk
78  async Capture();
79
80  // Start capturing each frame to disk. See
81  // nsIDOMWindowUtils::wrStartCaptureSequence for documentation.
82  async StartCaptureSequence(nsCString aPath, uint32_t aFlags);
83
84  // Stop the captures started by StartCaptureSequence. See
85  // nsIDOMWindowUtils::wrStopCaptureSequence for documentation.
86  async StopCaptureSequence();
87
88  // Replacement for PCompositorBridge::SyncWithCompositor, but for WR. We need
89  // it on PWebRenderBridge because it associated with a particular top-level
90  // window, and PCompositorBridge doesn't allow doing that in a secure manner.
91  sync SyncWithCompositor();
92
93  // These correspond exactly to the equivalent APIs in PLayerTransaction -
94  // see those for documentation.
95  async SetConfirmedTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] aTargets);
96  // More copied from PLayerTransaction, but these are only used for testing.
97  sync SetTestSampleTime(TimeStamp sampleTime);
98  sync LeaveTestMode();
99  sync GetAnimationValue(uint64_t aCompositorAnimationsId) returns (OMTAValue value);
100  sync SetAsyncScrollOffset(ViewID scrollId, float x, float y);
101  sync SetAsyncZoom(ViewID scrollId, float zoom);
102  async FlushApzRepaints();
103  sync GetAPZTestData() returns (APZTestData data);
104  sync GetFrameUniformity() returns (FrameUniformityData data);
105
106  async Shutdown();
107  sync ShutdownSync();
108child:
109  async WrUpdated(IdNamespace aNewIdNamespace, TextureFactoryIdentifier textureFactoryIdentifier);
110  async WrReleasedImages(ExternalImageKeyPair[] pairs);
111  async __delete__();
112};
113
114} // layers
115} // mozilla
116