1 | /*
|
---|
2 | * Copyright (C) 2010 Oracle Corporation
|
---|
3 | *
|
---|
4 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
5 | * available from http://www.virtualbox.org. This file is free software;
|
---|
6 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
7 | * General Public License (GPL) as published by the Free Software
|
---|
8 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
9 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
10 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
11 | */
|
---|
12 | #ifndef ___VBoxVideoVbva_h___
|
---|
13 | #define ___VBoxVideoVbva_h___
|
---|
14 |
|
---|
15 | typedef struct VBOXVBVAINFO
|
---|
16 | {
|
---|
17 | VBOXVIDEOOFFSET offVBVA;
|
---|
18 | uint32_t cbVBVA;
|
---|
19 | VBVABUFFER *pVBVA;
|
---|
20 | BOOL fHwBufferOverflow;
|
---|
21 | VBVARECORD *pRecord;
|
---|
22 | D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId;
|
---|
23 | KSPIN_LOCK Lock;
|
---|
24 | } VBOXVBVAINFO;
|
---|
25 |
|
---|
26 | int vboxVbvaEnable (struct _DEVICE_EXTENSION* pDevExt, VBOXVBVAINFO *pVbva);
|
---|
27 | int vboxVbvaDisable (struct _DEVICE_EXTENSION* pDevExt, VBOXVBVAINFO *pVbva);
|
---|
28 | int vboxVbvaDestroy(PDEVICE_EXTENSION pDevExt, VBOXVBVAINFO *pVbva);
|
---|
29 | int vboxVbvaCreate(struct _DEVICE_EXTENSION* pDevExt, VBOXVBVAINFO *pVbva, ULONG offBuffer, ULONG cbBuffer, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId);
|
---|
30 | int vboxVbvaReportCmdOffset (struct _DEVICE_EXTENSION* pDevExt, VBOXVBVAINFO *pVbva, uint32_t offCmd);
|
---|
31 | int vboxVbvaReportDirtyRect (struct _DEVICE_EXTENSION* pDevExt, VBOXVBVAINFO *pVbva, RECT *pRectOrig);
|
---|
32 | BOOL vboxVbvaBufferBeginUpdate (struct _DEVICE_EXTENSION* pDevExt, VBOXVBVAINFO *pVbva);
|
---|
33 | void vboxVbvaBufferEndUpdate (struct _DEVICE_EXTENSION* pDevExt, VBOXVBVAINFO *pVbva);
|
---|
34 |
|
---|
35 | #define VBOXVBVA_OP(_op, _pdext, _pvbva, _arg) \
|
---|
36 | do { \
|
---|
37 | if (vboxVbvaBufferBeginUpdate(_pdext, _pvbva)) \
|
---|
38 | { \
|
---|
39 | vboxVbva##_op(_pdext, _pvbva, _arg); \
|
---|
40 | vboxVbvaBufferEndUpdate(_pdext, _pvbva); \
|
---|
41 | } \
|
---|
42 | } while (0)
|
---|
43 |
|
---|
44 | #define VBOXVBVA_OP_WITHLOCK_ATDPC(_op, _pdext, _pvbva, _arg) \
|
---|
45 | do { \
|
---|
46 | KeAcquireSpinLockAtDpcLevel(&(_pvbva)->Lock); \
|
---|
47 | VBOXVBVA_OP(_op, _pdext, _pvbva, _arg); \
|
---|
48 | KeReleaseSpinLockFromDpcLevel(&(_pvbva)->Lock);\
|
---|
49 | } while (0)
|
---|
50 |
|
---|
51 | #define VBOXVBVA_OP_WITHLOCK(_op, _pdext, _pvbva, _arg) \
|
---|
52 | do { \
|
---|
53 | KIRQL OldIrql; \
|
---|
54 | KeAcquireSpinLock(&(_pvbva)->Lock, &OldIrql); \
|
---|
55 | VBOXVBVA_OP(_op, _pdext, _pvbva, _arg); \
|
---|
56 | KeReleaseSpinLock(&(_pvbva)->Lock, OldIrql); \
|
---|
57 | } while (0)
|
---|
58 |
|
---|
59 |
|
---|
60 | #endif /* #ifndef ___VBoxVideoVbva_h___ */
|
---|