summaryrefslogtreecommitdiffstats
path: root/gfx/layers/ipc/PLayerTransaction.ipdl
blob: d669b1d653210d9d118c2f56027ea75cf5e33365 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * vim: sw=2 ts=8 et :
 */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

include LayersSurfaces;
include LayersMessages;
include protocol PCompositable;
include protocol PCompositorBridge;
include protocol PLayer;
include protocol PRenderFrame;
include protocol PTexture;

include "mozilla/GfxMessageUtils.h";

using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
using class mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h";
using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";

/**
 * The layers protocol is spoken between thread contexts that manage
 * layer (sub)trees.  The protocol comprises atomically publishing
 * layer subtrees to a "shadow" thread context (which grafts the
 * subtree into its own tree), and atomically updating a published
 * subtree.  ("Atomic" in this sense is wrt painting.)
 */

namespace mozilla {
namespace layers {

union MaybeTransform {
  Matrix4x4;
  void_t;
};

sync protocol PLayerTransaction {
  manager PCompositorBridge;
  manages PLayer;
  manages PCompositable;

parent:
  async PLayer();
  async PCompositable(TextureInfo aTextureInfo);

  // The isFirstPaint flag can be used to indicate that this is the first update
  // for a particular document.
  sync Update(Edit[] cset, OpDestroy[] toDestroy,
              uint64_t fwdTransactionId,
              uint64_t id, TargetConfig targetConfig,
              PluginWindowData[] plugins, bool isFirstPaint,
              bool scheduleComposite, uint32_t paintSequenceNumber,
              bool isRepeatTransaction, TimeStamp transactionStart,
              int32_t paintSyncId)
    returns (EditReply[] reply);

  async PaintTime(uint64_t id, TimeDuration paintTime);

  // We don't need to send a sync transaction if
  // no transaction operate require a swap.
  async UpdateNoSwap(Edit[] cset, OpDestroy[] toDestroy,
                     uint64_t fwdTransactionId,
                     uint64_t id, TargetConfig targetConfig,
                     PluginWindowData[] plugins, bool isFirstPaint,
                     bool scheduleComposite, uint32_t paintSequenceNumber,
                     bool isRepeatTransaction, TimeStamp transactionStart,
                     int32_t paintSyncId);

  async SetLayerObserverEpoch(uint64_t layerObserverEpoch);

  // Testing APIs

  // Enter test mode, set the sample time to sampleTime, and resample
  // animations. sampleTime must not be null.
  sync SetTestSampleTime(TimeStamp sampleTime);
  // Leave test mode and resume normal compositing
  sync LeaveTestMode();

  // Returns the value of the opacity applied to the layer by animation.
  // |hasAnimationOpacity| is true if the layer has an opacity value
  // specified by animation. If it's false, |opacity| value is indefinite.
  sync GetAnimationOpacity(PLayer layer) returns (float opacity,
                                                  bool hasAnimationOpacity);

  // Returns the value of the transform applied to the layer by animation after
  // factoring out translation components introduced to account for the offset
  // of the corresponding frame and transform origin and after converting to CSS
  // pixels. If the layer is not transformed by animation, the return value will
  // be void_t.
  sync GetAnimationTransform(PLayer layer) returns (MaybeTransform transform);

  // The next time the layer tree is composited, add this async scroll offset in
  // CSS pixels for the given ViewID.
  // Useful for testing rendering of async scrolling.
  sync SetAsyncScrollOffset(ViewID id, float x, float y);

  // The next time the layer tree is composited, include this async zoom in
  // for the given ViewID.
  // Useful for testing rendering of async zooming.
  sync SetAsyncZoom(ViewID id, float zoom);

  // Flush any pending APZ repaints to the main thread.
  async FlushApzRepaints();

  // Drop any front buffers that might be retained on the compositor
  // side.
  async ClearCachedResources();

  // Schedule a composite if one isn't already scheduled.
  async ForceComposite();

  // Get a copy of the compositor-side APZ test data instance for this
  // layers id.
  sync GetAPZTestData() returns (APZTestData data);

  // Query a named property from the last frame
  sync RequestProperty(nsString property) returns (float value);

  // Tell the compositor to notify APZ that a layer has been confirmed for an
  // input event.
  async SetConfirmedTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] aTargets);

  async Shutdown();
child:
  async __delete__();
};

} // namespace layers
} // namespace mozilla