|
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 |
|
8 include LayersSurfaces; |
|
9 include protocol PGrallocBuffer; |
|
10 include protocol PLayerTransaction; |
|
11 include "mozilla/GfxMessageUtils.h"; |
|
12 include "nsRegion.h"; |
|
13 |
|
14 using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; |
|
15 using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h"; |
|
16 using struct mozilla::layers::FrameMetrics from "FrameMetrics.h"; |
|
17 using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h"; |
|
18 using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h"; |
|
19 using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h"; |
|
20 using mozilla::ipc::SharedMemoryBasic::Handle from "mozilla/ipc/SharedMemoryBasic.h"; |
|
21 using class mozilla::TimeStamp from "mozilla/TimeStamp.h"; |
|
22 |
|
23 namespace mozilla { |
|
24 namespace layers { |
|
25 |
|
26 |
|
27 /** |
|
28 * The PCompositor protocol is used to manage communication between |
|
29 * the main thread and the compositor thread context. It's primary |
|
30 * purpose is to manage the PLayerTransaction sub protocol. |
|
31 */ |
|
32 // This should really be 'sync', but we're using 'rpc' as a workaround |
|
33 // for Bug 716631. |
|
34 intr protocol PCompositor |
|
35 { |
|
36 // A Compositor manages a single Layer Manager (PLayerTransaction) |
|
37 manages PLayerTransaction; |
|
38 |
|
39 child: |
|
40 // The child should invalidate everything so that the whole window is redrawn. |
|
41 async InvalidateAll(); |
|
42 |
|
43 // The compositor completed a layers transaction. id is the layers id |
|
44 // of the child layer tree that was composited (or 0 when notifying |
|
45 // the root layer tree). |
|
46 async DidComposite(uint64_t id); |
|
47 |
|
48 parent: |
|
49 |
|
50 // The child is about to be destroyed, so perform any necessary cleanup. |
|
51 sync WillStop(); |
|
52 |
|
53 // Clean up in preparation for own destruction. |
|
54 sync Stop(); |
|
55 |
|
56 // Pause/resume the compositor. These are intended to be used on mobile, when |
|
57 // the compositor needs to pause/resume in lockstep with the application. |
|
58 sync Pause(); |
|
59 sync Resume(); |
|
60 |
|
61 async NotifyChildCreated(uint64_t id); |
|
62 |
|
63 // Make a snapshot of the content that would have been drawn to our |
|
64 // render target at the time this message is received. If the size |
|
65 // or format of |inSnapshot| doesn't match our render target, |
|
66 // results are undefined. |
|
67 // |
|
68 // NB: this message will result in animations, transforms, effects, |
|
69 // and so forth being interpolated. That's what we want to happen. |
|
70 sync MakeSnapshot(SurfaceDescriptor inSnapshot) |
|
71 returns (SurfaceDescriptor outSnapshot); |
|
72 |
|
73 // Make sure any pending composites are started immediately and |
|
74 // block until they are completed. |
|
75 sync FlushRendering(); |
|
76 |
|
77 sync StartFrameTimeRecording(int32_t bufferSize) |
|
78 returns (uint32_t startIndex); |
|
79 |
|
80 sync StopFrameTimeRecording(uint32_t startIndex) |
|
81 returns (float[] intervals); |
|
82 |
|
83 // layersBackendHints is an ordered list of preffered backends where |
|
84 // layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE |
|
85 // that hint is ignored. |
|
86 sync PLayerTransaction(LayersBackend[] layersBackendHints, uint64_t id) |
|
87 returns (TextureFactoryIdentifier textureFactoryIdentifier, bool success); |
|
88 |
|
89 // Notify the compositor that a region of the screen has been invalidated. |
|
90 async NotifyRegionInvalidated(nsIntRegion region); |
|
91 |
|
92 child: |
|
93 // Send back Compositor Frame Metrics from APZCs so tiled layers can |
|
94 // update progressively. |
|
95 async SharedCompositorFrameMetrics(Handle metrics, CrossProcessMutexHandle mutex, uint32_t aAPZCId); |
|
96 async ReleaseSharedCompositorFrameMetrics(ViewID aId, uint32_t aAPZCId); |
|
97 }; |
|
98 |
|
99 } // layers |
|
100 } // mozilla |