1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5include "gfxipc/ShadowLayerUtils.h";
6
7using struct gfxPoint from "gfxPoint.h";
8using nsIntRegion from "nsRegion.h";
9using struct mozilla::layers::SurfaceDescriptorX11 from "gfxipc/SurfaceDescriptor.h";
10using mozilla::StereoMode from "ImageTypes.h";
11using struct mozilla::null_t from "mozilla/ipc/IPCCore.h";
12using mozilla::WindowsHandle from "mozilla/ipc/IPCTypes.h";
13using mozilla::gfx::YUVColorSpace from "mozilla/gfx/Types.h";
14using mozilla::gfx::ColorDepth from "mozilla/gfx/Types.h";
15using mozilla::gfx::ColorRange from "mozilla/gfx/Types.h";
16using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
17using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
18using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
19using mozilla::ipc::SharedMemoryBasic::Handle from "mozilla/ipc/SharedMemoryBasic.h";
20using gfxImageFormat from "gfxTypes.h";
21using mozilla::layers::MaybeVideoBridgeSource from "mozilla/layers/VideoBridgeUtils.h";
22
23namespace mozilla {
24namespace layers {
25
26[Comparable] struct SurfaceDescriptorFileMapping {
27  WindowsHandle handle;
28  SurfaceFormat format;
29  IntSize size;
30};
31
32[Comparable] struct SurfaceDescriptorDIB {
33  // gfxWindowsSurface*
34  uintptr_t surface;
35};
36
37[Comparable] struct SurfaceDescriptorD3D10 {
38  WindowsHandle handle;
39  SurfaceFormat format;
40  IntSize size;
41  YUVColorSpace yUVColorSpace;
42  ColorRange colorRange;
43};
44
45[Comparable] struct SurfaceDescriptorDXGIYCbCr {
46  WindowsHandle handleY;
47  WindowsHandle handleCb;
48  WindowsHandle handleCr;
49  IntSize size;
50  IntSize sizeY;
51  IntSize sizeCbCr;
52  ColorDepth colorDepth;
53  YUVColorSpace yUVColorSpace;
54  ColorRange colorRange;
55};
56
57[Comparable] struct SurfaceDescriptorMacIOSurface {
58  uint32_t surfaceId;
59  bool isOpaque;
60  YUVColorSpace yUVColorSpace;
61};
62
63[Comparable] struct SurfaceDescriptorDMABuf {
64  uint32_t bufferType;
65  uint64_t modifier;
66  uint32_t flags;
67  FileDescriptor[] fds;
68  uint32_t[] width;
69  uint32_t[] height;
70  uint32_t[] format;
71  uint32_t[] strides;
72  uint32_t[] offsets;
73  YUVColorSpace yUVColorSpace;
74  FileDescriptor[] fence;
75  uint32_t uid;
76  FileDescriptor[] refCount;
77};
78
79[Comparable] struct SurfaceTextureDescriptor {
80  uint64_t handle;
81  IntSize size;
82  SurfaceFormat format;
83  bool continuous;
84  bool ignoreTransform;
85};
86
87[Comparable] struct SurfaceDescriptorAndroidHardwareBuffer {
88  FileDescriptor handle;
89  uint64_t bufferId;
90  IntSize size;
91  SurfaceFormat format;
92};
93
94[Comparable] struct EGLImageDescriptor {
95  uintptr_t image; // `EGLImage` is a `void*`.
96  uintptr_t fence;
97  IntSize size;
98  bool hasAlpha;
99};
100
101[Comparable] struct SurfaceDescriptorSharedGLTexture {
102  uint32_t texture;
103  uint32_t target;
104  uintptr_t fence;
105  IntSize size;
106  bool hasAlpha;
107};
108
109
110[Comparable] union RemoteDecoderVideoSubDescriptor {
111  SurfaceDescriptorD3D10;
112  SurfaceDescriptorDXGIYCbCr;
113  SurfaceDescriptorDMABuf;
114  SurfaceDescriptorMacIOSurface;
115  null_t;
116};
117
118[Comparable] struct SurfaceDescriptorRemoteDecoder {
119  uint64_t handle;
120  RemoteDecoderVideoSubDescriptor subdesc;
121  MaybeVideoBridgeSource source;
122};
123
124[Comparable] union SurfaceDescriptorGPUVideo {
125  SurfaceDescriptorRemoteDecoder;
126};
127
128[Comparable] struct RGBDescriptor {
129  IntSize size;
130  SurfaceFormat format;
131  bool hasIntermediateBuffer;
132};
133
134[Comparable] struct YCbCrDescriptor {
135  IntRect display;
136  IntSize ySize;
137  uint32_t yStride;
138  IntSize cbCrSize;
139  uint32_t cbCrStride;
140  uint32_t yOffset;
141  uint32_t cbOffset;
142  uint32_t crOffset;
143  StereoMode stereoMode;
144  ColorDepth colorDepth;
145  YUVColorSpace yUVColorSpace;
146  ColorRange colorRange;
147  bool hasIntermediateBuffer;
148};
149
150[Comparable] union BufferDescriptor {
151  RGBDescriptor;
152  YCbCrDescriptor;
153};
154
155[Comparable] union MemoryOrShmem {
156  uintptr_t;
157  Shmem;
158};
159
160[Comparable] struct SurfaceDescriptorBuffer {
161  BufferDescriptor desc;
162  MemoryOrShmem data;
163};
164
165[Comparable] struct SurfaceDescriptorShared
166{
167  IntSize size;
168  int32_t stride;
169  SurfaceFormat format;
170  Handle handle;
171};
172
173[Comparable] struct SurfaceDescriptorRecorded {
174  int64_t textureId;
175};
176
177[Comparable] union SurfaceDescriptor {
178  SurfaceDescriptorBuffer;
179  SurfaceDescriptorDIB;
180  SurfaceDescriptorD3D10;
181  SurfaceDescriptorFileMapping;
182  SurfaceDescriptorDXGIYCbCr;
183  SurfaceDescriptorX11;
184  SurfaceDescriptorDMABuf;
185  SurfaceTextureDescriptor;
186  SurfaceDescriptorAndroidHardwareBuffer;
187  EGLImageDescriptor;
188  SurfaceDescriptorMacIOSurface;
189  SurfaceDescriptorSharedGLTexture;
190  SurfaceDescriptorGPUVideo;
191  SurfaceDescriptorRecorded;
192  null_t;
193};
194
195} // namespace
196} // namespace
197