1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/layers/ipc/LayersMessages.ipdlh Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,432 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * vim: sw=2 ts=8 et : 1.6 + */ 1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.10 + 1.11 +include LayersSurfaces; 1.12 +include protocol PCompositable; 1.13 +include protocol PCompositor; 1.14 +include protocol PGrallocBuffer; 1.15 +include protocol PLayer; 1.16 +include protocol PRenderFrame; 1.17 +include protocol PTexture; 1.18 + 1.19 +include "gfxipc/ShadowLayerUtils.h"; 1.20 +include "mozilla/GfxMessageUtils.h"; 1.21 +include "ImageLayers.h"; 1.22 + 1.23 +using mozilla::GraphicsFilterType from "mozilla/GfxMessageUtils.h"; 1.24 +using struct gfxRGBA from "gfxColor.h"; 1.25 +using struct gfxPoint3D from "gfxPoint3D.h"; 1.26 +using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h"; 1.27 +using class gfx3DMatrix from "gfx3DMatrix.h"; 1.28 +using nscoord from "nsCoord.h"; 1.29 +using struct nsIntPoint from "nsPoint.h"; 1.30 +using struct nsRect from "nsRect.h"; 1.31 +using struct nsPoint from "nsPoint.h"; 1.32 +using class mozilla::TimeDuration from "mozilla/TimeStamp.h"; 1.33 +using class mozilla::TimeStamp from "mozilla/TimeStamp.h"; 1.34 +using mozilla::ScreenRotation from "mozilla/WidgetUtils.h"; 1.35 +using nsCSSProperty from "nsCSSProperty.h"; 1.36 +using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h"; 1.37 +using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h"; 1.38 +using mozilla::LayerMargin from "Units.h"; 1.39 +using mozilla::LayerPoint from "Units.h"; 1.40 +using mozilla::LayerRect from "Units.h"; 1.41 +using mozilla::layers::ScaleMode from "mozilla/layers/LayersTypes.h"; 1.42 +using mozilla::layers::EventRegions from "mozilla/layers/LayersTypes.h"; 1.43 +using mozilla::layers::DiagnosticTypes from "mozilla/layers/CompositorTypes.h"; 1.44 +using struct mozilla::layers::FrameMetrics from "FrameMetrics.h"; 1.45 +using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h"; 1.46 +using struct mozilla::layers::FenceHandle from "mozilla/layers/FenceUtils.h"; 1.47 + 1.48 +namespace mozilla { 1.49 +namespace layers { 1.50 + 1.51 +struct TargetConfig { 1.52 + nsIntRect naturalBounds; 1.53 + ScreenRotation rotation; 1.54 + nsIntRect clientBounds; 1.55 + ScreenOrientation orientation; 1.56 + nsIntRegion clearRegion; 1.57 +}; 1.58 + 1.59 +// Create a shadow layer for |layer| 1.60 +struct OpCreateThebesLayer { PLayer layer; }; 1.61 +struct OpCreateContainerLayer { PLayer layer; }; 1.62 +struct OpCreateImageLayer { PLayer layer; }; 1.63 +struct OpCreateColorLayer { PLayer layer; }; 1.64 +struct OpCreateCanvasLayer { PLayer layer; }; 1.65 +struct OpCreateRefLayer { PLayer layer; }; 1.66 + 1.67 +struct OpAttachCompositable { 1.68 + PLayer layer; 1.69 + PCompositable compositable; 1.70 +}; 1.71 + 1.72 +struct OpAttachAsyncCompositable { 1.73 + PLayer layer; 1.74 + uint64_t containerID; 1.75 +}; 1.76 + 1.77 +struct ThebesBufferData { 1.78 + nsIntRect rect; 1.79 + nsIntPoint rotation; 1.80 +}; 1.81 + 1.82 +struct CubicBezierFunction { 1.83 + float x1; 1.84 + float y1; 1.85 + float x2; 1.86 + float y2; 1.87 +}; 1.88 + 1.89 +struct StepFunction { 1.90 + int steps; 1.91 + // 1 = nsTimingFunction::StepStart, 2 = nsTimingFunction::StepEnd 1.92 + int type; 1.93 +}; 1.94 + 1.95 +union TimingFunction { 1.96 + CubicBezierFunction; 1.97 + StepFunction; 1.98 +}; 1.99 + 1.100 +struct LayerColor { gfxRGBA value; }; 1.101 +struct Perspective { float value; }; 1.102 +struct RotationX { float radians; }; 1.103 +struct RotationY { float radians; }; 1.104 +struct RotationZ { float radians; }; 1.105 +struct Rotation { float radians; }; 1.106 +struct Rotation3D { 1.107 + float x; 1.108 + float y; 1.109 + float z; 1.110 + float radians; 1.111 +}; 1.112 +struct Scale { 1.113 + float x; 1.114 + float y; 1.115 + float z; 1.116 +}; 1.117 +struct Skew { float x; float y; }; 1.118 +struct SkewX { float x; }; 1.119 +struct SkewY { float y; }; 1.120 +struct TransformMatrix { Matrix4x4 value; }; 1.121 +struct Translation { 1.122 + float x; 1.123 + float y; 1.124 + float z; 1.125 +}; 1.126 + 1.127 +union TransformFunction { 1.128 + Perspective; 1.129 + RotationX; 1.130 + RotationY; 1.131 + RotationZ; 1.132 + Rotation; 1.133 + Rotation3D; 1.134 + Scale; 1.135 + Skew; 1.136 + SkewX; 1.137 + SkewY; 1.138 + Translation; 1.139 + TransformMatrix; 1.140 +}; 1.141 + 1.142 +union Animatable { 1.143 + float; 1.144 + TransformFunction[]; 1.145 +}; 1.146 + 1.147 +struct AnimationSegment { 1.148 + Animatable startState; 1.149 + Animatable endState; 1.150 + float startPortion; 1.151 + float endPortion; 1.152 + TimingFunction sampleFn; 1.153 +}; 1.154 + 1.155 +// Transforms need extra information to correctly convert the list of transform 1.156 +// functions to a gfx3DMatrix that can be applied directly to the layer. 1.157 +struct TransformData { 1.158 + // the origin of the frame being transformed in app units 1.159 + nsPoint origin; 1.160 + // the transform-origin property for the transform in css pixels 1.161 + gfxPoint3D transformOrigin; 1.162 + // the perspective-origin property for the transform in css pixels 1.163 + gfxPoint3D perspectiveOrigin; 1.164 + nsRect bounds; 1.165 + nscoord perspective; 1.166 + int32_t appUnitsPerDevPixel; 1.167 +}; 1.168 + 1.169 +union AnimationData { 1.170 + null_t; 1.171 + TransformData; 1.172 +}; 1.173 + 1.174 +struct Animation { 1.175 + // Unlike in nsAnimationManager, this start time is at the end of the 1.176 + // delay. If the delay is changed dynamically, the layer's data will 1.177 + // be updated. 1.178 + TimeStamp startTime; 1.179 + TimeDuration duration; 1.180 + // For each frame, the interpolation point is computed based on the 1.181 + // startTime, the direction, the duration, and the current time. 1.182 + // The segments must uniquely cover the portion from 0.0 to 1.0 1.183 + AnimationSegment[] segments; 1.184 + // How many times to repeat the animation. -1 means "forever". 1.185 + float numIterations; 1.186 + // This uses the NS_STYLE_ANIMATION_DIRECTION_* constants. 1.187 + int32_t direction; 1.188 + nsCSSProperty property; 1.189 + AnimationData data; 1.190 +}; 1.191 + 1.192 +// Change a layer's attributes 1.193 +struct CommonLayerAttributes { 1.194 + nsIntRegion visibleRegion; 1.195 + EventRegions eventRegions; 1.196 + TransformMatrix transform; 1.197 + float postXScale; 1.198 + float postYScale; 1.199 + uint32_t contentFlags; 1.200 + float opacity; 1.201 + bool useClipRect; 1.202 + nsIntRect clipRect; 1.203 + bool isFixedPosition; 1.204 + LayerPoint fixedPositionAnchor; 1.205 + LayerMargin fixedPositionMargin; 1.206 + bool isStickyPosition; 1.207 + uint64_t stickyScrollContainerId; 1.208 + LayerRect stickyScrollRangeOuter; 1.209 + LayerRect stickyScrollRangeInner; 1.210 + uint64_t scrollbarTargetContainerId; 1.211 + uint32_t scrollbarDirection; 1.212 + nullable PLayer maskLayer; 1.213 + // Animated colors will only honored for ColorLayers. 1.214 + Animation[] animations; 1.215 + nsIntRegion invalidRegion; 1.216 +}; 1.217 + 1.218 +struct ThebesLayerAttributes { 1.219 + nsIntRegion validRegion; 1.220 +}; 1.221 +struct ContainerLayerAttributes { 1.222 + FrameMetrics metrics; 1.223 + ViewID scrollParentId; 1.224 + float preXScale; 1.225 + float preYScale; 1.226 + float inheritedXScale; 1.227 + float inheritedYScale; 1.228 +}; 1.229 +struct ColorLayerAttributes { LayerColor color; nsIntRect bounds; }; 1.230 +struct CanvasLayerAttributes { GraphicsFilterType filter; nsIntRect bounds; }; 1.231 +struct RefLayerAttributes { int64_t id; }; 1.232 +struct ImageLayerAttributes { GraphicsFilterType filter; IntSize scaleToSize; ScaleMode scaleMode; }; 1.233 + 1.234 +union SpecificLayerAttributes { 1.235 + null_t; 1.236 + ThebesLayerAttributes; 1.237 + ContainerLayerAttributes; 1.238 + ColorLayerAttributes; 1.239 + CanvasLayerAttributes; 1.240 + RefLayerAttributes; 1.241 + ImageLayerAttributes; 1.242 +}; 1.243 + 1.244 +struct LayerAttributes { 1.245 + CommonLayerAttributes common; 1.246 + SpecificLayerAttributes specific; 1.247 +}; 1.248 + 1.249 +struct OpSetLayerAttributes { 1.250 + PLayer layer; 1.251 + LayerAttributes attrs; 1.252 +}; 1.253 + 1.254 +// Monkey with the tree structure 1.255 +struct OpSetRoot { PLayer root; }; 1.256 +struct OpInsertAfter { PLayer container; PLayer childLayer; PLayer after; }; 1.257 +struct OpPrependChild { PLayer container; PLayer childLayer; }; 1.258 +struct OpRemoveChild { PLayer container; PLayer childLayer; }; 1.259 +struct OpRepositionChild { PLayer container; PLayer childLayer; PLayer after; }; 1.260 +struct OpRaiseToTopChild { PLayer container; PLayer childLayer; }; 1.261 + 1.262 +struct OpSetDiagnosticTypes { DiagnosticTypes diagnostics; }; 1.263 + 1.264 +struct ShmemSection { 1.265 + Shmem shmem; 1.266 + uint32_t offset; 1.267 + size_t size; 1.268 +}; 1.269 + 1.270 +union TileLock { 1.271 + ShmemSection; 1.272 + uintptr_t; 1.273 +}; 1.274 + 1.275 +struct TexturedTileDescriptor { 1.276 + PTexture texture; 1.277 + TileLock sharedLock; 1.278 +}; 1.279 + 1.280 +struct PlaceholderTileDescriptor { 1.281 +}; 1.282 + 1.283 +union TileDescriptor { 1.284 + TexturedTileDescriptor; 1.285 + PlaceholderTileDescriptor; 1.286 +}; 1.287 + 1.288 +struct SurfaceDescriptorTiles { 1.289 + nsIntRegion validRegion; 1.290 + nsIntRegion paintedRegion; 1.291 + TileDescriptor[] tiles; 1.292 + int retainedWidth; 1.293 + int retainedHeight; 1.294 + float resolution; 1.295 + float frameResolution; 1.296 +}; 1.297 + 1.298 +struct OpUseTiledLayerBuffer { 1.299 + PCompositable compositable; 1.300 + SurfaceDescriptorTiles tileLayerDescriptor; 1.301 +}; 1.302 + 1.303 +struct OpCreatedIncrementalTexture { 1.304 + PCompositable compositable; 1.305 + TextureInfo textureInfo; 1.306 + nsIntRect bufferRect; 1.307 +}; 1.308 + 1.309 +struct OpPaintTextureRegion { 1.310 + PCompositable compositable; 1.311 + ThebesBufferData bufferData; 1.312 + nsIntRegion updatedRegion; 1.313 +}; 1.314 + 1.315 +struct OpPaintTextureIncremental { 1.316 + PCompositable compositable; 1.317 + uint32_t textureId; 1.318 + SurfaceDescriptor image; 1.319 + nsIntRegion updatedRegion; 1.320 + nsIntRect bufferRect; 1.321 + nsIntPoint bufferRotation; 1.322 +}; 1.323 + 1.324 +struct OpUpdatePictureRect { 1.325 + PCompositable compositable; 1.326 + nsIntRect picture; 1.327 +}; 1.328 + 1.329 +/** 1.330 + * Tells the CompositableHost to remove the corresponding TextureHost 1.331 + */ 1.332 +struct OpRemoveTexture { 1.333 + PCompositable compositable; 1.334 + PTexture texture; 1.335 +}; 1.336 + 1.337 +/** 1.338 + * Tells the compositor-side which texture to use (for example, as front buffer 1.339 + * if there is several textures for double buffering) 1.340 + */ 1.341 +struct OpUseTexture { 1.342 + PCompositable compositable; 1.343 + PTexture texture; 1.344 +}; 1.345 + 1.346 +struct OpUseComponentAlphaTextures { 1.347 + PCompositable compositable; 1.348 + PTexture textureOnBlack; 1.349 + PTexture textureOnWhite; 1.350 +}; 1.351 + 1.352 +union MaybeRegion { 1.353 + nsIntRegion; 1.354 + null_t; 1.355 +}; 1.356 + 1.357 +struct OpUpdateTexture { 1.358 + PCompositable compositable; 1.359 + PTexture texture; 1.360 + MaybeRegion region; 1.361 +}; 1.362 + 1.363 +union CompositableOperation { 1.364 + OpUpdatePictureRect; 1.365 + 1.366 + OpCreatedIncrementalTexture; 1.367 + 1.368 + OpPaintTextureRegion; 1.369 + OpPaintTextureIncremental; 1.370 + 1.371 + OpUseTiledLayerBuffer; 1.372 + 1.373 + OpRemoveTexture; 1.374 + 1.375 + OpUpdateTexture; 1.376 + OpUseTexture; 1.377 + OpUseComponentAlphaTextures; 1.378 +}; 1.379 + 1.380 +// A unit of a changeset; a set of these comprise a changeset 1.381 +union Edit { 1.382 + OpCreateThebesLayer; 1.383 + OpCreateContainerLayer; 1.384 + OpCreateImageLayer; 1.385 + OpCreateColorLayer; 1.386 + OpCreateCanvasLayer; 1.387 + OpCreateRefLayer; 1.388 + 1.389 + OpSetLayerAttributes; 1.390 + OpSetDiagnosticTypes; 1.391 + 1.392 + OpSetRoot; 1.393 + OpInsertAfter; 1.394 + OpPrependChild; 1.395 + OpRemoveChild; 1.396 + OpRepositionChild; 1.397 + OpRaiseToTopChild; 1.398 + 1.399 + OpAttachCompositable; 1.400 + OpAttachAsyncCompositable; 1.401 + 1.402 + CompositableOperation; 1.403 +}; 1.404 + 1.405 + 1.406 +// Replies to operations 1.407 + 1.408 +struct OpContentBufferSwap { 1.409 + PCompositable compositable; 1.410 + nsIntRegion frontUpdatedRegion; 1.411 +}; 1.412 + 1.413 +struct OpTextureSwap { 1.414 + PCompositable compositable; 1.415 + uint32_t textureId; 1.416 + SurfaceDescriptor image; 1.417 +}; 1.418 + 1.419 +struct ReturnReleaseFence { 1.420 + PCompositable compositable; 1.421 + PTexture texture; 1.422 + FenceHandle fence; 1.423 +}; 1.424 + 1.425 +// Unit of a "changeset reply". This is a weird abstraction, probably 1.426 +// only to be used for buffer swapping. 1.427 +union EditReply { 1.428 + OpContentBufferSwap; 1.429 + OpTextureSwap; 1.430 + 1.431 + ReturnReleaseFence; 1.432 +}; 1.433 + 1.434 +} // namespace 1.435 +} // namespace