1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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/. */
8 include LayersSurfaces;
9 include LayersMessages;
10 include "mozilla/GfxMessageUtils.h";
11 include "mozilla/layers/WebRenderMessageUtils.h";
13 include WebRenderMessages;
14 include protocol PCompositorBridge;
15 include protocol PTexture;
17 using mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h";
18 using mozilla::layers::FrameUniformityData from "mozilla/layers/FrameUniformityData.h";
19 using mozilla::layers::ScrollableLayerGuid from "mozilla/layers/ScrollableLayerGuid.h";
20 using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
21 using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
22 using mozilla::layers::CompositionPayload from "mozilla/layers/LayersTypes.h";
23 using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
24 using mozilla::wr::BuiltDisplayListDescriptor from "mozilla/webrender/webrender_ffi.h";
25 using mozilla::wr::RenderReasons from "mozilla/webrender/webrender_ffi.h";
26 using mozilla::wr::IdNamespace from "mozilla/webrender/WebRenderTypes.h";
27 using mozilla::wr::MaybeIdNamespace from "mozilla/webrender/WebRenderTypes.h";
28 using 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";
31 using mozilla::layers::FocusTarget from "mozilla/layers/FocusTarget.h";
32 using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h";
33 using mozilla::VsyncId from "mozilla/VsyncDispatcher.h";
38 [ManualDealloc, ParentImpl=virtual]
39 sync protocol PWebRenderBridge
41 manager PCompositorBridge;
44 sync EnsureConnected()
45 returns (TextureFactoryIdentifier textureFactoryIdentifier, MaybeIdNamespace maybeIdNamespace, nsCString error);
47 async NewCompositable(CompositableHandle handle, TextureInfo info);
48 async ReleaseCompositable(CompositableHandle compositable);
50 async DeleteCompositorAnimations(uint64_t[] aIds);
51 async SetDisplayList(DisplayListData displayList,
52 OpDestroy[] toDestroy, uint64_t fwdTransactionId, TransactionId transactionId,
53 bool containsSVGGroup,
54 VsyncId vsyncId, TimeStamp vsyncStartTime,
55 TimeStamp refreshStartTime, TimeStamp txnStartTime, nsCString txnURL, TimeStamp fwdTime,
56 CompositionPayload[] payloads);
57 async EmptyTransaction(FocusTarget focusTarget,
58 MaybeTransactionData transationData,
59 OpDestroy[] toDestroy, uint64_t fwdTransactionId, TransactionId transactionId,
60 VsyncId vsyncId, TimeStamp vsyncStartTime,
61 TimeStamp refreshStartTime, TimeStamp txnStartTime,
62 nsCString txnURL, TimeStamp fwdTime,
63 CompositionPayload[] payloads);
64 async SetFocusTarget(FocusTarget focusTarget);
65 async UpdateResources(IdNamespace aIdNamespace, OpUpdateResource[] aResourceUpdates,
66 RefCountedShmem[] aSmallShmems, Shmem[] aLargeShmems);
67 async ParentCommands(IdNamespace aIdNamespace, WebRenderParentCommand[] commands);
68 sync GetSnapshot(PTexture texture) returns (bool aNeedsYFlip);
69 async ClearCachedResources();
70 async ClearAnimationResources();
71 async SetDefaultClearColor(uint32_t aColor);
72 // Invalidate rendered frame
73 async InvalidateRenderedFrame();
74 // Schedule a composite if one isn't already scheduled.
75 async ScheduleComposite(RenderReasons aReasons);
76 // Save the frame capture to disk
79 // Start capturing each frame to disk. See
80 // nsIDOMWindowUtils::wrStartCaptureSequence for documentation.
81 async StartCaptureSequence(nsCString aPath, uint32_t aFlags);
83 // Stop the captures started by StartCaptureSequence. See
84 // nsIDOMWindowUtils::wrStopCaptureSequence for documentation.
85 async StopCaptureSequence();
87 // Replacement for PCompositorBridge::SyncWithCompositor, but for WR. We need
88 // it on PWebRenderBridge because it associated with a particular top-level
89 // window, and PCompositorBridge doesn't allow doing that in a secure manner.
90 sync SyncWithCompositor();
92 // Tell the compositor to notify APZ that a target scroll frame has been
93 // confirmed for an input event.
94 async SetConfirmedTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] aTargets);
98 // Enter test mode, set the sample time to sampleTime, and resample
99 // animations. sampleTime must not be null.
100 sync SetTestSampleTime(TimeStamp sampleTime);
101 // Leave test mode and resume normal compositing
102 sync LeaveTestMode();
104 // Returns the |OMTAValue| for the compositor animation with the given id.
105 sync GetAnimationValue(uint64_t aCompositorAnimationsId) returns (OMTAValue value);
107 // The next time the display list tree is composited, add this async scroll offset
108 // in CSS pixels for the given ViewID.
109 // Useful for testing rendering of async scrolling.
110 sync SetAsyncScrollOffset(ViewID scrollId, float x, float y);
112 // The next time the display list is composited, include this async zoom in
113 // for the given ViewID.
114 // Useful for testing rendering of async zooming.
115 sync SetAsyncZoom(ViewID scrollId, float zoom);
117 // Flush any pending APZ repaints to the main thread.
118 async FlushApzRepaints();
120 // Get a copy of the compositor-side APZ test data instance for this
122 sync GetAPZTestData() returns (APZTestData data);
124 // Child requests frame uniformity measurements
125 sync GetFrameUniformity() returns (FrameUniformityData data);
131 async WrUpdated(IdNamespace aNewIdNamespace, TextureFactoryIdentifier textureFactoryIdentifier);
132 async WrReleasedImages(ExternalImageKeyPair[] pairs);