VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/include/cr_vreg.h@ 48325

Last change on this file since 48325 was 48325, checked in by vboxsync, 11 years ago

crOpenGL/OSX: scrolling & docktile image fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.7 KB
Line 
1/* $Id: cr_vreg.h 48325 2013-09-05 19:45:51Z 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
36RT_C_DECLS_BEGIN
37
38typedef struct VBOXVR_LIST
39{
40 RTLISTNODE ListHead;
41 uint32_t cEntries;
42} VBOXVR_LIST, *PVBOXVR_LIST;
43
44DECLINLINE(int) VBoxRectCmp(const RTRECT * pRect1, const RTRECT * pRect2)
45{
46 return memcmp(pRect1, pRect2, sizeof (*pRect1));
47}
48
49#ifndef IN_RING0
50DECLINLINE(void) VBoxRectStretch(PRTRECT pRect, float xStretch, float yStretch)
51{
52 pRect->xLeft = pRect->xLeft * xStretch;
53 pRect->yTop = pRect->yTop * yStretch;
54 pRect->xRight = pRect->xRight * xStretch;
55 pRect->yBottom = pRect->yBottom * yStretch;
56}
57
58DECLINLINE(void) VBoxRectStretched(const RTRECT *pRect, float xStretch, float yStretch, PRTRECT pResult)
59{
60 *pResult = *pRect;
61 VBoxRectStretch(pResult, xStretch, yStretch);
62}
63#endif
64
65DECLINLINE(void) VBoxRectIntersect(PRTRECT pRect1, const RTRECT * pRect2)
66{
67 Assert(pRect1);
68 Assert(pRect2);
69 pRect1->xLeft = RT_MAX(pRect1->xLeft, pRect2->xLeft);
70 pRect1->yTop = RT_MAX(pRect1->yTop, pRect2->yTop);
71 pRect1->xRight = RT_MIN(pRect1->xRight, pRect2->xRight);
72 pRect1->yBottom = RT_MIN(pRect1->yBottom, pRect2->yBottom);
73}
74
75DECLINLINE(void) VBoxRectIntersected(const RTRECT *pRect1, const RTRECT * pRect2, RTRECT *pResult)
76{
77 *pResult = *pRect1;
78 VBoxRectIntersect(pResult, pRect2);
79}
80
81
82DECLINLINE(void) VBoxRectTranslate(RTRECT * pRect, int32_t x, int32_t y)
83{
84 pRect->xLeft += x;
85 pRect->yTop += y;
86 pRect->xRight += x;
87 pRect->yBottom += y;
88}
89
90DECLINLINE(void) VBoxRectTranslated(const RTRECT * pRect, int32_t x, int32_t y, RTRECT *pResult)
91{
92 *pResult = *pRect;
93 VBoxRectTranslate(pResult, x, y);
94}
95
96DECLINLINE(void) VBoxRectMove(RTRECT * pRect, int32_t x, int32_t y)
97{
98 int32_t w = pRect->xRight - pRect->xLeft;
99 int32_t h = pRect->yBottom - pRect->yTop;
100 pRect->xLeft = x;
101 pRect->yTop = y;
102 pRect->xRight = w + x;
103 pRect->yBottom = h + y;
104}
105
106DECLINLINE(void) VBoxRectMoved(const RTRECT * pRect, int32_t x, int32_t y, RTRECT *pResult)
107{
108 *pResult = *pRect;
109 VBoxRectMove(pResult, x, y);
110}
111
112DECLINLINE(bool) VBoxRectIsCoveres(const RTRECT *pRect, const RTRECT *pCovered)
113{
114 Assert(pRect);
115 Assert(pCovered);
116 if (pRect->xLeft > pCovered->xLeft)
117 return false;
118 if (pRect->yTop > pCovered->yTop)
119 return false;
120 if (pRect->xRight < pCovered->xRight)
121 return false;
122 if (pRect->yBottom < pCovered->yBottom)
123 return false;
124 return true;
125}
126
127DECLINLINE(bool) VBoxRectIsZero(const RTRECT *pRect)
128{
129 return pRect->xLeft == pRect->xRight || pRect->yTop == pRect->yBottom;
130}
131
132DECLINLINE(bool) VBoxRectIsIntersect(const RTRECT * pRect1, const RTRECT * pRect2)
133{
134 return !((pRect1->xLeft < pRect2->xLeft && pRect1->xRight <= pRect2->xLeft)
135 || (pRect2->xLeft < pRect1->xLeft && pRect2->xRight <= pRect1->xLeft)
136 || (pRect1->yTop < pRect2->yTop && pRect1->yBottom <= pRect2->yTop)
137 || (pRect2->yTop < pRect1->yTop && pRect2->yBottom <= pRect1->yTop));
138}
139
140DECLINLINE(uint32_t) VBoxVrListRectsCount(const VBOXVR_LIST *pList)
141{
142 return pList->cEntries;
143}
144
145DECLINLINE(bool) VBoxVrListIsEmpty(const VBOXVR_LIST *pList)
146{
147 return !VBoxVrListRectsCount(pList);
148}
149
150DECLINLINE(void) VBoxVrListInit(PVBOXVR_LIST pList)
151{
152 RTListInit(&pList->ListHead);
153 pList->cEntries = 0;
154}
155
156VBOXVREGDECL(void) VBoxVrListClear(PVBOXVR_LIST pList);
157
158VBOXVREGDECL(void) VBoxVrListTranslate(PVBOXVR_LIST pList, int32_t x, int32_t y);
159
160VBOXVREGDECL(int) VBoxVrListCmp(const VBOXVR_LIST *pList1, const VBOXVR_LIST *pList2);
161
162VBOXVREGDECL(int) VBoxVrListRectsSet(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
163VBOXVREGDECL(int) VBoxVrListRectsAdd(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
164VBOXVREGDECL(int) VBoxVrListRectsSubst(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
165VBOXVREGDECL(int) VBoxVrListRectsGet(PVBOXVR_LIST pList, uint32_t cRects, RTRECT * aRects);
166
167VBOXVREGDECL(int) VBoxVrListClone(const VBOXVR_LIST *pList, VBOXVR_LIST *pDstList);
168
169/* NOTE: with the current implementation the VBoxVrListIntersect is faster than VBoxVrListRectsIntersect,
170 * i.e. VBoxVrListRectsIntersect is actually a convenience function that create a temporary list and calls VBoxVrListIntersect internally */
171VBOXVREGDECL(int) VBoxVrListRectsIntersect(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
172VBOXVREGDECL(int) VBoxVrListIntersect(PVBOXVR_LIST pList, const VBOXVR_LIST *pList2, bool *pfChanged);
173
174VBOXVREGDECL(int) VBoxVrInit();
175VBOXVREGDECL(void) VBoxVrTerm();
176
177typedef struct VBOXVR_LIST_ITERATOR
178{
179 PVBOXVR_LIST pList;
180 PRTLISTNODE pNextEntry;
181} VBOXVR_LIST_ITERATOR, *PVBOXVR_LIST_ITERATOR;
182
183DECLINLINE(void) VBoxVrListIterInit(PVBOXVR_LIST pList, PVBOXVR_LIST_ITERATOR pIter)
184{
185 pIter->pList = pList;
186 pIter->pNextEntry = pList->ListHead.pNext;
187}
188
189typedef struct VBOXVR_REG
190{
191 RTLISTNODE ListEntry;
192 RTRECT Rect;
193} VBOXVR_REG, *PVBOXVR_REG;
194
195#define PVBOXVR_REG_FROM_ENTRY(_pEntry) ((PVBOXVR_REG)(((uint8_t*)(_pEntry)) - RT_OFFSETOF(VBOXVR_REG, ListEntry)))
196
197DECLINLINE(PCRTRECT) VBoxVrListIterNext(PVBOXVR_LIST_ITERATOR pIter)
198{
199 PRTLISTNODE pNextEntry = pIter->pNextEntry;
200 if (pNextEntry != &pIter->pList->ListHead)
201 {
202 PCRTRECT pRect = &(PVBOXVR_REG_FROM_ENTRY(pNextEntry)->Rect);
203 pIter->pNextEntry = pNextEntry->pNext;
204 return pRect;
205 }
206 return NULL;
207}
208
209typedef struct VBOXVR_COMPOSITOR_ENTRY
210{
211 RTLISTNODE Node;
212 VBOXVR_LIST Vr;
213 uint32_t cRefs;
214} VBOXVR_COMPOSITOR_ENTRY, *PVBOXVR_COMPOSITOR_ENTRY;
215
216struct VBOXVR_COMPOSITOR;
217
218typedef DECLCALLBACK(void) FNVBOXVRCOMPOSITOR_ENTRY_RELEASED(const struct VBOXVR_COMPOSITOR *pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, PVBOXVR_COMPOSITOR_ENTRY pReplacingEntry);
219typedef FNVBOXVRCOMPOSITOR_ENTRY_RELEASED *PFNVBOXVRCOMPOSITOR_ENTRY_RELEASED;
220
221typedef struct VBOXVR_COMPOSITOR
222{
223 RTLISTNODE List;
224 PFNVBOXVRCOMPOSITOR_ENTRY_RELEASED pfnEntryReleased;
225} VBOXVR_COMPOSITOR, *PVBOXVR_COMPOSITOR;
226
227typedef DECLCALLBACK(bool) FNVBOXVRCOMPOSITOR_VISITOR(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, void *pvVisitor);
228typedef FNVBOXVRCOMPOSITOR_VISITOR *PFNVBOXVRCOMPOSITOR_VISITOR;
229
230VBOXVREGDECL(void) VBoxVrCompositorInit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_ENTRY_RELEASED pfnEntryReleased);
231VBOXVREGDECL(void) VBoxVrCompositorClear(PVBOXVR_COMPOSITOR pCompositor);
232VBOXVREGDECL(void) VBoxVrCompositorRegionsClear(PVBOXVR_COMPOSITOR pCompositor, bool *pfChanged);
233VBOXVREGDECL(void) VBoxVrCompositorEntryInit(PVBOXVR_COMPOSITOR_ENTRY pEntry);
234DECLINLINE(bool) VBoxVrCompositorEntryIsInList(const VBOXVR_COMPOSITOR_ENTRY *pEntry)
235{
236 return !VBoxVrListIsEmpty(&pEntry->Vr);
237}
238
239#define CRBLT_F_LINEAR 0x00000001
240#define CRBLT_F_INVERT_SRC_YCOORDS 0x00000002
241#define CRBLT_F_INVERT_DST_YCOORDS 0x00000004
242#define CRBLT_F_INVERT_YCOORDS (CRBLT_F_INVERT_SRC_YCOORDS | CRBLT_F_INVERT_DST_YCOORDS)
243/* the blit operation with discard the source alpha channel values and set the destination alpha values to 1.0 */
244#define CRBLT_F_NOALPHA 0x00000010
245
246#define CRBLT_FTYPE_XOR CRBLT_F_INVERT_YCOORDS
247#define CRBLT_FTYPE_OR (CRBLT_F_LINEAR | CRBLT_F_NOALPHA)
248#define CRBLT_FOP_COMBINE(_f1, _f2) ((((_f1) ^ (_f2)) & CRBLT_FTYPE_XOR) | (((_f1) | (_f2)) & CRBLT_FTYPE_OR))
249
250#define CRBLT_FLAGS_FROM_FILTER(_f) ( ((_f) & GL_LINEAR) ? CRBLT_F_LINEAR : 0)
251#define CRBLT_FILTER_FROM_FLAGS(_f) (((_f) & CRBLT_F_LINEAR) ? GL_LINEAR : GL_NEAREST)
252
253/* compositor regions changed */
254#define VBOXVR_COMPOSITOR_CF_REGIONS_CHANGED 0x00000001
255/* other entries changed along while doing current entry modification
256 * always comes with VBOXVR_COMPOSITOR_CF_ENTRY_REGIONS_CHANGED */
257#define VBOXVR_COMPOSITOR_CF_OTHER_ENTRIES_REGIONS_CHANGED 0x00000002
258/* only current entry regions changed
259 * can come wither with VBOXVR_COMPOSITOR_CF_REGIONS_CHANGED or with VBOXVR_COMPOSITOR_CF_ENTRY_REPLACED */
260#define VBOXVR_COMPOSITOR_CF_ENTRY_REGIONS_CHANGED 0x00000004
261/* the given entry has replaced some other entry, while overal regions did NOT change.
262 * always comes with VBOXVR_COMPOSITOR_CF_ENTRY_REGIONS_CHANGED */
263#define VBOXVR_COMPOSITOR_CF_ENTRY_REPLACED 0x00000008
264
265
266VBOXVREGDECL(bool) VBoxVrCompositorEntryRemove(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry);
267VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsAdd(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, PVBOXVR_COMPOSITOR_ENTRY *ppReplacedEntry, uint32_t *pfChangeFlags);
268VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSubst(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
269VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSet(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
270VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsIntersect(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
271VBOXVREGDECL(int) VBoxVrCompositorEntryListIntersect(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, const VBOXVR_LIST *pList2, bool *pfChanged);
272VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsIntersectAll(PVBOXVR_COMPOSITOR pCompositor, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
273VBOXVREGDECL(int) VBoxVrCompositorEntryListIntersectAll(PVBOXVR_COMPOSITOR pCompositor, const VBOXVR_LIST *pList2, bool *pfChanged);
274VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsTranslate(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, int32_t x, int32_t y, bool *pfChanged);
275VBOXVREGDECL(void) VBoxVrCompositorVisit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_VISITOR pfnVisitor, void *pvVisitor);
276
277DECLINLINE(bool) VBoxVrCompositorIsEmpty(const VBOXVR_COMPOSITOR *pCompositor)
278{
279 return RTListIsEmpty(&pCompositor->List);
280}
281
282typedef struct VBOXVR_COMPOSITOR_ITERATOR
283{
284 PVBOXVR_COMPOSITOR pCompositor;
285 PRTLISTNODE pNextEntry;
286} VBOXVR_COMPOSITOR_ITERATOR ,*PVBOXVR_COMPOSITOR_ITERATOR;
287
288DECLINLINE(void) VBoxVrCompositorIterInit(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ITERATOR pIter)
289{
290 pIter->pCompositor = pCompositor;
291 pIter->pNextEntry = pCompositor->List.pNext;
292}
293
294#define VBOXVR_COMPOSITOR_ENTRY_FROM_NODE(_p) ((PVBOXVR_COMPOSITOR_ENTRY)(((uint8_t*)(_p)) - RT_OFFSETOF(VBOXVR_COMPOSITOR_ENTRY, Node)))
295
296DECLINLINE(PVBOXVR_COMPOSITOR_ENTRY) VBoxVrCompositorIterNext(PVBOXVR_COMPOSITOR_ITERATOR pIter)
297{
298 PRTLISTNODE pNextEntry = pIter->pNextEntry;
299 if (pNextEntry != &pIter->pCompositor->List)
300 {
301 PVBOXVR_COMPOSITOR_ENTRY pEntry = VBOXVR_COMPOSITOR_ENTRY_FROM_NODE(pNextEntry);
302 pIter->pNextEntry = pNextEntry->pNext;
303 return pEntry;
304 }
305 return NULL;
306}
307
308/* Compositor with Stretching & Cached Rectangles info */
309
310typedef struct VBOXVR_TEXTURE
311{
312 int32_t width;
313 int32_t height;
314 uint32_t target;
315 uint32_t hwid;
316} VBOXVR_TEXTURE, *PVBOXVR_TEXTURE;
317
318struct VBOXVR_SCR_COMPOSITOR_ENTRY;
319struct VBOXVR_SCR_COMPOSITOR;
320
321typedef DECLCALLBACK(void) FNVBOXVRSCRCOMPOSITOR_ENTRY_RELEASED(const struct VBOXVR_SCR_COMPOSITOR *pCompositor, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pReplacingEntry);
322typedef FNVBOXVRSCRCOMPOSITOR_ENTRY_RELEASED *PFNVBOXVRSCRCOMPOSITOR_ENTRY_RELEASED;
323
324
325typedef struct VBOXVR_SCR_COMPOSITOR_ENTRY
326{
327 VBOXVR_COMPOSITOR_ENTRY Ce;
328 VBOXVR_TEXTURE Tex;
329 RTPOINT Pos;
330 uint32_t fChanged;
331 uint32_t fFlags;
332 uint32_t cRects;
333 PRTRECT paSrcRects;
334 PRTRECT paDstRects;
335 PRTRECT paDstUnstretchedRects;
336 PFNVBOXVRSCRCOMPOSITOR_ENTRY_RELEASED pfnEntryReleased;
337} VBOXVR_SCR_COMPOSITOR_ENTRY, *PVBOXVR_SCR_COMPOSITOR_ENTRY;
338
339typedef struct VBOXVR_SCR_COMPOSITOR
340{
341 VBOXVR_COMPOSITOR Compositor;
342#ifndef IN_RING0
343 float StretchX;
344 float StretchY;
345#endif
346 uint32_t fFlags;
347 uint32_t cRects;
348 uint32_t cRectsBuffer;
349 PRTRECT paSrcRects;
350 PRTRECT paDstRects;
351 PRTRECT paDstUnstretchedRects;
352} VBOXVR_SCR_COMPOSITOR, *PVBOXVR_SCR_COMPOSITOR;
353
354
355typedef DECLCALLBACK(bool) FNVBOXVRSCRCOMPOSITOR_VISITOR(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, void *pvVisitor);
356typedef FNVBOXVRSCRCOMPOSITOR_VISITOR *PFNVBOXVRSCRCOMPOSITOR_VISITOR;
357
358DECLINLINE(void) CrVrScrCompositorEntryInit(PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, const VBOXVR_TEXTURE *pTex, PFNVBOXVRSCRCOMPOSITOR_ENTRY_RELEASED pfnEntryReleased)
359{
360 VBoxVrCompositorEntryInit(&pEntry->Ce);
361 pEntry->Tex = *pTex;
362 memset(&pEntry->Pos, 0, sizeof (VBOXVR_SCR_COMPOSITOR_ENTRY) - RT_OFFSETOF(VBOXVR_SCR_COMPOSITOR_ENTRY, Pos));
363 pEntry->pfnEntryReleased = pfnEntryReleased;
364}
365
366DECLINLINE(bool) CrVrScrCompositorEntryIsUsed(const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry)
367{
368 return VBoxVrCompositorEntryIsInList(&pEntry->Ce);
369}
370
371DECLINLINE(void) CrVrScrCompositorEntrySetChanged(PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, bool fChanged)
372{
373 pEntry->fChanged = !!fChanged;
374}
375
376DECLINLINE(void) CrVrScrCompositorEntryTexNameUpdate(PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, uint32_t hwid)
377{
378 pEntry->Tex.hwid = hwid;
379 CrVrScrCompositorEntrySetChanged(pEntry, true);
380}
381
382DECLINLINE(const VBOXVR_TEXTURE *) CrVrScrCompositorEntryTexGet(const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry)
383{
384 return &pEntry->Tex;
385}
386
387DECLINLINE(bool) CrVrScrCompositorEntryIsChanged(const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry)
388{
389 return !!pEntry->fChanged;
390}
391
392DECLINLINE(bool) CrVrScrCompositorIsEmpty(const VBOXVR_SCR_COMPOSITOR *pCompositor)
393{
394 return VBoxVrCompositorIsEmpty(&pCompositor->Compositor);
395}
396
397VBOXVREGDECL(int) CrVrScrCompositorEntryTexUpdate(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, const VBOXVR_TEXTURE *pTex);
398VBOXVREGDECL(void) CrVrScrCompositorVisit(PVBOXVR_SCR_COMPOSITOR pCompositor, PFNVBOXVRSCRCOMPOSITOR_VISITOR pfnVisitor, void *pvVisitor);
399VBOXVREGDECL(void) CrVrScrCompositorEntrySetAllChanged(PVBOXVR_SCR_COMPOSITOR pCompositor, bool fChanged);
400DECLINLINE(bool) CrVrScrCompositorEntryIsInList(const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry)
401{
402 return VBoxVrCompositorEntryIsInList(&pEntry->Ce);
403}
404VBOXVREGDECL(int) CrVrScrCompositorEntryRegionsAdd(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, bool fPosRelated, VBOXVR_SCR_COMPOSITOR_ENTRY **ppReplacedScrEntry, uint32_t *pfChangeFlags);
405VBOXVREGDECL(int) CrVrScrCompositorEntryRegionsSet(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, bool fPosRelated, bool *pfChanged);
406VBOXVREGDECL(int) CrVrScrCompositorEntryListIntersect(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, const VBOXVR_LIST *pList2, bool *pfChanged);
407VBOXVREGDECL(int) CrVrScrCompositorEntryRegionsIntersect(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
408VBOXVREGDECL(int) CrVrScrCompositorEntryRegionsIntersectAll(PVBOXVR_SCR_COMPOSITOR pCompositor, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
409VBOXVREGDECL(int) CrVrScrCompositorEntryListIntersectAll(PVBOXVR_SCR_COMPOSITOR pCompositor, const VBOXVR_LIST *pList2, bool *pfChanged);
410VBOXVREGDECL(int) CrVrScrCompositorEntryPosSet(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, const RTPOINT *pPos);
411DECLINLINE(const RTPOINT*) CrVrScrCompositorEntryPosGet(const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry)
412{
413 return &pEntry->Pos;
414}
415
416/* regions are valid until the next CrVrScrCompositor call */
417VBOXVREGDECL(int) CrVrScrCompositorEntryRegionsGet(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, uint32_t *pcRegions, const RTRECT **ppaSrcRegions, const RTRECT **ppaDstRegions, const RTRECT **ppaDstUnstretchedRects);
418VBOXVREGDECL(int) CrVrScrCompositorEntryRemove(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry);
419VBOXVREGDECL(void) CrVrScrCompositorEntryFlagsSet(PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry, uint32_t fFlags);
420VBOXVREGDECL(uint32_t) CrVrScrCompositorEntryFlagsCombinedGet(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry);
421DECLINLINE(uint32_t) CrVrScrCompositorEntryFlagsGet(PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry)
422{
423 return pEntry->fFlags;
424}
425
426VBOXVREGDECL(void) CrVrScrCompositorInit(PVBOXVR_SCR_COMPOSITOR pCompositor);
427VBOXVREGDECL(void) CrVrScrCompositorClear(PVBOXVR_SCR_COMPOSITOR pCompositor);
428VBOXVREGDECL(void) CrVrScrCompositorRegionsClear(PVBOXVR_SCR_COMPOSITOR pCompositor, bool *pfChanged);
429
430typedef DECLCALLBACK(VBOXVR_SCR_COMPOSITOR_ENTRY*) FNVBOXVR_SCR_COMPOSITOR_ENTRY_FOR(VBOXVR_SCR_COMPOSITOR_ENTRY*pEntry, void *pvContext);
431typedef FNVBOXVR_SCR_COMPOSITOR_ENTRY_FOR *PFNVBOXVR_SCR_COMPOSITOR_ENTRY_FOR;
432
433VBOXVREGDECL(int) CrVrScrCompositorClone(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR pDstCompositor, PFNVBOXVR_SCR_COMPOSITOR_ENTRY_FOR pfnEntryFor, void* pvEntryFor);
434VBOXVREGDECL(int) CrVrScrCompositorIntersectList(PVBOXVR_SCR_COMPOSITOR pCompositor, const VBOXVR_LIST *pVr, bool *pfChanged);
435VBOXVREGDECL(int) CrVrScrCompositorIntersectedList(PVBOXVR_SCR_COMPOSITOR pCompositor, const VBOXVR_LIST *pVr, PVBOXVR_SCR_COMPOSITOR pDstCompositor, PFNVBOXVR_SCR_COMPOSITOR_ENTRY_FOR pfnEntryFor, void* pvEntryFor, bool *pfChanged);
436#ifndef IN_RING0
437VBOXVREGDECL(void) CrVrScrCompositorSetStretching(PVBOXVR_SCR_COMPOSITOR pCompositor, float StretchX, float StretchY);
438DECLINLINE(void) CrVrScrCompositorGetStretching(PVBOXVR_SCR_COMPOSITOR pCompositor, float *pStretchX, float *pStretchY)
439{
440 if (pStretchX)
441 *pStretchX = pCompositor->StretchX;
442
443 if (pStretchY)
444 *pStretchY = pCompositor->StretchY;
445}
446#endif
447/* regions are valid until the next CrVrScrCompositor call */
448VBOXVREGDECL(int) CrVrScrCompositorRegionsGet(PVBOXVR_SCR_COMPOSITOR pCompositor, uint32_t *pcRegions, const RTRECT **ppaSrcRegions, const RTRECT **ppaDstRegions, const RTRECT **ppaDstUnstretchedRects);
449
450#define VBOXVR_SCR_COMPOSITOR_ENTRY_FROM_ENTRY(_p) ((PVBOXVR_SCR_COMPOSITOR_ENTRY)(((uint8_t*)(_p)) - RT_OFFSETOF(VBOXVR_SCR_COMPOSITOR_ENTRY, Ce)))
451#define VBOXVR_SCR_COMPOSITOR_FROM_COMPOSITOR(_p) ((PVBOXVR_SCR_COMPOSITOR)(((uint8_t*)(_p)) - RT_OFFSETOF(VBOXVR_SCR_COMPOSITOR, Compositor)))
452
453typedef struct VBOXVR_SCR_COMPOSITOR_ITERATOR
454{
455 VBOXVR_COMPOSITOR_ITERATOR Base;
456} VBOXVR_SCR_COMPOSITOR_ITERATOR ,*PVBOXVR_SCR_COMPOSITOR_ITERATOR;
457
458DECLINLINE(void) CrVrScrCompositorIterInit(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ITERATOR pIter)
459{
460 VBoxVrCompositorIterInit(&pCompositor->Compositor, &pIter->Base);
461}
462
463DECLINLINE(PVBOXVR_SCR_COMPOSITOR_ENTRY) CrVrScrCompositorIterNext(PVBOXVR_SCR_COMPOSITOR_ITERATOR pIter)
464{
465 PVBOXVR_COMPOSITOR_ENTRY pCe = VBoxVrCompositorIterNext(&pIter->Base);
466 if (pCe)
467 {
468 return VBOXVR_SCR_COMPOSITOR_ENTRY_FROM_ENTRY(pCe);
469 }
470 return NULL;
471}
472
473RT_C_DECLS_END
474
475#endif /* #ifndef ___cr_vreg_h_ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette