1 | /* $Id: cr_vreg.h 69500 2017-10-28 15:14:05Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Visible Regions processing API
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2017 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___cr_vreg_h_
|
---|
19 | #define ___cr_vreg_h_
|
---|
20 |
|
---|
21 | #include <iprt/list.h>
|
---|
22 | #include <iprt/types.h>
|
---|
23 | #include <iprt/mem.h>
|
---|
24 | #include <iprt/string.h>
|
---|
25 | #include <iprt/assert.h>
|
---|
26 | #include <iprt/critsect.h>
|
---|
27 | #include <iprt/asm.h>
|
---|
28 |
|
---|
29 | #ifndef IN_RING0
|
---|
30 | # define VBOXVREGDECL(_type) DECLEXPORT(_type)
|
---|
31 | #else
|
---|
32 | /** @todo r=bird: Using RTDECL is just SOO wrong! */
|
---|
33 | # define VBOXVREGDECL(_type) RTDECL(_type)
|
---|
34 | #endif
|
---|
35 |
|
---|
36 |
|
---|
37 |
|
---|
38 | RT_C_DECLS_BEGIN
|
---|
39 |
|
---|
40 | typedef struct VBOXVR_LIST
|
---|
41 | {
|
---|
42 | RTLISTANCHOR ListHead;
|
---|
43 | uint32_t cEntries;
|
---|
44 | } VBOXVR_LIST;
|
---|
45 | typedef VBOXVR_LIST *PVBOXVR_LIST;
|
---|
46 | typedef VBOXVR_LIST const *PCVBOXVR_LIST;
|
---|
47 |
|
---|
48 | DECLINLINE(int) VBoxRectCmp(PCRTRECT pRect1, PCRTRECT pRect2)
|
---|
49 | {
|
---|
50 | return memcmp(pRect1, pRect2, sizeof(*pRect1));
|
---|
51 | }
|
---|
52 |
|
---|
53 | #ifndef IN_RING0
|
---|
54 | # define CR_FLOAT_RCAST(_t, _v) ((_t)((float)(_v) + 0.5))
|
---|
55 |
|
---|
56 | DECLINLINE(void) VBoxRectScale(PRTRECT pRect, float xScale, float yScale)
|
---|
57 | {
|
---|
58 | pRect->xLeft = CR_FLOAT_RCAST(int32_t, pRect->xLeft * xScale);
|
---|
59 | pRect->yTop = CR_FLOAT_RCAST(int32_t, pRect->yTop * yScale);
|
---|
60 | pRect->xRight = CR_FLOAT_RCAST(int32_t, pRect->xRight * xScale);
|
---|
61 | pRect->yBottom = CR_FLOAT_RCAST(int32_t, pRect->yBottom * yScale);
|
---|
62 | }
|
---|
63 |
|
---|
64 | DECLINLINE(void) VBoxRectScaled(PCRTRECT pRect, float xScale, float yScale, PRTRECT pResult)
|
---|
65 | {
|
---|
66 | *pResult = *pRect;
|
---|
67 | VBoxRectScale(pResult, xScale, yScale);
|
---|
68 | }
|
---|
69 |
|
---|
70 | DECLINLINE(void) VBoxRectUnscale(PRTRECT pRect, float xScale, float yScale)
|
---|
71 | {
|
---|
72 | pRect->xLeft = CR_FLOAT_RCAST(int32_t, pRect->xLeft / xScale);
|
---|
73 | pRect->yTop = CR_FLOAT_RCAST(int32_t, pRect->yTop / yScale);
|
---|
74 | pRect->xRight = CR_FLOAT_RCAST(int32_t, pRect->xRight / xScale);
|
---|
75 | pRect->yBottom = CR_FLOAT_RCAST(int32_t, pRect->yBottom / yScale);
|
---|
76 | }
|
---|
77 |
|
---|
78 | DECLINLINE(void) VBoxRectUnscaled(PCRTRECT pRect, float xScale, float yScale, PRTRECT pResult)
|
---|
79 | {
|
---|
80 | *pResult = *pRect;
|
---|
81 | VBoxRectUnscale(pResult, xScale, yScale);
|
---|
82 | }
|
---|
83 |
|
---|
84 | #endif /* IN_RING0 */
|
---|
85 |
|
---|
86 | DECLINLINE(void) VBoxRectIntersect(PRTRECT pRect1, PCRTRECT pRect2)
|
---|
87 | {
|
---|
88 | Assert(pRect1);
|
---|
89 | Assert(pRect2);
|
---|
90 | pRect1->xLeft = RT_MAX(pRect1->xLeft, pRect2->xLeft);
|
---|
91 | pRect1->yTop = RT_MAX(pRect1->yTop, pRect2->yTop);
|
---|
92 | pRect1->xRight = RT_MIN(pRect1->xRight, pRect2->xRight);
|
---|
93 | pRect1->yBottom = RT_MIN(pRect1->yBottom, pRect2->yBottom);
|
---|
94 | /* ensure the rect is valid */
|
---|
95 | pRect1->xRight = RT_MAX(pRect1->xRight, pRect1->xLeft);
|
---|
96 | pRect1->yBottom = RT_MAX(pRect1->yBottom, pRect1->yTop);
|
---|
97 | }
|
---|
98 |
|
---|
99 | DECLINLINE(void) VBoxRectIntersected(PCRTRECT pRect1, PCRTRECT pRect2, PRTRECT pResult)
|
---|
100 | {
|
---|
101 | *pResult = *pRect1;
|
---|
102 | VBoxRectIntersect(pResult, pRect2);
|
---|
103 | }
|
---|
104 |
|
---|
105 |
|
---|
106 | DECLINLINE(void) VBoxRectTranslate(PRTRECT pRect, int32_t x, int32_t y)
|
---|
107 | {
|
---|
108 | pRect->xLeft += x;
|
---|
109 | pRect->yTop += y;
|
---|
110 | pRect->xRight += x;
|
---|
111 | pRect->yBottom += y;
|
---|
112 | }
|
---|
113 |
|
---|
114 | DECLINLINE(void) VBoxRectTranslated(PCRTRECT pRect, int32_t x, int32_t y, PRTRECT pResult)
|
---|
115 | {
|
---|
116 | *pResult = *pRect;
|
---|
117 | VBoxRectTranslate(pResult, x, y);
|
---|
118 | }
|
---|
119 |
|
---|
120 | DECLINLINE(void) VBoxRectInvertY(PRTRECT pRect)
|
---|
121 | {
|
---|
122 | int32_t y = pRect->yTop;
|
---|
123 | pRect->yTop = pRect->yBottom;
|
---|
124 | pRect->yBottom = y;
|
---|
125 | }
|
---|
126 |
|
---|
127 | DECLINLINE(void) VBoxRectInvertedY(PCRTRECT pRect, PRTRECT pResult)
|
---|
128 | {
|
---|
129 | *pResult = *pRect;
|
---|
130 | VBoxRectInvertY(pResult);
|
---|
131 | }
|
---|
132 |
|
---|
133 | DECLINLINE(void) VBoxRectMove(PRTRECT pRect, int32_t x, int32_t y)
|
---|
134 | {
|
---|
135 | int32_t cx = pRect->xRight - pRect->xLeft;
|
---|
136 | int32_t cy = pRect->yBottom - pRect->yTop;
|
---|
137 | pRect->xLeft = x;
|
---|
138 | pRect->yTop = y;
|
---|
139 | pRect->xRight = cx + x;
|
---|
140 | pRect->yBottom = cy + y;
|
---|
141 | }
|
---|
142 |
|
---|
143 | DECLINLINE(void) VBoxRectMoved(PCRTRECT pRect, int32_t x, int32_t y, PRTRECT pResult)
|
---|
144 | {
|
---|
145 | *pResult = *pRect;
|
---|
146 | VBoxRectMove(pResult, x, y);
|
---|
147 | }
|
---|
148 |
|
---|
149 | DECLINLINE(bool) VBoxRectCovers(PCRTRECT pRect, PCRTRECT pCovered)
|
---|
150 | {
|
---|
151 | AssertPtr(pRect);
|
---|
152 | AssertPtr(pCovered);
|
---|
153 | if (pRect->xLeft > pCovered->xLeft)
|
---|
154 | return false;
|
---|
155 | if (pRect->yTop > pCovered->yTop)
|
---|
156 | return false;
|
---|
157 | if (pRect->xRight < pCovered->xRight)
|
---|
158 | return false;
|
---|
159 | if (pRect->yBottom < pCovered->yBottom)
|
---|
160 | return false;
|
---|
161 | return true;
|
---|
162 | }
|
---|
163 |
|
---|
164 | DECLINLINE(bool) VBoxRectIsZero(PCRTRECT pRect)
|
---|
165 | {
|
---|
166 | return pRect->xLeft == pRect->xRight || pRect->yTop == pRect->yBottom;
|
---|
167 | }
|
---|
168 |
|
---|
169 | DECLINLINE(bool) VBoxRectIsIntersect(PCRTRECT pRect1, PCRTRECT pRect2)
|
---|
170 | {
|
---|
171 | return !( (pRect1->xLeft < pRect2->xLeft && pRect1->xRight <= pRect2->xLeft)
|
---|
172 | || (pRect2->xLeft < pRect1->xLeft && pRect2->xRight <= pRect1->xLeft)
|
---|
173 | || (pRect1->yTop < pRect2->yTop && pRect1->yBottom <= pRect2->yTop)
|
---|
174 | || (pRect2->yTop < pRect1->yTop && pRect2->yBottom <= pRect1->yTop) );
|
---|
175 | }
|
---|
176 |
|
---|
177 | DECLINLINE(uint32_t) VBoxVrListRectsCount(PCVBOXVR_LIST pList)
|
---|
178 | {
|
---|
179 | return pList->cEntries;
|
---|
180 | }
|
---|
181 |
|
---|
182 | DECLINLINE(bool) VBoxVrListIsEmpty(PCVBOXVR_LIST pList)
|
---|
183 | {
|
---|
184 | return !VBoxVrListRectsCount(pList);
|
---|
185 | }
|
---|
186 |
|
---|
187 | DECLINLINE(void) VBoxVrListInit(PVBOXVR_LIST pList)
|
---|
188 | {
|
---|
189 | RTListInit(&pList->ListHead);
|
---|
190 | pList->cEntries = 0;
|
---|
191 | }
|
---|
192 |
|
---|
193 | VBOXVREGDECL(void) VBoxVrListClear(PVBOXVR_LIST pList);
|
---|
194 |
|
---|
195 | /* moves list data to pDstList and empties the pList */
|
---|
196 | VBOXVREGDECL(void) VBoxVrListMoveTo(PVBOXVR_LIST pList, PVBOXVR_LIST pDstList);
|
---|
197 |
|
---|
198 | VBOXVREGDECL(void) VBoxVrListTranslate(PVBOXVR_LIST pList, int32_t x, int32_t y);
|
---|
199 |
|
---|
200 | VBOXVREGDECL(int) VBoxVrListCmp(PCVBOXVR_LIST pList1, PCVBOXVR_LIST pList2);
|
---|
201 |
|
---|
202 | VBOXVREGDECL(int) VBoxVrListRectsSet(PVBOXVR_LIST pList, uint32_t cRects, PCRTRECT paRects, bool *pfChanged);
|
---|
203 | VBOXVREGDECL(int) VBoxVrListRectsAdd(PVBOXVR_LIST pList, uint32_t cRects, PCRTRECT paRects, bool *pfChanged);
|
---|
204 | VBOXVREGDECL(int) VBoxVrListRectsSubst(PVBOXVR_LIST pList, uint32_t cRects, PCRTRECT paRects, bool *pfChanged);
|
---|
205 | VBOXVREGDECL(int) VBoxVrListRectsGet(PVBOXVR_LIST pList, uint32_t cRects, PRTRECT paRects);
|
---|
206 |
|
---|
207 | VBOXVREGDECL(int) VBoxVrListClone(PCVBOXVR_LIST pList, VBOXVR_LIST *pDstList);
|
---|
208 |
|
---|
209 | /* NOTE: with the current implementation the VBoxVrListIntersect is faster than VBoxVrListRectsIntersect,
|
---|
210 | * i.e. VBoxVrListRectsIntersect is actually a convenience function that create a temporary list and calls
|
---|
211 | * VBoxVrListIntersect internally. */
|
---|
212 | VBOXVREGDECL(int) VBoxVrListRectsIntersect(PVBOXVR_LIST pList, uint32_t cRects, PCRTRECT paRects, bool *pfChanged);
|
---|
213 | VBOXVREGDECL(int) VBoxVrListIntersect(PVBOXVR_LIST pList, PCVBOXVR_LIST pList2, bool *pfChanged);
|
---|
214 |
|
---|
215 | VBOXVREGDECL(int) VBoxVrInit(void);
|
---|
216 | VBOXVREGDECL(void) VBoxVrTerm(void);
|
---|
217 |
|
---|
218 | typedef struct VBOXVR_LIST_ITERATOR
|
---|
219 | {
|
---|
220 | PVBOXVR_LIST pList;
|
---|
221 | PRTLISTNODE pNextEntry;
|
---|
222 | } VBOXVR_LIST_ITERATOR;
|
---|
223 | typedef VBOXVR_LIST_ITERATOR *PVBOXVR_LIST_ITERATOR;
|
---|
224 | typedef VBOXVR_LIST_ITERATOR const *PCVBOXVR_LIST_ITERATOR;
|
---|
225 |
|
---|
226 | DECLINLINE(void) VBoxVrListIterInit(PVBOXVR_LIST pList, PVBOXVR_LIST_ITERATOR pIter)
|
---|
227 | {
|
---|
228 | pIter->pList = pList;
|
---|
229 | pIter->pNextEntry = pList->ListHead.pNext;
|
---|
230 | }
|
---|
231 |
|
---|
232 | typedef struct VBOXVR_REG
|
---|
233 | {
|
---|
234 | RTLISTNODE ListEntry;
|
---|
235 | RTRECT Rect;
|
---|
236 | } VBOXVR_REG;
|
---|
237 | typedef VBOXVR_REG *PVBOXVR_REG;
|
---|
238 | typedef VBOXVR_REG const *PCVBOXVR_REG;
|
---|
239 |
|
---|
240 | #define PVBOXVR_REG_FROM_ENTRY(_pEntry) RT_FROM_MEMBER(_pEntry, VBOXVR_REG, ListEntry)
|
---|
241 |
|
---|
242 | DECLINLINE(PCRTRECT) VBoxVrListIterNext(PVBOXVR_LIST_ITERATOR pIter)
|
---|
243 | {
|
---|
244 | PRTLISTNODE pNextEntry = pIter->pNextEntry;
|
---|
245 | if (pNextEntry != &pIter->pList->ListHead)
|
---|
246 | {
|
---|
247 | PCRTRECT pRect = &PVBOXVR_REG_FROM_ENTRY(pNextEntry)->Rect;
|
---|
248 | pIter->pNextEntry = pNextEntry->pNext;
|
---|
249 | return pRect;
|
---|
250 | }
|
---|
251 | return NULL;
|
---|
252 | }
|
---|
253 |
|
---|
254 | typedef struct VBOXVR_COMPOSITOR_ENTRY
|
---|
255 | {
|
---|
256 | RTLISTNODE Node;
|
---|
257 | VBOXVR_LIST Vr;
|
---|
258 | uint32_t cRefs;
|
---|
259 | } VBOXVR_COMPOSITOR_ENTRY;
|
---|
260 | typedef VBOXVR_COMPOSITOR_ENTRY *PVBOXVR_COMPOSITOR_ENTRY;
|
---|
261 | typedef VBOXVR_COMPOSITOR_ENTRY const *PCVBOXVR_COMPOSITOR_ENTRY;
|
---|
262 |
|
---|
263 | struct VBOXVR_COMPOSITOR;
|
---|
264 |
|
---|
265 | typedef DECLCALLBACK(void) FNVBOXVRCOMPOSITOR_ENTRY_RELEASED(const struct VBOXVR_COMPOSITOR *pCompositor,
|
---|
266 | PVBOXVR_COMPOSITOR_ENTRY pEntry,
|
---|
267 | PVBOXVR_COMPOSITOR_ENTRY pReplacingEntry);
|
---|
268 | typedef FNVBOXVRCOMPOSITOR_ENTRY_RELEASED *PFNVBOXVRCOMPOSITOR_ENTRY_RELEASED;
|
---|
269 |
|
---|
270 | typedef struct VBOXVR_COMPOSITOR
|
---|
271 | {
|
---|
272 | RTLISTANCHOR List;
|
---|
273 | PFNVBOXVRCOMPOSITOR_ENTRY_RELEASED pfnEntryReleased;
|
---|
274 | } VBOXVR_COMPOSITOR;
|
---|
275 | typedef VBOXVR_COMPOSITOR *PVBOXVR_COMPOSITOR;
|
---|
276 | typedef VBOXVR_COMPOSITOR const *PCVBOXVR_COMPOSITOR;
|
---|
277 |
|
---|
278 | typedef DECLCALLBACK(bool) FNVBOXVRCOMPOSITOR_VISITOR(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry,
|
---|
279 | void *pvVisitor);
|
---|
280 | typedef FNVBOXVRCOMPOSITOR_VISITOR *PFNVBOXVRCOMPOSITOR_VISITOR;
|
---|
281 |
|
---|
282 | VBOXVREGDECL(void) VBoxVrCompositorInit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_ENTRY_RELEASED pfnEntryReleased);
|
---|
283 | VBOXVREGDECL(void) VBoxVrCompositorClear(PVBOXVR_COMPOSITOR pCompositor);
|
---|
284 | VBOXVREGDECL(void) VBoxVrCompositorRegionsClear(PVBOXVR_COMPOSITOR pCompositor, bool *pfChanged);
|
---|
285 | VBOXVREGDECL(void) VBoxVrCompositorEntryInit(PVBOXVR_COMPOSITOR_ENTRY pEntry);
|
---|
286 |
|
---|
287 | DECLINLINE(bool) VBoxVrCompositorEntryIsInList(PCVBOXVR_COMPOSITOR_ENTRY pEntry)
|
---|
288 | {
|
---|
289 | return !VBoxVrListIsEmpty(&pEntry->Vr);
|
---|
290 | }
|
---|
291 |
|
---|
292 | #define CRBLT_F_LINEAR 0x00000001
|
---|
293 | #define CRBLT_F_INVERT_SRC_YCOORDS 0x00000002
|
---|
294 | #define CRBLT_F_INVERT_DST_YCOORDS 0x00000004
|
---|
295 | #define CRBLT_F_INVERT_YCOORDS (CRBLT_F_INVERT_SRC_YCOORDS | CRBLT_F_INVERT_DST_YCOORDS)
|
---|
296 | /* the blit operation with discard the source alpha channel values and set the destination alpha values to 1.0 */
|
---|
297 | #define CRBLT_F_NOALPHA 0x00000010
|
---|
298 |
|
---|
299 | #define CRBLT_FTYPE_XOR CRBLT_F_INVERT_YCOORDS
|
---|
300 | #define CRBLT_FTYPE_OR (CRBLT_F_LINEAR | CRBLT_F_NOALPHA)
|
---|
301 | #define CRBLT_FOP_COMBINE(_f1, _f2) ((((_f1) ^ (_f2)) & CRBLT_FTYPE_XOR) | (((_f1) | (_f2)) & CRBLT_FTYPE_OR))
|
---|
302 |
|
---|
303 | #define CRBLT_FLAGS_FROM_FILTER(_f) ( ((_f) & GL_LINEAR) ? CRBLT_F_LINEAR : 0)
|
---|
304 | #define CRBLT_FILTER_FROM_FLAGS(_f) (((_f) & CRBLT_F_LINEAR) ? GL_LINEAR : GL_NEAREST)
|
---|
305 |
|
---|
306 | /* compositor regions changed */
|
---|
307 | #define VBOXVR_COMPOSITOR_CF_REGIONS_CHANGED 0x00000001
|
---|
308 | /* other entries changed along while doing current entry modification
|
---|
309 | * always comes with VBOXVR_COMPOSITOR_CF_ENTRY_REGIONS_CHANGED */
|
---|
310 | #define VBOXVR_COMPOSITOR_CF_OTHER_ENTRIES_REGIONS_CHANGED 0x00000002
|
---|
311 | /* only current entry regions changed
|
---|
312 | * can come wither with VBOXVR_COMPOSITOR_CF_REGIONS_CHANGED or with VBOXVR_COMPOSITOR_CF_ENTRY_REPLACED */
|
---|
313 | #define VBOXVR_COMPOSITOR_CF_ENTRY_REGIONS_CHANGED 0x00000004
|
---|
314 | /* the given entry has replaced some other entry, while overal regions did NOT change.
|
---|
315 | * always comes with VBOXVR_COMPOSITOR_CF_ENTRY_REGIONS_CHANGED */
|
---|
316 | #define VBOXVR_COMPOSITOR_CF_ENTRY_REPLACED 0x00000008
|
---|
317 |
|
---|
318 |
|
---|
319 | VBOXVREGDECL(bool) VBoxVrCompositorEntryRemove(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry);
|
---|
320 | VBOXVREGDECL(bool) VBoxVrCompositorEntryReplace(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry,
|
---|
321 | PVBOXVR_COMPOSITOR_ENTRY pNewEntry);
|
---|
322 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsAdd(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry,
|
---|
323 | uint32_t cRegions, PCRTRECT paRegions,
|
---|
324 | PVBOXVR_COMPOSITOR_ENTRY *ppReplacedEntry, uint32_t *pfChangeFlags);
|
---|
325 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSubst(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry,
|
---|
326 | uint32_t cRegions, PCRTRECT paRegions, bool *pfChanged);
|
---|
327 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSet(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry,
|
---|
328 | uint32_t cRegions, PCRTRECT paRegions, bool *pfChanged);
|
---|
329 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsIntersect(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry,
|
---|
330 | uint32_t cRegions, PCRTRECT paRegions, bool *pfChanged);
|
---|
331 | VBOXVREGDECL(int) VBoxVrCompositorEntryListIntersect(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry,
|
---|
332 | PCVBOXVR_LIST pList2, bool *pfChanged);
|
---|
333 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsIntersectAll(PVBOXVR_COMPOSITOR pCompositor, uint32_t cRegions, PCRTRECT paRegions,
|
---|
334 | bool *pfChanged);
|
---|
335 | VBOXVREGDECL(int) VBoxVrCompositorEntryListIntersectAll(PVBOXVR_COMPOSITOR pCompositor, PCVBOXVR_LIST pList2, bool *pfChanged);
|
---|
336 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsTranslate(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry,
|
---|
337 | int32_t x, int32_t y, bool *pfChanged);
|
---|
338 | VBOXVREGDECL(void) VBoxVrCompositorVisit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_VISITOR pfnVisitor, void *pvVisitor);
|
---|
339 |
|
---|
340 | DECLINLINE(bool) VBoxVrCompositorIsEmpty(PCVBOXVR_COMPOSITOR pCompositor)
|
---|
341 | {
|
---|
342 | return RTListIsEmpty(&pCompositor->List);
|
---|
343 | }
|
---|
344 |
|
---|
345 | typedef struct VBOXVR_COMPOSITOR_ITERATOR
|
---|
346 | {
|
---|
347 | PVBOXVR_COMPOSITOR pCompositor;
|
---|
348 | PRTLISTNODE pNextEntry;
|
---|
349 | } VBOXVR_COMPOSITOR_ITERATOR;
|
---|
350 | typedef VBOXVR_COMPOSITOR_ITERATOR *PVBOXVR_COMPOSITOR_ITERATOR;
|
---|
351 |
|
---|
352 | typedef struct VBOXVR_COMPOSITOR_CONST_ITERATOR
|
---|
353 | {
|
---|
354 | PCVBOXVR_COMPOSITOR pCompositor;
|
---|
355 | PCRTLISTNODE pNextEntry;
|
---|
356 | } VBOXVR_COMPOSITOR_CONST_ITERATOR;
|
---|
357 | typedef VBOXVR_COMPOSITOR_CONST_ITERATOR *PVBOXVR_COMPOSITOR_CONST_ITERATOR;
|
---|
358 |
|
---|
359 | DECLINLINE(void) VBoxVrCompositorIterInit(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ITERATOR pIter)
|
---|
360 | {
|
---|
361 | pIter->pCompositor = pCompositor;
|
---|
362 | pIter->pNextEntry = pCompositor->List.pNext;
|
---|
363 | }
|
---|
364 |
|
---|
365 | DECLINLINE(void) VBoxVrCompositorConstIterInit(PCVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_CONST_ITERATOR pIter)
|
---|
366 | {
|
---|
367 | pIter->pCompositor = pCompositor;
|
---|
368 | pIter->pNextEntry = pCompositor->List.pNext;
|
---|
369 | }
|
---|
370 |
|
---|
371 | #define VBOXVR_COMPOSITOR_ENTRY_FROM_NODE(_p) RT_FROM_MEMBER(_p, VBOXVR_COMPOSITOR_ENTRY, Node)
|
---|
372 | #define VBOXVR_COMPOSITOR_CONST_ENTRY_FROM_NODE(_p) RT_FROM_MEMBER(_p, const VBOXVR_COMPOSITOR_ENTRY, Node)
|
---|
373 |
|
---|
374 | DECLINLINE(PVBOXVR_COMPOSITOR_ENTRY) VBoxVrCompositorIterNext(PVBOXVR_COMPOSITOR_ITERATOR pIter)
|
---|
375 | {
|
---|
376 | PRTLISTNODE pNextEntry = pIter->pNextEntry;
|
---|
377 | if (pNextEntry != &pIter->pCompositor->List)
|
---|
378 | {
|
---|
379 | PVBOXVR_COMPOSITOR_ENTRY pEntry = VBOXVR_COMPOSITOR_ENTRY_FROM_NODE(pNextEntry);
|
---|
380 | pIter->pNextEntry = pNextEntry->pNext;
|
---|
381 | return pEntry;
|
---|
382 | }
|
---|
383 | return NULL;
|
---|
384 | }
|
---|
385 |
|
---|
386 | DECLINLINE(PCVBOXVR_COMPOSITOR_ENTRY) VBoxVrCompositorConstIterNext(PVBOXVR_COMPOSITOR_CONST_ITERATOR pIter)
|
---|
387 | {
|
---|
388 | PCRTLISTNODE pNextEntry = pIter->pNextEntry;
|
---|
389 | if (pNextEntry != &pIter->pCompositor->List)
|
---|
390 | {
|
---|
391 | PCVBOXVR_COMPOSITOR_ENTRY pEntry = VBOXVR_COMPOSITOR_CONST_ENTRY_FROM_NODE(pNextEntry);
|
---|
392 | pIter->pNextEntry = pNextEntry->pNext;
|
---|
393 | return pEntry;
|
---|
394 | }
|
---|
395 | return NULL;
|
---|
396 | }
|
---|
397 |
|
---|
398 | typedef struct VBOXVR_TEXTURE
|
---|
399 | {
|
---|
400 | int32_t width;
|
---|
401 | int32_t height;
|
---|
402 | uint32_t target;
|
---|
403 | uint32_t hwid;
|
---|
404 | } VBOXVR_TEXTURE;
|
---|
405 | typedef VBOXVR_TEXTURE *PVBOXVR_TEXTURE;
|
---|
406 | typedef VBOXVR_TEXTURE const *PCVBOXVR_TEXTURE;
|
---|
407 |
|
---|
408 | RT_C_DECLS_END
|
---|
409 |
|
---|
410 | #endif
|
---|
411 |
|
---|