1 | /* $Id: VBoxMPWddm.h 37626 2011-06-24 12:01:33Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * VBox WDDM Miniport driver
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2011 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 |
|
---|
19 | #ifndef ___VBoxMPWddm_h___
|
---|
20 | #define ___VBoxMPWddm_h___
|
---|
21 |
|
---|
22 | #include "common/VBoxMPUtils.h"
|
---|
23 | #include "common/VBoxMPDevExt.h"
|
---|
24 |
|
---|
25 | //#define VBOXWDDM_DEBUG_VIDPN
|
---|
26 |
|
---|
27 | RT_C_DECLS_BEGIN
|
---|
28 | NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath);
|
---|
29 | RT_C_DECLS_END
|
---|
30 |
|
---|
31 | #ifndef DEBUG_misha
|
---|
32 | # ifdef Assert
|
---|
33 | # undef Assert
|
---|
34 | # define Assert(_a) do{}while(0)
|
---|
35 | # endif
|
---|
36 | # ifdef AssertBreakpoint
|
---|
37 | # undef AssertBreakpoint
|
---|
38 | # define AssertBreakpoint() do{}while(0)
|
---|
39 | # endif
|
---|
40 | # ifdef AssertFailed
|
---|
41 | # undef AssertFailed
|
---|
42 | # define AssertFailed() do{}while(0)
|
---|
43 | # endif
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | PVOID vboxWddmMemAlloc(IN SIZE_T cbSize);
|
---|
47 | PVOID vboxWddmMemAllocZero(IN SIZE_T cbSize);
|
---|
48 | VOID vboxWddmMemFree(PVOID pvMem);
|
---|
49 |
|
---|
50 | NTSTATUS vboxWddmCallIsr(PVBOXMP_DEVEXT pDevExt);
|
---|
51 |
|
---|
52 | DECLINLINE(PVBOXWDDM_RESOURCE) vboxWddmResourceForAlloc(PVBOXWDDM_ALLOCATION pAlloc)
|
---|
53 | {
|
---|
54 | #if 0
|
---|
55 | if(pAlloc->iIndex == VBOXWDDM_ALLOCATIONINDEX_VOID)
|
---|
56 | return NULL;
|
---|
57 | PVBOXWDDM_RESOURCE pRc = (PVBOXWDDM_RESOURCE)(((uint8_t*)pAlloc) - RT_OFFSETOF(VBOXWDDM_RESOURCE, aAllocations[pAlloc->iIndex]));
|
---|
58 | return pRc;
|
---|
59 | #else
|
---|
60 | return pAlloc->pResource;
|
---|
61 | #endif
|
---|
62 | }
|
---|
63 |
|
---|
64 | VOID vboxWddmAllocationDestroy(PVBOXWDDM_ALLOCATION pAllocation);
|
---|
65 |
|
---|
66 | DECLINLINE(VOID) vboxWddmAllocationRelease(PVBOXWDDM_ALLOCATION pAllocation)
|
---|
67 | {
|
---|
68 | uint32_t cRefs = ASMAtomicDecU32(&pAllocation->cRefs);
|
---|
69 | Assert(cRefs < UINT32_MAX/2);
|
---|
70 | if (!cRefs)
|
---|
71 | {
|
---|
72 | vboxWddmAllocationDestroy(pAllocation);
|
---|
73 | }
|
---|
74 | }
|
---|
75 |
|
---|
76 | DECLINLINE(VOID) vboxWddmAllocationRetain(PVBOXWDDM_ALLOCATION pAllocation)
|
---|
77 | {
|
---|
78 | ASMAtomicIncU32(&pAllocation->cRefs);
|
---|
79 | }
|
---|
80 |
|
---|
81 |
|
---|
82 | #define VBOXWDDMENTRY_2_SWAPCHAIN(_pE) ((PVBOXWDDM_SWAPCHAIN)((uint8_t*)(_pE) - RT_OFFSETOF(VBOXWDDM_SWAPCHAIN, DevExtListEntry)))
|
---|
83 |
|
---|
84 | #ifdef VBOXWDDM_RENDER_FROM_SHADOW
|
---|
85 | # define VBOXWDDM_FB_ALLOCATION(_pSrc) ((_pSrc)->pShadowAllocation)
|
---|
86 | #else
|
---|
87 | # define VBOXWDDM_FB_ALLOCATION(_pSrc) ((_pSrc)->pPrimaryAllocation)
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | #endif /* #ifndef ___VBoxMPWddm_h___ */
|
---|