VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoIf.h@ 32891

Last change on this file since 32891 was 32877, checked in by vboxsync, 14 years ago

wddm/3d: basics for chromium over hgsmi

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 16.8 KB
Line 
1/** @file
2 * Contains base definitions of constants & structures used
3 * to control & perform rendering,
4 * such as DMA commands types, allocation types, escape codes, etc.
5 * used by both miniport & display drivers.
6 *
7 * The latter uses these and only these defs to communicate with the former
8 * by posting appropriate requests via D3D RT Krnl Svc accessing callbacks.
9 */
10/*
11 * Copyright (C) 2010 Oracle Corporation
12 *
13 * This file is part of VirtualBox Open Source Edition (OSE), as
14 * available from http://www.virtualbox.org. This file is free software;
15 * you can redistribute it and/or modify it under the terms of the GNU
16 * General Public License (GPL) as published by the Free Software
17 * Foundation, in version 2 as it comes in the "COPYING" file of the
18 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
19 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
20 */
21#ifndef ___VBoxVideoIf_h___
22#define ___VBoxVideoIf_h___
23
24#include <VBox/VBoxVideo.h>
25#include "../../../include/VBoxDisplay.h"
26#include "VBoxUhgsmi.h"
27
28#include <iprt/assert.h>
29
30
31/* One would increase this whenever definitions in this file are changed */
32#define VBOXVIDEOIF_VERSION 6
33
34/* create allocation func */
35typedef enum
36{
37 VBOXWDDM_ALLOC_TYPE_UNEFINED = 0,
38 VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE,
39 VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE,
40 VBOXWDDM_ALLOC_TYPE_STD_STAGINGSURFACE,
41 /* this one is win 7-specific and hence unused for now */
42 VBOXWDDM_ALLOC_TYPE_STD_GDISURFACE
43 /* custom allocation types requested from user-mode d3d module will go here */
44 , VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC
45 , VBOXWDDM_ALLOC_TYPE_UMD_HGSMI_BUFFER
46} VBOXWDDM_ALLOC_TYPE;
47
48/* usage */
49typedef enum
50{
51 VBOXWDDM_ALLOCUSAGE_TYPE_UNEFINED = 0,
52 /* set for the allocation being primary */
53 VBOXWDDM_ALLOCUSAGE_TYPE_PRIMARY,
54} VBOXWDDM_ALLOCUSAGE_TYPE;
55
56typedef struct VBOXWDDM_SURFACE_DESC
57{
58 UINT width;
59 UINT height;
60 D3DDDIFORMAT format;
61 UINT bpp;
62 UINT pitch;
63 UINT depth;
64 UINT slicePitch;
65 UINT cbSize;
66 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
67 D3DDDI_RATIONAL RefreshRate;
68} VBOXWDDM_SURFACE_DESC, *PVBOXWDDM_SURFACE_DESC;
69
70typedef struct VBOXWDDM_ALLOCINFO
71{
72 VBOXWDDM_ALLOC_TYPE enmType;
73 union
74 {
75 struct
76 {
77 D3DDDI_RESOURCEFLAGS fFlags;
78 HANDLE hSharedHandle;
79 VBOXWDDM_SURFACE_DESC SurfDesc;
80 };
81
82 struct
83 {
84 uint32_t cbBuffer;
85 HANDLE hSynch;
86 VBOXUHGSMI_SYNCHOBJECT_TYPE enmSynchType;
87 };
88 };
89} VBOXWDDM_ALLOCINFO, *PVBOXWDDM_ALLOCINFO;
90
91/* this resource is OpenResource'd rather than CreateResource'd */
92#define VBOXWDDM_RESOURCE_F_OPENNED 0x00000001
93/* identifies this is a resource created with CreateResource, the VBOXWDDMDISP_RESOURCE::fRcFlags is valid */
94#define VBOXWDDM_RESOURCE_F_TYPE_GENERIC 0x00000002
95
96typedef struct VBOXWDDM_RC_DESC
97{
98 D3DDDI_RESOURCEFLAGS fFlags;
99 D3DDDIFORMAT enmFormat;
100 D3DDDI_POOL enmPool;
101 D3DDDIMULTISAMPLE_TYPE enmMultisampleType;
102 UINT MultisampleQuality;
103 UINT MipLevels;
104 UINT Fvf;
105 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
106 D3DDDI_RATIONAL RefreshRate;
107 D3DDDI_ROTATION enmRotation;
108} VBOXWDDM_RC_DESC, *PVBOXWDDM_RC_DESC;
109
110typedef struct VBOXWDDM_RCINFO
111{
112 uint32_t fFlags;
113 VBOXWDDM_RC_DESC RcDesc;
114 uint32_t cAllocInfos;
115// VBOXWDDM_ALLOCINFO aAllocInfos[1];
116} VBOXWDDM_RCINFO, *PVBOXWDDM_RCINFO;
117
118typedef struct VBOXWDDM_DMA_PRIVATEDATA_FLAFS
119{
120 union
121 {
122 struct
123 {
124 UINT bCmdInDmaBuffer : 1;
125 UINT bReserved : 31;
126 };
127 uint32_t Value;
128 };
129} VBOXWDDM_DMA_PRIVATEDATA_FLAFS, *PVBOXWDDM_DMA_PRIVATEDATA_FLAFS;
130
131typedef struct VBOXWDDM_DMA_PRIVATEDATA_BASEHDR
132{
133 VBOXVDMACMD_TYPE enmCmd;
134 union
135 {
136 VBOXWDDM_DMA_PRIVATEDATA_FLAFS fFlags;
137 uint32_t u32CmdReserved;
138 };
139} VBOXWDDM_DMA_PRIVATEDATA_BASEHDR, *PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR;
140
141typedef struct VBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO
142{
143 VBOXUHGSMI_BUFFER_SUBMIT_FLAGS fSubFlags;
144 uint32_t offData;
145 uint32_t cbData;
146} VBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO, *PVBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO;
147
148typedef struct VBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD
149{
150 VBOXWDDM_DMA_PRIVATEDATA_BASEHDR Base;
151 VBOXWDDM_UHGSMI_BUFFER_UI_SUBMIT_INFO aBufInfos[1];
152} VBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD, *PVBOXWDDM_DMA_PRIVATEDATA_UM_CHROMIUM_CMD;
153
154#define VBOXVHWA_F_ENABLED 0x00000001
155#define VBOXVHWA_F_CKEY_DST 0x00000002
156#define VBOXVHWA_F_CKEY_SRC 0x00000004
157
158#define VBOXVHWA_MAX_FORMATS 8
159
160typedef struct VBOXVHWA_INFO
161{
162 uint32_t fFlags;
163 uint32_t cOverlaysSupported;
164 uint32_t cFormats;
165 D3DDDIFORMAT aFormats[VBOXVHWA_MAX_FORMATS];
166} VBOXVHWA_INFO;
167
168#define VBOXWDDM_OVERLAY_F_CKEY_DST 0x00000001
169#define VBOXWDDM_OVERLAY_F_CKEY_DSTRANGE 0x00000002
170#define VBOXWDDM_OVERLAY_F_CKEY_SRC 0x00000004
171#define VBOXWDDM_OVERLAY_F_CKEY_SRCRANGE 0x00000008
172#define VBOXWDDM_OVERLAY_F_BOB 0x00000010
173#define VBOXWDDM_OVERLAY_F_INTERLEAVED 0x00000020
174#define VBOXWDDM_OVERLAY_F_MIRROR_LR 0x00000040
175#define VBOXWDDM_OVERLAY_F_MIRROR_UD 0x00000080
176#define VBOXWDDM_OVERLAY_F_DEINTERLACED 0x00000100
177
178typedef struct VBOXWDDM_OVERLAY_DESC
179{
180 uint32_t fFlags;
181 UINT DstColorKeyLow;
182 UINT DstColorKeyHigh;
183 UINT SrcColorKeyLow;
184 UINT SrcColorKeyHigh;
185} VBOXWDDM_OVERLAY_DESC, *PVBOXWDDM_OVERLAY_DESC;
186
187/* the dirty rect info is valid */
188#define VBOXWDDM_DIRTYREGION_F_VALID 0x00000001
189#define VBOXWDDM_DIRTYREGION_F_RECT_VALID 0x00000002
190
191typedef struct VBOXWDDM_DIRTYREGION
192{
193 uint32_t fFlags; /* <-- see VBOXWDDM_DIRTYREGION_F_xxx flags above */
194 RECT Rect;
195} VBOXWDDM_DIRTYREGION, *PVBOXWDDM_DIRTYREGION;
196
197typedef struct VBOXWDDM_OVERLAY_INFO
198{
199 VBOXWDDM_OVERLAY_DESC OverlayDesc;
200 VBOXWDDM_DIRTYREGION DirtyRegion; /* <- the dirty region of the overlay surface */
201} VBOXWDDM_OVERLAY_INFO, *PVBOXWDDM_OVERLAY_INFO;
202
203typedef struct VBOXWDDM_OVERLAYFLIP_INFO
204{
205 VBOXWDDM_DIRTYREGION DirtyRegion; /* <- the dirty region of the overlay surface */
206} VBOXWDDM_OVERLAYFLIP_INFO, *PVBOXWDDM_OVERLAYFLIP_INFO;
207
208typedef struct VBOXWDDM_CREATECONTEXT_INFO
209{
210 /* interface version, i.e. 9 for d3d9, 8 for d3d8, etc. */
211 uint32_t u32IfVersion;
212 /* true if d3d false if ddraw */
213 uint32_t u32IsD3D;
214 /* we use uint64_t instead of HANDLE to ensure structure def is the same for both 32-bit and 64-bit
215 * since x64 kernel driver can be called by 32-bit UMD */
216 uint64_t hUmEvent;
217 /* info to be passed to UMD notification to identify the context */
218 uint64_t u64UmInfo;
219} VBOXWDDM_CREATECONTEXT_INFO, *PVBOXWDDM_CREATECONTEXT_INFO;
220
221typedef void *VBOXDISP_UMHANDLE;
222typedef uint32_t VBOXDISP_KMHANDLE;
223
224typedef struct VBOXWDDM_RECTS_FLAFS
225{
226 union
227 {
228 struct
229 {
230 /* used only in conjunction with bSetVisibleRects.
231 * if set - VBOXWDDM_RECTS_INFO::aRects[0] contains view rectangle */
232 UINT bSetViewRect : 1;
233 /* sets visible regions */
234 UINT bSetVisibleRects : 1;
235 /* adds hidden regions */
236 UINT bAddHiddenRects : 1;
237 UINT Reserved : 29;
238 };
239 uint32_t Value;
240 };
241} VBOXWDDM_RECTS_FLAFS, *PVBOXWDDM_RECTS_FLAFS;
242
243typedef struct VBOXWDDM_RECTS_INFO
244{
245 uint32_t cRects;
246 RECT aRects[1];
247} VBOXWDDM_RECTS_INFO, *PVBOXWDDM_RECTS_INFO;
248
249#define VBOXWDDM_RECTS_INFO_SIZE4CRECTS(_cRects) (RT_OFFSETOF(VBOXWDDM_RECTS_INFO, aRects[(_cRects)]))
250#define VBOXWDDM_RECTS_INFO_SIZE(_pRects) (VBOXVIDEOCM_CMD_RECTS_SIZE4CRECTS((_pRects)->cRects))
251
252typedef struct VBOXVIDEOCM_CMD_HDR
253{
254 uint64_t u64UmData;
255 uint32_t cbCmd;
256 uint32_t u32CmdSpecific;
257}VBOXVIDEOCM_CMD_HDR, *PVBOXVIDEOCM_CMD_HDR;
258
259AssertCompile((sizeof (VBOXVIDEOCM_CMD_HDR) & 7) == 0);
260
261typedef struct VBOXVIDEOCM_CMD_RECTS
262{
263 VBOXWDDM_RECTS_FLAFS fFlags;
264 VBOXWDDM_RECTS_INFO RectsInfo;
265} VBOXVIDEOCM_CMD_RECTS, *PVBOXVIDEOCM_CMD_RECTS;
266
267typedef struct VBOXVIDEOCM_CMD_RECTS_INTERNAL
268{
269 union
270 {
271 VBOXDISP_UMHANDLE hSwapchainUm;
272 uint64_t u64Alignment;
273 };
274 VBOXVIDEOCM_CMD_RECTS Cmd;
275} VBOXVIDEOCM_CMD_RECTS_INTERNAL, *PVBOXVIDEOCM_CMD_RECTS_INTERNAL;
276
277#define VBOXVIDEOCM_CMD_RECTS_INTERNAL_SIZE4CRECTS(_cRects) (RT_OFFSETOF(VBOXVIDEOCM_CMD_RECTS_INTERNAL, Cmd.RectsInfo.aRects[(_cRects)]))
278#define VBOXVIDEOCM_CMD_RECTS_INTERNAL_SIZE(_pCmd) (VBOXVIDEOCM_CMD_RECTS_INTERNAL_SIZE4CRECTS((_pCmd)->cRects))
279
280typedef struct VBOXWDDM_GETVBOXVIDEOCMCMD_HDR
281{
282 uint32_t cbCmdsReturned;
283 uint32_t cbRemainingCmds;
284 uint32_t cbRemainingFirstCmd;
285 uint32_t u32Reserved;
286} VBOXWDDM_GETVBOXVIDEOCMCMD_HDR, *PVBOXWDDM_GETVBOXVIDEOCMCMD_HDR;
287
288typedef struct VBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD
289{
290 VBOXDISPIFESCAPE EscapeHdr;
291 VBOXWDDM_GETVBOXVIDEOCMCMD_HDR Hdr;
292} VBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD, *PVBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD;
293
294AssertCompile((sizeof (VBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD) & 7) == 0);
295AssertCompile(RT_OFFSETOF(VBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD, EscapeHdr) == 0);
296
297typedef struct VBOXDISPIFESCAPE_DBGPRINT
298{
299 VBOXDISPIFESCAPE EscapeHdr;
300 /* null-terminated string to DbgPrint including \0 */
301 char aStringBuf[1];
302} VBOXDISPIFESCAPE_DBGPRINT, *PVBOXDISPIFESCAPE_DBGPRINT;
303AssertCompile(RT_OFFSETOF(VBOXDISPIFESCAPE_DBGPRINT, EscapeHdr) == 0);
304
305typedef struct VBOXSCREENLAYOUT_ELEMENT
306{
307 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
308 POINT pos;
309} VBOXSCREENLAYOUT_ELEMENT, *PVBOXSCREENLAYOUT_ELEMENT;
310
311typedef struct VBOXSCREENLAYOUT
312{
313 uint32_t cScreens;
314 VBOXSCREENLAYOUT_ELEMENT aScreens[1];
315} VBOXSCREENLAYOUT, *PVBOXSCREENLAYOUT;
316
317typedef struct VBOXDISPIFESCAPE_SCREENLAYOUT
318{
319 VBOXDISPIFESCAPE EscapeHdr;
320 VBOXSCREENLAYOUT ScreenLayout;
321} VBOXDISPIFESCAPE_SCREENLAYOUT, *PVBOXDISPIFESCAPE_SCREENLAYOUT;
322
323typedef struct VBOXSWAPCHAININFO
324{
325 VBOXDISP_KMHANDLE hSwapchainKm; /* in, NULL if new is being created */
326 VBOXDISP_UMHANDLE hSwapchainUm; /* in, UMD private data */
327 RECT Rect;
328 UINT u32Reserved;
329 UINT cAllocs;
330 D3DKMT_HANDLE ahAllocs[1];
331}VBOXSWAPCHAININFO, *PVBOXSWAPCHAININFO;
332typedef struct VBOXDISPIFESCAPE_SWAPCHAININFO
333{
334 VBOXDISPIFESCAPE EscapeHdr;
335 VBOXSWAPCHAININFO SwapchainInfo;
336} VBOXDISPIFESCAPE_SWAPCHAININFO, *PVBOXDISPIFESCAPE_SWAPCHAININFO;
337
338/* query info func */
339typedef struct VBOXWDDM_QI
340{
341 uint32_t u32Version;
342 uint32_t cInfos;
343 VBOXVHWA_INFO aInfos[VBOX_VIDEO_MAX_SCREENS];
344} VBOXWDDM_QI;
345
346/* submit cmd func */
347
348/* tooling */
349DECLINLINE(UINT) vboxWddmCalcBitsPerPixel(D3DDDIFORMAT format)
350{
351 switch (format)
352 {
353 case D3DDDIFMT_R8G8B8:
354 return 24;
355 case D3DDDIFMT_A8R8G8B8:
356 case D3DDDIFMT_X8R8G8B8:
357 return 32;
358 case D3DDDIFMT_R5G6B5:
359 case D3DDDIFMT_X1R5G5B5:
360 case D3DDDIFMT_A1R5G5B5:
361 case D3DDDIFMT_A4R4G4B4:
362 return 16;
363 case D3DDDIFMT_R3G3B2:
364 case D3DDDIFMT_A8:
365 return 8;
366 case D3DDDIFMT_A8R3G3B2:
367 case D3DDDIFMT_X4R4G4B4:
368 return 16;
369 case D3DDDIFMT_A2B10G10R10:
370 case D3DDDIFMT_A8B8G8R8:
371 case D3DDDIFMT_X8B8G8R8:
372 case D3DDDIFMT_G16R16:
373 case D3DDDIFMT_A2R10G10B10:
374 return 32;
375 case D3DDDIFMT_A16B16G16R16:
376 return 64;
377 case D3DDDIFMT_A8P8:
378 return 16;
379 case D3DDDIFMT_P8:
380 case D3DDDIFMT_L8:
381 return 8;
382 case D3DDDIFMT_A8L8:
383 return 16;
384 case D3DDDIFMT_A4L4:
385 return 8;
386 case D3DDDIFMT_V8U8:
387 case D3DDDIFMT_L6V5U5:
388 return 16;
389 case D3DDDIFMT_X8L8V8U8:
390 case D3DDDIFMT_Q8W8V8U8:
391 case D3DDDIFMT_V16U16:
392 case D3DDDIFMT_W11V11U10:
393 case D3DDDIFMT_A2W10V10U10:
394 return 32;
395 case D3DDDIFMT_D16_LOCKABLE:
396 case D3DDDIFMT_D16:
397 case D3DDDIFMT_D15S1:
398 return 16;
399 case D3DDDIFMT_D32:
400 case D3DDDIFMT_D24S8:
401 case D3DDDIFMT_D24X8:
402 case D3DDDIFMT_D24X4S4:
403 case D3DDDIFMT_D24FS8:
404 case D3DDDIFMT_D32_LOCKABLE:
405 case D3DDDIFMT_D32F_LOCKABLE:
406 return 32;
407 case D3DDDIFMT_S8_LOCKABLE:
408 return 8;
409 default:
410 AssertBreakpoint();
411 return 0;
412 }
413}
414
415DECLINLINE(uint32_t) vboxWddmFormatToFourcc(D3DDDIFORMAT format)
416{
417 uint32_t uFormat = (uint32_t)format;
418 /* assume that in case both four bytes are non-zero, this is a fourcc */
419 if ((format & 0xff000000)
420 && (format & 0x00ff0000)
421 && (format & 0x0000ff00)
422 && (format & 0x000000ff)
423 )
424 return uFormat;
425 return 0;
426}
427
428#define VBOXWDDM_ROUNDBOUND(_v, _b) (((_v) + ((_b) - 1)) & ~((_b) - 1))
429
430DECLINLINE(UINT) vboxWddmCalcPitch(UINT w, UINT bitsPerPixel)
431{
432 UINT Pitch = bitsPerPixel * w;
433 /* pitch is now in bits, translate in bytes */
434 return VBOXWDDM_ROUNDBOUND(Pitch, 8) >> 3;
435}
436
437DECLINLINE(void) vboxWddmRectUnite(RECT *pR, const RECT *pR2Unite)
438{
439 pR->left = RT_MIN(pR->left, pR2Unite->left);
440 pR->top = RT_MIN(pR->top, pR2Unite->top);
441 pR->right = RT_MAX(pR->right, pR2Unite->right);
442 pR->bottom = RT_MAX(pR->bottom, pR2Unite->bottom);
443}
444
445DECLINLINE(bool) vboxWddmRectIntersection(const RECT *a, const RECT *b, RECT *rect)
446{
447 Assert(a);
448 Assert(b);
449 Assert(rect);
450 rect->left = RT_MAX(a->left, b->left);
451 rect->right = RT_MIN(a->right, b->right);
452 rect->top = RT_MAX(a->top, b->top);
453 rect->bottom = RT_MIN(a->bottom, b->bottom);
454 return (rect->right>rect->left) && (rect->bottom>rect->top);
455}
456
457DECLINLINE(bool) vboxWddmRectIsEqual(const RECT *pRect1, const RECT *pRect2)
458{
459 Assert(pRect1);
460 Assert(pRect2);
461 if (pRect1->left != pRect2->left)
462 return false;
463 if (pRect1->top != pRect2->top)
464 return false;
465 if (pRect1->right != pRect2->right)
466 return false;
467 if (pRect1->bottom != pRect2->bottom)
468 return false;
469 return true;
470}
471
472DECLINLINE(bool) vboxWddmRectIsCoveres(const RECT *pRect, const RECT *pCovered)
473{
474 Assert(pRect);
475 Assert(pCovered);
476 if (pRect->left > pCovered->left)
477 return false;
478 if (pRect->top > pCovered->top)
479 return false;
480 if (pRect->right < pCovered->right)
481 return false;
482 if (pRect->bottom < pCovered->bottom)
483 return false;
484 return true;
485}
486
487DECLINLINE(bool) vboxWddmRectIsEmpty(const RECT * pRect)
488{
489 return pRect->left == pRect->right-1 && pRect->top == pRect->bottom-1;
490}
491
492DECLINLINE(bool) vboxWddmRectIsIntersect(const RECT * pRect1, const RECT * pRect2)
493{
494 return !((pRect1->left < pRect2->left && pRect1->right < pRect2->left)
495 || (pRect2->left < pRect1->left && pRect2->right < pRect1->left)
496 || (pRect1->top < pRect2->top && pRect1->bottom < pRect2->top)
497 || (pRect2->top < pRect1->top && pRect2->bottom < pRect1->top));
498}
499
500DECLINLINE(void) vboxWddmRectUnited(RECT * pDst, const RECT * pRect1, const RECT * pRect2)
501{
502 pDst->left = RT_MIN(pRect1->left, pRect2->left);
503 pDst->top = RT_MIN(pRect1->top, pRect2->top);
504 pDst->right = RT_MAX(pRect1->right, pRect2->right);
505 pDst->bottom = RT_MAX(pRect1->bottom, pRect2->bottom);
506}
507
508DECLINLINE(void) vboxWddmRectTranslate(RECT * pRect, int x, int y)
509{
510 pRect->left += x;
511 pRect->top += y;
512 pRect->right += x;
513 pRect->bottom += y;
514}
515
516DECLINLINE(void) vboxWddmRectMove(RECT * pRect, int x, int y)
517{
518 LONG w = pRect->right - pRect->left;
519 LONG h = pRect->bottom - pRect->top;
520 pRect->left = x;
521 pRect->top = y;
522 pRect->right = w + x;
523 pRect->bottom = h + y;
524}
525
526DECLINLINE(void) vboxWddmRectTranslated(RECT *pDst, const RECT * pRect, int x, int y)
527{
528 *pDst = *pRect;
529 vboxWddmRectTranslate(pDst, x, y);
530}
531
532DECLINLINE(void) vboxWddmRectMoved(RECT *pDst, const RECT * pRect, int x, int y)
533{
534 *pDst = *pRect;
535 vboxWddmRectMove(pDst, x, y);
536}
537
538DECLINLINE(void) vboxWddmDirtyRegionAddRect(PVBOXWDDM_DIRTYREGION pInfo, const RECT *pRect)
539{
540 if (!(pInfo->fFlags & VBOXWDDM_DIRTYREGION_F_VALID))
541 {
542 pInfo->fFlags = VBOXWDDM_DIRTYREGION_F_VALID;
543 if (pRect)
544 {
545 pInfo->fFlags |= VBOXWDDM_DIRTYREGION_F_RECT_VALID;
546 pInfo->Rect = *pRect;
547 }
548 }
549 else if (!!(pInfo->fFlags & VBOXWDDM_DIRTYREGION_F_RECT_VALID))
550 {
551 if (pRect)
552 vboxWddmRectUnite(&pInfo->Rect, pRect);
553 else
554 pInfo->fFlags &= ~VBOXWDDM_DIRTYREGION_F_RECT_VALID;
555 }
556}
557
558DECLINLINE(void) vboxWddmDirtyRegionUnite(PVBOXWDDM_DIRTYREGION pInfo, const PVBOXWDDM_DIRTYREGION pInfo2)
559{
560 if (pInfo2->fFlags & VBOXWDDM_DIRTYREGION_F_VALID)
561 {
562 if (pInfo2->fFlags & VBOXWDDM_DIRTYREGION_F_RECT_VALID)
563 vboxWddmDirtyRegionAddRect(pInfo, &pInfo2->Rect);
564 else
565 vboxWddmDirtyRegionAddRect(pInfo, NULL);
566 }
567}
568
569DECLINLINE(void) vboxWddmDirtyRegionClear(PVBOXWDDM_DIRTYREGION pInfo)
570{
571 pInfo->fFlags = 0;
572}
573
574#endif /* #ifndef ___VBoxVideoIf_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