1 | /* $Id: cr_vreg.h 45251 2013-03-29 17:23:18Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * Visible Regions processing API
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2012 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
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 |
|
---|
28 | #ifndef IN_RING0
|
---|
29 | # define VBOXVREGDECL(_type) DECLEXPORT(_type)
|
---|
30 | #else
|
---|
31 | # define VBOXVREGDECL(_type) RTDECL(_type)
|
---|
32 | #endif
|
---|
33 |
|
---|
34 |
|
---|
35 |
|
---|
36 | RT_C_DECLS_BEGIN
|
---|
37 |
|
---|
38 | typedef struct VBOXVR_LIST
|
---|
39 | {
|
---|
40 | RTLISTNODE ListHead;
|
---|
41 | uint32_t cEntries;
|
---|
42 | } VBOXVR_LIST, *PVBOXVR_LIST;
|
---|
43 |
|
---|
44 | DECLINLINE(int) VBoxRectCmp(const RTRECT * pRect1, const RTRECT * pRect2)
|
---|
45 | {
|
---|
46 | return memcmp(pRect1, pRect2, sizeof (*pRect1));
|
---|
47 | }
|
---|
48 |
|
---|
49 | DECLINLINE(void) VBoxRectIntersect(PRTRECT pRect1, const RTRECT * pRect2)
|
---|
50 | {
|
---|
51 | Assert(pRect1);
|
---|
52 | Assert(pRect2);
|
---|
53 | pRect1->xLeft = RT_MAX(pRect1->xLeft, pRect2->xLeft);
|
---|
54 | pRect1->yTop = RT_MAX(pRect1->yTop, pRect2->yTop);
|
---|
55 | pRect1->xRight = RT_MIN(pRect1->xRight, pRect2->xRight);
|
---|
56 | pRect1->yBottom = RT_MIN(pRect1->yBottom, pRect2->yBottom);
|
---|
57 | }
|
---|
58 |
|
---|
59 | DECLINLINE(void) VBoxRectIntersected(const RTRECT *pRect1, const RTRECT * pRect2, RTRECT *pResult)
|
---|
60 | {
|
---|
61 | *pResult = *pRect1;
|
---|
62 | VBoxRectIntersect(pResult, pRect2);
|
---|
63 | }
|
---|
64 |
|
---|
65 |
|
---|
66 | DECLINLINE(void) VBoxRectTranslate(RTRECT * pRect, int32_t x, int32_t y)
|
---|
67 | {
|
---|
68 | pRect->xLeft += x;
|
---|
69 | pRect->yTop += y;
|
---|
70 | pRect->xRight += x;
|
---|
71 | pRect->yBottom += y;
|
---|
72 | }
|
---|
73 |
|
---|
74 | DECLINLINE(void) VBoxRectMove(RTRECT * pRect, int32_t x, int32_t y)
|
---|
75 | {
|
---|
76 | int32_t w = pRect->xRight - pRect->xLeft;
|
---|
77 | int32_t h = pRect->yBottom - pRect->yTop;
|
---|
78 | pRect->xLeft = x;
|
---|
79 | pRect->yTop = y;
|
---|
80 | pRect->xRight = w + x;
|
---|
81 | pRect->yBottom = h + y;
|
---|
82 | }
|
---|
83 |
|
---|
84 | DECLINLINE(bool) VBoxRectIsCoveres(const RTRECT *pRect, const RTRECT *pCovered)
|
---|
85 | {
|
---|
86 | Assert(pRect);
|
---|
87 | Assert(pCovered);
|
---|
88 | if (pRect->xLeft > pCovered->xLeft)
|
---|
89 | return false;
|
---|
90 | if (pRect->yTop > pCovered->yTop)
|
---|
91 | return false;
|
---|
92 | if (pRect->xRight < pCovered->xRight)
|
---|
93 | return false;
|
---|
94 | if (pRect->yBottom < pCovered->yBottom)
|
---|
95 | return false;
|
---|
96 | return true;
|
---|
97 | }
|
---|
98 |
|
---|
99 | DECLINLINE(bool) VBoxRectIsZero(const RTRECT *pRect)
|
---|
100 | {
|
---|
101 | return pRect->xLeft == pRect->xRight || pRect->yTop == pRect->yBottom;
|
---|
102 | }
|
---|
103 |
|
---|
104 | DECLINLINE(bool) VBoxRectIsIntersect(const RTRECT * pRect1, const RTRECT * pRect2)
|
---|
105 | {
|
---|
106 | return !((pRect1->xLeft < pRect2->xLeft && pRect1->xRight <= pRect2->xLeft)
|
---|
107 | || (pRect2->xLeft < pRect1->xLeft && pRect2->xRight <= pRect1->xLeft)
|
---|
108 | || (pRect1->yTop < pRect2->yTop && pRect1->yBottom <= pRect2->yTop)
|
---|
109 | || (pRect2->yTop < pRect1->yTop && pRect2->yBottom <= pRect1->yTop));
|
---|
110 | }
|
---|
111 |
|
---|
112 | DECLINLINE(uint32_t) VBoxVrListRectsCount(const VBOXVR_LIST *pList)
|
---|
113 | {
|
---|
114 | return pList->cEntries;
|
---|
115 | }
|
---|
116 |
|
---|
117 | DECLINLINE(bool) VBoxVrListIsEmpty(const VBOXVR_LIST *pList)
|
---|
118 | {
|
---|
119 | return !VBoxVrListRectsCount(pList);
|
---|
120 | }
|
---|
121 |
|
---|
122 | DECLINLINE(void) VBoxVrListInit(PVBOXVR_LIST pList)
|
---|
123 | {
|
---|
124 | RTListInit(&pList->ListHead);
|
---|
125 | pList->cEntries = 0;
|
---|
126 | }
|
---|
127 |
|
---|
128 | VBOXVREGDECL(void) VBoxVrListClear(PVBOXVR_LIST pList);
|
---|
129 |
|
---|
130 | VBOXVREGDECL(void) VBoxVrListTranslate(PVBOXVR_LIST pList, int32_t x, int32_t y);
|
---|
131 |
|
---|
132 | VBOXVREGDECL(int) VBoxVrListCmp(PVBOXVR_LIST pList1, PVBOXVR_LIST pList2);
|
---|
133 |
|
---|
134 | VBOXVREGDECL(int) VBoxVrListRectsSet(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
|
---|
135 | VBOXVREGDECL(int) VBoxVrListRectsAdd(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
|
---|
136 | VBOXVREGDECL(int) VBoxVrListRectsSubst(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
|
---|
137 | VBOXVREGDECL(int) VBoxVrListRectsGet(PVBOXVR_LIST pList, uint32_t cRects, RTRECT * aRects);
|
---|
138 |
|
---|
139 | /* NOTE: with the current implementation the VBoxVrListIntersect is faster than VBoxVrListRectsIntersect,
|
---|
140 | * i.e. VBoxVrListRectsIntersect is actually a convenience function that create a temporary list and calls VBoxVrListIntersect internally */
|
---|
141 | VBOXVREGDECL(int) VBoxVrListRectsIntersect(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
|
---|
142 | VBOXVREGDECL(int) VBoxVrListIntersect(PVBOXVR_LIST pList, const VBOXVR_LIST *pList2, bool *pfChanged);
|
---|
143 |
|
---|
144 | VBOXVREGDECL(int) VBoxVrInit();
|
---|
145 | VBOXVREGDECL(void) VBoxVrTerm();
|
---|
146 |
|
---|
147 | typedef struct VBOXVR_LIST_ITERATOR
|
---|
148 | {
|
---|
149 | PVBOXVR_LIST pList;
|
---|
150 | PRTLISTNODE pNextEntry;
|
---|
151 | } VBOXVR_LIST_ITERATOR, *PVBOXVR_LIST_ITERATOR;
|
---|
152 |
|
---|
153 | DECLINLINE(void) VBoxVrListIterInit(PVBOXVR_LIST pList, PVBOXVR_LIST_ITERATOR pIter)
|
---|
154 | {
|
---|
155 | pIter->pList = pList;
|
---|
156 | pIter->pNextEntry = pList->ListHead.pNext;
|
---|
157 | }
|
---|
158 |
|
---|
159 | typedef struct VBOXVR_REG
|
---|
160 | {
|
---|
161 | RTLISTNODE ListEntry;
|
---|
162 | RTRECT Rect;
|
---|
163 | } VBOXVR_REG, *PVBOXVR_REG;
|
---|
164 |
|
---|
165 | #define PVBOXVR_REG_FROM_ENTRY(_pEntry) ((PVBOXVR_REG)(((uint8_t*)(_pEntry)) - RT_OFFSETOF(VBOXVR_REG, ListEntry)))
|
---|
166 |
|
---|
167 | DECLINLINE(PCRTRECT) VBoxVrListIterNext(PVBOXVR_LIST_ITERATOR pIter)
|
---|
168 | {
|
---|
169 | PRTLISTNODE pNextEntry = pIter->pNextEntry;
|
---|
170 | if (pNextEntry != &pIter->pList->ListHead)
|
---|
171 | {
|
---|
172 | PCRTRECT pRect = &(PVBOXVR_REG_FROM_ENTRY(pNextEntry)->Rect);
|
---|
173 | pIter->pNextEntry = pNextEntry->pNext;
|
---|
174 | return pRect;
|
---|
175 | }
|
---|
176 | return NULL;
|
---|
177 | }
|
---|
178 |
|
---|
179 | typedef struct VBOXVR_COMPOSITOR_ENTRY
|
---|
180 | {
|
---|
181 | RTLISTNODE Node;
|
---|
182 | VBOXVR_LIST Vr;
|
---|
183 | } VBOXVR_COMPOSITOR_ENTRY, *PVBOXVR_COMPOSITOR_ENTRY;
|
---|
184 |
|
---|
185 | struct VBOXVR_COMPOSITOR;
|
---|
186 |
|
---|
187 | typedef DECLCALLBACK(void) FNVBOXVRCOMPOSITOR_ENTRY_REMOVED(const struct VBOXVR_COMPOSITOR *pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, PVBOXVR_COMPOSITOR_ENTRY pReplacingEntry);
|
---|
188 | typedef FNVBOXVRCOMPOSITOR_ENTRY_REMOVED *PFNVBOXVRCOMPOSITOR_ENTRY_REMOVED;
|
---|
189 |
|
---|
190 | typedef struct VBOXVR_COMPOSITOR
|
---|
191 | {
|
---|
192 | RTLISTNODE List;
|
---|
193 | PFNVBOXVRCOMPOSITOR_ENTRY_REMOVED pfnEntryRemoved;
|
---|
194 | } VBOXVR_COMPOSITOR, *PVBOXVR_COMPOSITOR;
|
---|
195 |
|
---|
196 | typedef DECLCALLBACK(bool) FNVBOXVRCOMPOSITOR_VISITOR(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, void *pvVisitor);
|
---|
197 | typedef FNVBOXVRCOMPOSITOR_VISITOR *PFNVBOXVRCOMPOSITOR_VISITOR;
|
---|
198 |
|
---|
199 | VBOXVREGDECL(void) VBoxVrCompositorInit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_ENTRY_REMOVED pfnEntryRemoved);
|
---|
200 | VBOXVREGDECL(void) VBoxVrCompositorTerm(PVBOXVR_COMPOSITOR pCompositor);
|
---|
201 | VBOXVREGDECL(void) VBoxVrCompositorEntryInit(PVBOXVR_COMPOSITOR_ENTRY pEntry);
|
---|
202 | DECLINLINE(bool) VBoxVrCompositorEntryIsInList(const VBOXVR_COMPOSITOR_ENTRY *pEntry)
|
---|
203 | {
|
---|
204 | return !VBoxVrListIsEmpty(&pEntry->Vr);
|
---|
205 | }
|
---|
206 |
|
---|
207 | /* compositor regions changed
|
---|
208 | * always comes with VBOXVR_COMPOSITOR_CF_ENTRY_REGIONS_CHANGED */
|
---|
209 | #define VBOXVR_COMPOSITOR_CF_REGIONS_CHANGED 0x00000001
|
---|
210 | /* only current entry regions changed */
|
---|
211 | #define VBOXVR_COMPOSITOR_CF_ENTRY_REGIONS_CHANGED 0x00000002
|
---|
212 | /* the given entry has replaced some other entry, while overal regions did NOT change.
|
---|
213 | * always comes with VBOXVR_COMPOSITOR_CF_ENTRY_REGIONS_CHANGED */
|
---|
214 | #define VBOXVR_COMPOSITOR_CF_ENTRY_REPLACED 0x00000004
|
---|
215 |
|
---|
216 |
|
---|
217 | VBOXVREGDECL(bool) VBoxVrCompositorEntryRemove(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry);
|
---|
218 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsAdd(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, uint32_t *pfChangeFlags);
|
---|
219 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSubst(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
|
---|
220 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSet(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
|
---|
221 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsIntersect(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
|
---|
222 | VBOXVREGDECL(int) VBoxVrCompositorEntryListIntersect(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, const VBOXVR_LIST *pList2, bool *pfChanged);
|
---|
223 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsIntersectAll(PVBOXVR_COMPOSITOR pCompositor, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
|
---|
224 | VBOXVREGDECL(int) VBoxVrCompositorEntryListIntersectAll(PVBOXVR_COMPOSITOR pCompositor, const VBOXVR_LIST *pList2, bool *pfChanged);
|
---|
225 | VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsTranslate(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, int32_t x, int32_t y, bool *pfChanged);
|
---|
226 | VBOXVREGDECL(void) VBoxVrCompositorVisit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_VISITOR pfnVisitor, void *pvVisitor);
|
---|
227 |
|
---|
228 | DECLINLINE(bool) VBoxVrCompositorIsEmpty(const VBOXVR_COMPOSITOR *pCompositor)
|
---|
229 | {
|
---|
230 | return RTListIsEmpty(&pCompositor->List);
|
---|
231 | }
|
---|
232 |
|
---|
233 | typedef struct VBOXVR_COMPOSITOR_ITERATOR
|
---|
234 | {
|
---|
235 | PVBOXVR_COMPOSITOR pCompositor;
|
---|
236 | PRTLISTNODE pNextEntry;
|
---|
237 | } VBOXVR_COMPOSITOR_ITERATOR ,*PVBOXVR_COMPOSITOR_ITERATOR;
|
---|
238 |
|
---|
239 | DECLINLINE(void) VBoxVrCompositorIterInit(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ITERATOR pIter)
|
---|
240 | {
|
---|
241 | pIter->pCompositor = pCompositor;
|
---|
242 | pIter->pNextEntry = pCompositor->List.pNext;
|
---|
243 | }
|
---|
244 |
|
---|
245 | #define VBOXVR_COMPOSITOR_ENTRY_FROM_NODE(_p) ((PVBOXVR_COMPOSITOR_ENTRY)(((uint8_t*)(_p)) - RT_OFFSETOF(VBOXVR_COMPOSITOR_ENTRY, Node)))
|
---|
246 |
|
---|
247 | DECLINLINE(PVBOXVR_COMPOSITOR_ENTRY) VBoxVrCompositorIterNext(PVBOXVR_COMPOSITOR_ITERATOR pIter)
|
---|
248 | {
|
---|
249 | PRTLISTNODE pNextEntry = pIter->pNextEntry;
|
---|
250 | if (pNextEntry != &pIter->pCompositor->List)
|
---|
251 | {
|
---|
252 | PVBOXVR_COMPOSITOR_ENTRY pEntry = VBOXVR_COMPOSITOR_ENTRY_FROM_NODE(pNextEntry);
|
---|
253 | pIter->pNextEntry = pNextEntry->pNext;
|
---|
254 | return pEntry;
|
---|
255 | }
|
---|
256 | return NULL;
|
---|
257 | }
|
---|
258 |
|
---|
259 | /* Compositor with Stretching & Cached Rectangles info */
|
---|
260 |
|
---|
261 | typedef struct VBOXVR_TEXTURE
|
---|
262 | {
|
---|
263 | int32_t width;
|
---|
264 | int32_t height;
|
---|
265 | uint32_t target;
|
---|
266 | uint32_t hwid;
|
---|
267 | } VBOXVR_TEXTURE, *PVBOXVR_TEXTURE;
|
---|
268 |
|
---|
269 | typedef struct VBOXVR_SCR_COMPOSITOR_ENTRY
|
---|
270 | {
|
---|
271 | VBOXVR_COMPOSITOR_ENTRY Ce;
|
---|
272 | VBOXVR_TEXTURE Tex;
|
---|
273 | RTPOINT Pos;
|
---|
274 | uint32_t fChanged;
|
---|
275 | uint32_t cRects;
|
---|
276 | PRTRECT paSrcRects;
|
---|
277 | PRTRECT paDstRects;
|
---|
278 | } VBOXVR_SCR_COMPOSITOR_ENTRY, *PVBOXVR_SCR_COMPOSITOR_ENTRY;
|
---|
279 |
|
---|
280 | typedef struct VBOXVR_SCR_COMPOSITOR
|
---|
281 | {
|
---|
282 | VBOXVR_COMPOSITOR Compositor;
|
---|
283 | float StretchX;
|
---|
284 | float StretchY;
|
---|
285 | uint32_t cRects;
|
---|
286 | uint32_t cRectsBuffer;
|
---|
287 | PRTRECT paSrcRects;
|
---|
288 | PRTRECT paDstRects;
|
---|
289 | RTCRITSECT CritSect;
|
---|
290 | } VBOXVR_SCR_COMPOSITOR, *PVBOXVR_SCR_COMPOSITOR;
|
---|
291 |
|
---|
292 | typedef DECLCALLBACK(bool) FNVBOXVRSCRCOMPOSITOR_VISITOR(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, void *pvVisitor);
|
---|
293 | typedef FNVBOXVRSCRCOMPOSITOR_VISITOR *PFNVBOXVRSCRCOMPOSITOR_VISITOR;
|
---|
294 |
|
---|
295 | DECLINLINE(void) CrVrScrCompositorEntryInit(PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, const VBOXVR_TEXTURE *pTex)
|
---|
296 | {
|
---|
297 | VBoxVrCompositorEntryInit(&pEntry->Ce);
|
---|
298 | pEntry->Tex = *pTex;
|
---|
299 | memset(&pEntry->Pos, 0, sizeof (VBOXVR_SCR_COMPOSITOR_ENTRY) - RT_OFFSETOF(VBOXVR_SCR_COMPOSITOR_ENTRY, Pos));
|
---|
300 | }
|
---|
301 |
|
---|
302 | DECLINLINE(bool) CrVrScrCompositorEntryIsUsed(const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry)
|
---|
303 | {
|
---|
304 | return VBoxVrCompositorEntryIsInList(&pEntry->Ce);
|
---|
305 | }
|
---|
306 |
|
---|
307 | DECLINLINE(void) CrVrScrCompositorEntrySetChanged(PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, bool fChanged)
|
---|
308 | {
|
---|
309 | pEntry->fChanged = !!fChanged;
|
---|
310 | }
|
---|
311 |
|
---|
312 | DECLINLINE(void) CrVrScrCompositorEntryTexNameUpdate(PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, uint32_t hwid)
|
---|
313 | {
|
---|
314 | pEntry->Tex.hwid = hwid;
|
---|
315 | CrVrScrCompositorEntrySetChanged(pEntry, true);
|
---|
316 | }
|
---|
317 |
|
---|
318 | DECLINLINE(const VBOXVR_TEXTURE *) CrVrScrCompositorEntryTexGet(const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry)
|
---|
319 | {
|
---|
320 | return &pEntry->Tex;
|
---|
321 | }
|
---|
322 |
|
---|
323 | DECLINLINE(bool) CrVrScrCompositorEntryIsChanged(const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry)
|
---|
324 | {
|
---|
325 | return !!pEntry->fChanged;
|
---|
326 | }
|
---|
327 |
|
---|
328 | DECLINLINE(bool) CrVrScrCompositorIsEmpty(const VBOXVR_SCR_COMPOSITOR *pCompositor)
|
---|
329 | {
|
---|
330 | return VBoxVrCompositorIsEmpty(&pCompositor->Compositor);
|
---|
331 | }
|
---|
332 |
|
---|
333 | VBOXVREGDECL(int) CrVrScrCompositorEntryTexUpdate(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, const VBOXVR_TEXTURE *pTex);
|
---|
334 | VBOXVREGDECL(void) CrVrScrCompositorVisit(PVBOXVR_SCR_COMPOSITOR pCompositor, PFNVBOXVRSCRCOMPOSITOR_VISITOR pfnVisitor, void *pvVisitor);
|
---|
335 | VBOXVREGDECL(void) CrVrScrCompositorEntrySetAllChanged(PVBOXVR_SCR_COMPOSITOR pCompositor, bool fChanged);
|
---|
336 | DECLINLINE(bool) CrVrScrCompositorEntryIsInList(const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry)
|
---|
337 | {
|
---|
338 | return VBoxVrCompositorEntryIsInList(&pEntry->Ce);
|
---|
339 | }
|
---|
340 | VBOXVREGDECL(int) CrVrScrCompositorEntryRegionsAdd(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, uint32_t *pfChangeFlags);
|
---|
341 | VBOXVREGDECL(int) CrVrScrCompositorEntryRegionsSet(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
|
---|
342 | VBOXVREGDECL(int) CrVrScrCompositorEntryListIntersect(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, const VBOXVR_LIST *pList2, bool *pfChanged);
|
---|
343 | VBOXVREGDECL(int) CrVrScrCompositorEntryRegionsIntersect(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
|
---|
344 | VBOXVREGDECL(int) CrVrScrCompositorEntryRegionsIntersectAll(PVBOXVR_SCR_COMPOSITOR pCompositor, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
|
---|
345 | VBOXVREGDECL(int) CrVrScrCompositorEntryListIntersectAll(PVBOXVR_SCR_COMPOSITOR pCompositor, const VBOXVR_LIST *pList2, bool *pfChanged);
|
---|
346 | VBOXVREGDECL(int) CrVrScrCompositorEntryPosSet(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, const RTPOINT *pPos);
|
---|
347 |
|
---|
348 | /* regions are valid until the next CrVrScrCompositor call */
|
---|
349 | VBOXVREGDECL(int) CrVrScrCompositorEntryRegionsGet(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, uint32_t *pcRegions, const RTRECT **ppaSrcRegions, const RTRECT **ppaDstRegions);
|
---|
350 | VBOXVREGDECL(int) CrVrScrCompositorEntryRemove(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry);
|
---|
351 | VBOXVREGDECL(int) CrVrScrCompositorInit(PVBOXVR_SCR_COMPOSITOR pCompositor);
|
---|
352 | VBOXVREGDECL(void) CrVrScrCompositorTerm(PVBOXVR_SCR_COMPOSITOR pCompositor);
|
---|
353 | VBOXVREGDECL(void) CrVrScrCompositorSetStretching(PVBOXVR_SCR_COMPOSITOR pCompositor, float StretchX, float StretchY);
|
---|
354 | /* regions are valid until the next CrVrScrCompositor call */
|
---|
355 | VBOXVREGDECL(int) CrVrScrCompositorRegionsGet(PVBOXVR_SCR_COMPOSITOR pCompositor, uint32_t *pcRegions, const RTRECT **ppaSrcRegions, const RTRECT **ppaDstRegions);
|
---|
356 |
|
---|
357 | #define VBOXVR_SCR_COMPOSITOR_ENTRY_FROM_ENTRY(_p) ((PVBOXVR_SCR_COMPOSITOR_ENTRY)(((uint8_t*)(_p)) - RT_OFFSETOF(VBOXVR_SCR_COMPOSITOR_ENTRY, Ce)))
|
---|
358 | #define VBOXVR_SCR_COMPOSITOR_FROM_COMPOSITOR(_p) ((PVBOXVR_SCR_COMPOSITOR)(((uint8_t*)(_p)) - RT_OFFSETOF(VBOXVR_SCR_COMPOSITOR, Compositor)))
|
---|
359 |
|
---|
360 | typedef struct VBOXVR_SCR_COMPOSITOR_ITERATOR
|
---|
361 | {
|
---|
362 | VBOXVR_COMPOSITOR_ITERATOR Base;
|
---|
363 | } VBOXVR_SCR_COMPOSITOR_ITERATOR ,*PVBOXVR_SCR_COMPOSITOR_ITERATOR;
|
---|
364 |
|
---|
365 | DECLINLINE(void) CrVrScrCompositorIterInit(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ITERATOR pIter)
|
---|
366 | {
|
---|
367 | VBoxVrCompositorIterInit(&pCompositor->Compositor, &pIter->Base);
|
---|
368 | }
|
---|
369 |
|
---|
370 | DECLINLINE(PVBOXVR_SCR_COMPOSITOR_ENTRY) CrVrScrCompositorIterNext(PVBOXVR_SCR_COMPOSITOR_ITERATOR pIter)
|
---|
371 | {
|
---|
372 | PVBOXVR_COMPOSITOR_ENTRY pCe = VBoxVrCompositorIterNext(&pIter->Base);
|
---|
373 | if (pCe)
|
---|
374 | {
|
---|
375 | return VBOXVR_SCR_COMPOSITOR_ENTRY_FROM_ENTRY(pCe);
|
---|
376 | }
|
---|
377 | return NULL;
|
---|
378 | }
|
---|
379 |
|
---|
380 | DECLINLINE(int) CrVrScrCompositorLock(PVBOXVR_SCR_COMPOSITOR pCompositor)
|
---|
381 | {
|
---|
382 | int rc = RTCritSectEnter(&pCompositor->CritSect);
|
---|
383 | AssertRC(rc);
|
---|
384 | return rc;
|
---|
385 | }
|
---|
386 |
|
---|
387 | DECLINLINE(int) CrVrScrCompositorUnlock(PVBOXVR_SCR_COMPOSITOR pCompositor)
|
---|
388 | {
|
---|
389 | int rc = RTCritSectLeave(&pCompositor->CritSect);
|
---|
390 | AssertRC(rc);
|
---|
391 | return rc;
|
---|
392 | }
|
---|
393 |
|
---|
394 | RT_C_DECLS_END
|
---|
395 |
|
---|
396 | #endif /* #ifndef ___cr_vreg_h_ */
|
---|