LayersMessages.ipdlh (13402B)
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 PCompositorBridge; 10 include protocol PTexture; 11 12 include "gfxipc/ShadowLayerUtils.h"; 13 include "mozilla/GfxMessageUtils.h"; 14 include "mozilla/layers/LayersMessageUtils.h"; 15 16 using mozilla::gfx::Glyph from "mozilla/gfx/2D.h"; 17 using mozilla::gfx::SamplingFilter from "mozilla/gfx/2D.h"; 18 using struct mozilla::gfx::DeviceColor from "mozilla/gfx/2D.h"; 19 using mozilla::gfx::Point from "mozilla/gfx/Point.h"; 20 using mozilla::gfx::Point3D from "mozilla/gfx/Point.h"; 21 using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h"; 22 using mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h"; 23 using mozilla::SideBits from "mozilla/gfx/Types.h"; 24 using nscolor from "nsColor.h"; 25 using nscoord from "nsCoord.h"; 26 using struct nsRect from "nsRect.h"; 27 using struct nsPoint from "nsPoint.h"; 28 using mozilla::TimeDuration from "mozilla/TimeStamp.h"; 29 using class mozilla::TimeStamp from "mozilla/TimeStamp.h"; 30 using mozilla::ScreenRotation from "mozilla/WidgetUtils.h"; 31 using NonCustomCSSPropertyId from "NonCustomCSSPropertyId.h"; 32 using mozilla::hal::ScreenOrientation from "mozilla/HalIPCUtils.h"; 33 using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h"; 34 using mozilla::CSSCoord from "Units.h"; 35 using mozilla::CSSPoint from "Units.h"; 36 using mozilla::CSSRect from "Units.h"; 37 using mozilla::gfx::IntSize from "mozilla/gfx/2D.h"; 38 using mozilla::LayerMargin from "Units.h"; 39 using mozilla::LayerPoint from "Units.h"; 40 using mozilla::LayerCoord from "Units.h"; 41 using mozilla::LayerSize from "Units.h"; 42 using mozilla::LayerRect from "Units.h"; 43 using mozilla::LayerIntSize from "Units.h"; 44 using mozilla::LayerIntRect from "Units.h"; 45 using mozilla::LayerIntRegion from "Units.h"; 46 using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h"; 47 using mozilla::ParentLayerIntRect from "Units.h"; 48 using mozilla::ParentLayerRect from "Units.h"; 49 using mozilla::LayoutDeviceIntRect from "Units.h"; 50 using mozilla::LayoutDevicePoint from "Units.h"; 51 using mozilla::LayoutDeviceRect from "Units.h"; 52 using mozilla::layers::ClearImagesType from "ImageContainer.h"; 53 using mozilla::layers::ScaleMode from "mozilla/layers/LayersTypes.h"; 54 using mozilla::layers::EventRegionsOverride from "mozilla/layers/LayersTypes.h"; 55 using mozilla::layers::DiagnosticTypes from "mozilla/layers/CompositorTypes.h"; 56 using mozilla::layers::ScrollableLayerGuid::ViewID from "mozilla/layers/ScrollableLayerGuid.h"; 57 using mozilla::layers::ScrollDirection from "mozilla/layers/LayersTypes.h"; 58 using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h"; 59 using mozilla::layers::LayerHandle from "mozilla/layers/LayersTypes.h"; 60 using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h"; 61 using mozilla::layers::CompositionPayload from "mozilla/layers/LayersTypes.h"; 62 [MoveOnly] using mozilla::CrossProcessSemaphoreHandle from "mozilla/ipc/CrossProcessSemaphore.h"; 63 using struct mozilla::void_t from "mozilla/ipc/IPCCore.h"; 64 using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h"; 65 using mozilla::layers::RemoteTextureId from "mozilla/layers/LayersTypes.h"; 66 using mozilla::layers::RemoteTextureOwnerId from "mozilla/layers/LayersTypes.h"; 67 using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h"; 68 using mozilla::LengthPercentage from "mozilla/ServoStyleConsts.h"; 69 using mozilla::StyleOffsetPath from "mozilla/ServoStyleConsts.h"; 70 using mozilla::StyleOffsetRotate from "mozilla/ServoStyleConsts.h"; 71 using mozilla::StylePositionOrAuto from "mozilla/ServoStyleConsts.h"; 72 using mozilla::StyleOffsetPosition from "mozilla/ServoStyleConsts.h"; 73 using mozilla::StyleRotate from "mozilla/ServoStyleConsts.h"; 74 using mozilla::StyleScale from "mozilla/ServoStyleConsts.h"; 75 using mozilla::StyleTranslate from "mozilla/ServoStyleConsts.h"; 76 using mozilla::StyleTransform from "mozilla/ServoStyleConsts.h"; 77 using mozilla::StyleComputedTimingFunction from "mozilla/ServoStyleConsts.h"; 78 79 namespace mozilla { 80 namespace layers { 81 82 struct TargetConfig { 83 IntRect naturalBounds; 84 ScreenRotation rotation; 85 ScreenOrientation orientation; 86 nsIntRegion clearRegion; 87 }; 88 89 struct OpAttachCompositable { 90 LayerHandle layer; 91 CompositableHandle compositable; 92 }; 93 94 struct OpAttachAsyncCompositable { 95 LayerHandle layer; 96 CompositableHandle compositable; 97 }; 98 struct LayerColor { DeviceColor value; }; 99 100 [Comparable] union Animatable { 101 null_t; 102 float; 103 nscolor; 104 StyleRotate; 105 StyleScale; 106 StyleTranslate; 107 StyleTransform; 108 StyleOffsetPath; 109 LengthPercentage; 110 StyleOffsetRotate; 111 StylePositionOrAuto; 112 StyleOffsetPosition; 113 }; 114 115 struct AnimationSegment { 116 Animatable startState; 117 Animatable endState; 118 float startPortion; 119 float endPortion; 120 uint8_t startComposite; 121 uint8_t endComposite; 122 StyleComputedTimingFunction? sampleFn; 123 }; 124 125 [Comparable] struct MotionPathData { 126 // The transform-origin property for motion in css pixels 127 CSSPoint origin; 128 // The adjustment for the anchor point of motion path. 129 CSSPoint anchorAdjustment; 130 // The coord box of the containing block. 131 nsRect coordBox; 132 // The current position of this transfromed box in the coordinate system of 133 // its containing block. 134 nsPoint currentPosition; 135 // The reference length for computing ray(contain) (in css pixels). 136 CSSCoord rayContainReferenceLength; 137 // The resolved border-radius of its containing block. If the array size is 138 // zero, we don't have radius. 139 nscoord[] coordBoxInsetRadii; 140 }; 141 142 [Comparable] struct PartialPrerenderData { 143 LayoutDeviceRect rect; 144 SideBits overflowedSides; 145 // the scroll id of the nearest scrollable frame of this partial prerender 146 // data. 147 ViewID scrollId; 148 // The clip rectangle of the nearest scrollable frame. 149 // NOTE: This should be used only for fallback cases where APZ is not enabled. 150 ParentLayerRect clipRect; 151 // a transform from the coordinate space of the animated element to a 152 // coordinate space where the `clipRect` can be applied. 153 Matrix4x4 transformInClip; // Used only for WebRender. 154 // the position relative to the reference frame of the animated transform 155 // element in the element coordinate space. 156 LayoutDevicePoint position; // Used only for WebRender. 157 }; 158 159 // Transforms need extra information to correctly convert the list of transform 160 // functions to a Matrix4x4 that can be applied directly to the layer. 161 [Comparable] struct TransformData { 162 // the origin of the frame being transformed in app units 163 nsPoint origin; 164 // the transform-origin property for the transform in device pixels 165 Point3D transformOrigin; 166 nsRect bounds; 167 int32_t appUnitsPerDevPixel; 168 MotionPathData? motionPathData; 169 PartialPrerenderData? partialPrerenderData; 170 }; 171 172 // The scroll timeline information. 173 struct ScrollTimelineOptions { 174 // The source of the scroll-timeline. 175 ViewID source; 176 // The physical direction. 177 ScrollDirection axis; 178 }; 179 180 struct Animation { 181 // The zero time of this Animation's timeline. May be null if isNotPlaying is 182 // true. 183 TimeStamp originTime; 184 // The start time is relative to the originTime. This allows us to represent 185 // start times in the distant past that cannot be expressed using a TimeStamp. 186 TimeDuration? startTime; 187 TimeDuration delay; 188 TimeDuration endDelay; 189 // The value of the animation's current time at the moment it was sent to the 190 // compositor. This value will be used for below cases: 191 // 1) Animations that are play-pending. Initially these animations will have a 192 // null |startTime|. Once the animation is ready to start (i.e. painting 193 // has finished), we calculate an appropriate value of |startTime| such 194 // that playback begins from |holdTime|. 195 // 2) Not playing animations (e.g. paused and finished animations). In this 196 // case the |holdTime| represents the current time the animation will 197 // maintain. 198 TimeDuration holdTime; 199 TimeDuration duration; 200 // For each frame, the interpolation point is computed based on the 201 // startTime, the direction, the duration, and the current time. 202 // The segments must uniquely cover the portion from 0.0 to 1.0 203 AnimationSegment[] segments; 204 // Number of times to repeat the animation, including positive infinity. 205 // Values <= 0 mean the animation will not play (although events are still 206 // dispatched on the main thread). 207 float iterations; 208 float iterationStart; 209 // This uses the NS_STYLE_ANIMATION_DIRECTION_* constants. 210 uint8_t direction; 211 // This uses dom::FillMode. 212 uint8_t fillMode; 213 NonCustomCSSPropertyId property; 214 float playbackRate; 215 // When performing an asynchronous update to the playbackRate, |playbackRate| 216 // above is the updated playbackRate while |previousPlaybackRate| is the 217 // existing playbackRate. This is used by AnimationInfo to update the 218 // startTime based on the 'readyTime' (timestamp at the end of painting) 219 // and is not used beyond that point. 220 // 221 // It is set to numeric_limits<float>::quiet_NaN() when no asynchronous update 222 // to the playbackRate is being performed. 223 float previousPlaybackRate; 224 // This is used in the transformed progress calculation. 225 StyleComputedTimingFunction? easingFunction; 226 uint8_t iterationComposite; 227 // True if the animation has a fixed current time (e.g. paused and 228 // forward-filling animations). 229 bool isNotPlaying; 230 // True if this is not an animating property. For some transform-like 231 // properties, we just send their baseStyles for merging with other animating 232 // properties. In this case, we don't have animation information on this 233 // property, and so don't need to do interpolation. 234 bool isNotAnimating; 235 // The base style that animations should composite with. This is only set for 236 // 1. scroll animations with positive delays, or 237 // 2. animations with a composite mode of additive or accumulate, and only for 238 // the first animation in the set (i.e. the animation that is lowest in the 239 // stack). 240 // In all other cases the value is null_t. 241 Animatable baseStyle; 242 // An optional data specific for transform like properies. 243 TransformData? transformData; 244 // This indicates that a transition whose start value should be replaced. 245 uint64_t? replacedTransitionId; 246 // If this is present, the animation is driven by a ScrollTimeline, and 247 // this structure contains information about that timeline. 248 ScrollTimelineOptions? scrollTimelineOptions; 249 }; 250 251 struct CompositorAnimations { 252 Animation[] animations; 253 // This id is used to map the layer animations between content 254 // and compositor side 255 uint64_t id; 256 }; 257 258 struct UntrustedShmemSection { 259 Shmem shmem; 260 uint32_t offset; 261 uint32_t size; 262 }; 263 264 struct CrossProcessSemaphoreDescriptor { 265 CrossProcessSemaphoreHandle sem; 266 }; 267 268 union ReadLockDescriptor { 269 UntrustedShmemSection; 270 CrossProcessSemaphoreDescriptor; 271 uintptr_t; 272 null_t; 273 }; 274 275 /** 276 * Tells the CompositableHost to remove the corresponding TextureHost 277 */ 278 struct OpRemoveTexture { 279 PTexture texture; 280 }; 281 282 /** 283 * Tells the CompositableHost to clear Images 284 */ 285 struct OpClearImages { 286 ClearImagesType type; 287 }; 288 289 struct TimedTexture { 290 PTexture texture; 291 TimeStamp timeStamp; 292 IntRect picture; 293 uint32_t frameID; 294 uint32_t producerID; 295 bool readLocked; 296 }; 297 298 /** 299 * Tells the compositor-side which textures to use (for example, as front buffer 300 * if there are several textures for double buffering). 301 * This provides a list of textures with timestamps, ordered by timestamp. 302 * The newest texture whose timestamp is <= the current time is rendered 303 * (where null is considered less than every other timestamp). If there is no 304 * such texture, the first texture is rendered. 305 * The first timestamp value can be null, but the others must not be. 306 * The list must not be empty. 307 */ 308 struct OpUseTexture { 309 TimedTexture[] textures; 310 }; 311 312 struct OpUseRemoteTexture { 313 RemoteTextureId textureId; 314 RemoteTextureOwnerId ownerId; 315 IntSize size; 316 TextureFlags textureFlags; 317 }; 318 319 struct OpEnableRemoteTexturePushCallback { 320 RemoteTextureOwnerId ownerId; 321 IntSize size; 322 TextureFlags textureFlags; 323 }; 324 325 struct OpNotifyNotUsed { 326 uint64_t TextureId; 327 uint64_t fwdTransactionId; 328 }; 329 330 union CompositableOperationDetail { 331 OpRemoveTexture; 332 333 OpClearImages; 334 335 OpUseTexture; 336 337 OpUseRemoteTexture; 338 339 OpEnableRemoteTexturePushCallback; 340 }; 341 342 struct CompositableOperation { 343 CompositableHandle compositable; 344 CompositableOperationDetail detail; 345 }; 346 347 // Operations related to destroying resources, always handled after the other 348 // operations for safety. 349 union OpDestroy { 350 PTexture; 351 CompositableHandle; 352 }; 353 354 // Replies to operations 355 356 struct OpContentBufferSwap { 357 CompositableHandle compositable; 358 nsIntRegion frontUpdatedRegion; 359 }; 360 361 /** 362 * An ImageCompositeNotification is sent the first time a particular 363 * image is composited by an ImageHost. 364 */ 365 struct ImageCompositeNotification { 366 CompositableHandle compositable; 367 TimeStamp imageTimeStamp; 368 TimeStamp firstCompositeTimeStamp; 369 uint32_t frameID; 370 uint32_t producerID; 371 }; 372 373 union AsyncParentMessageData { 374 OpNotifyNotUsed; 375 }; 376 377 union OMTAValue { 378 null_t; 379 nscolor; 380 float; 381 Matrix4x4; 382 }; 383 384 } // namespace 385 } // namespace