os/graphics/graphicscomposition/openwfcompositionengine/composition/include/wfcstructs.h
Update contrib.
1 /* Copyright (c) 2009 The Khronos Group Inc.
2 * Portions copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and/or associated documentation files (the
6 * "Materials"), to deal in the Materials without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Materials, and to
9 * permit persons to whom the Materials are furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Materials.
15 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
28 * \brief Composition SI data structures
38 #include "owfattributes.h"
39 #include "owfmessagequeue.h"
40 #include "owfthread.h"
44 #include "owflinkedlist.h"
45 #include "owfdisplaycontextgeneral.h"
55 typedef struct WFC_DEVICE_ {
58 WFCErrorCode latestUnreadError;
65 typedef struct PHYSICAL_DEVICE_ {
66 OWF_ARRAY iDeviceInstanceArray;
67 OWFint gDeviceHandleID;
71 OWFNativeStreamBuffer targetBuffer;
74 /* Mapped to the external format target image buffer each frame */
75 OWF_IMAGE* targetImage;
76 /* Mapped to the internal format target image to compose to */
77 OWF_IMAGE* internalTargetImage;
79 /* The unrotated target buffer */
80 OWF_IMAGE_INST unrotatedTargetImage;
81 /* The rotated version of the target buffer for hardware rotation,
82 * or a de-rotated version of the internal buffer into another scratch buffer for software rotation
84 OWF_IMAGE_INST rotatedTargetImage;
85 /* The internal target buffer composed to for 0 and 180 degree rotation */
86 OWF_IMAGE_INST unrotatedInternalTargetImage;
87 /* The internal target buffer composed to for 90 and 270 degree rotation */
88 OWF_IMAGE_INST rotatedInternalTargetImage;
92 Scratch buffers needed:
93 1 for cropped source image
94 1 for cropped mask image
95 1 for scaled element image
98 #define SCRATCH_BUFFER_COUNT 5
101 /*! elements, ordered by depth; starting from bottom */
102 struct WFC_CONTEXT_* context;
108 Element's composition state parameters.
111 /*! original source image and mask image - inputs to the first stage */
112 OWF_IMAGE* originalSourceImage;
113 OWF_IMAGE* originalMaskImage;
115 /*! converted source image -
116 results of the first stage in the
118 OWF_IMAGE_INST convertedSourceImage;
120 /*! cropped source image - result of cropping stage */
121 OWF_IMAGE_INST croppedSourceImage;
123 /*! mirrored source intermediate image - temp buffer used in mirroring stage */
124 OWF_IMAGE_INST rotatedSourceIntermediateImage;
126 /*! mirrored source image - result of mirroring stage */
127 OWF_IMAGE_INST flippedSourceImage;
129 /*! rotated source image - result of rotation stage */
130 OWF_IMAGE_INST rotatedSourceImage;
132 /*! these are the "final size" (i.e. destination
133 size) versions of the previous. used in
134 the blending stage */
135 OWF_IMAGE_INST scaledSourceImage;
136 OWF_RECTANGLE scaledSrcRect;
137 OWF_IMAGE_INST maskImage;
140 /*! support for blending operation */
141 OWF_BLEND_INFO blendInfo;
144 /*! source and target extents */
145 WFCfloat sourceRect[4];
146 WFCfloat destinationRect[4];
147 OWF_RECTANGLE dstRect;
149 /*! source fp viewport */
150 WFCfloat transformedSourceRect[4];
152 /*! oversized integer crop */
153 OWF_RECTANGLE oversizedCropRect;
155 /* Other attributes copied from element */
156 OWFsubpixel globalAlpha;
157 WFCScaleFilter sourceScaleFilter;
158 WFCbitfield transparencyTypes;
159 /*! rotation method */
160 WFCRotation rotation;
162 WFCboolean sourceFlip;
170 } WFC_IMAGE_PROVIDER_TYPE;
174 OWFNativeStreamBuffer buffer;
176 OWF_IMAGE_INST image;
183 WFC_IMAGE_PROVIDER_TYPE type;
184 OWFNativeStreamType streamHandle;
186 WFCint contentUpdated;
187 WFCint contentVisible;
190 WFC_LOCK_STREAM lockedStream;
192 } WFC_IMAGE_PROVIDER;
197 struct WFC_CONTEXT_* context;
198 /*! element attributes */
201 WFCboolean sourceFlip;
202 WFCRotation sourceRotation;
203 WFCScaleFilter sourceScaleFilter;
204 WFCbitfield transparencyTypes;
205 WFCfloat globalAlpha;
207 WFCSource sourceHandle;
209 /*! client scene and composed scene dereferenced image providers */
210 WFC_IMAGE_PROVIDER* mask;
211 WFC_IMAGE_PROVIDER* source;
212 WFC_IMAGE_PROVIDER* cachedMask;
213 WFC_IMAGE_PROVIDER* cachedSource;
215 /*! shared element? (must not be destroyed by a scene) */
218 /*! set in WFC_Element_BeginComposition to indicate whether
219 the element should be included in composition */
220 WFCboolean skipCompose;
221 /*! Set in WFC_Element_BeginComposition to indicate whether
222 * the mask stream should be included in composition */
223 WFCboolean maskComposed;
228 WFC_CONTEXT_STATE_PASSIVE,
229 WFC_CONTEXT_STATE_ACTIVATING,
230 WFC_CONTEXT_STATE_ACTIVE,
231 WFC_CONTEXT_STATE_DEACTIVATING
232 } WFC_CONTEXT_ACTIVATION_STATE;
234 typedef EGLint (*TFPtrEglPrivateSignalSyncNok) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
235 #define INITIAL_CONTEXT_SERIAL_NUMBER 0
236 typedef struct WFC_CONTEXT_ {
240 /*! work-in-progress scene */
241 WFC_SCENE* workScene;
242 WFC_SCENE* committedScene;
243 WFC_SCENE* snapshotScene;
245 /*! pools for resource allocation */
248 OWF_POOL* elementPool;
250 /*! screen number for on-screen contexts */
253 /*! scratch buffers used in composition to store per-element
254 intermediate results */
255 void* scratchBuffer[SCRATCH_BUFFER_COUNT];
257 /*! onscreen/offscreen write stream */
258 OWFNativeStreamType stream;
262 WFCRotation rotation;
263 OWFuint32 backgroundColor;
264 WFCElement lowestElement;
265 OWF_ATTRIBUTE_LIST attributes;
266 WFCint clientElementCount;
268 /*! timing & synchronization */
269 OWF_MESSAGE_QUEUE composerQueue;
270 OWF_THREAD composerThread;
271 WFC_CONTEXT_ACTIVATION_STATE activationState;
272 OWF_SEMAPHORE compositionSemaphore;
273 OWF_SEMAPHORE commitSemaphore;
274 OWF_MUTEX updateFlagMutex;
275 OWF_MUTEX sceneMutex;
276 WFCint sourceUpdateCount;
278 WFC_CONTEXT_STATE state;
279 OWF_DISPCTX displayContext;
281 WFCEGLDisplay nextSyncObjectDisplay;
282 WFC_ELEMENT_STATE prototypeElementState;
283 TFPtrEglPrivateSignalSyncNok eglPrivateSignalSync;
287 #define IMAGE_PROVIDER(x) ((WFC_IMAGE_PROVIDER*)(x))
288 #define ELEMENT(x) ((WFC_ELEMENT*)(x))
289 #define CONTEXT(x) ((WFC_CONTEXT*)(x))
290 #define DEVICE(x) ((WFC_DEVICE*)(x))
291 #define SCENE(x) ((WFC_SCENE*)(x))
292 #define STREAM(x) ((OWF_STREAM*)(x))
298 #endif /*STRUCTS_H_*/