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 ___VBoxVideoWddm_h___
|
---|
13 | #define ___VBoxVideoWddm_h___
|
---|
14 |
|
---|
15 | #include "../VBoxVideo.h"
|
---|
16 |
|
---|
17 | /* one page size */
|
---|
18 | #define VBOXWDDM_C_DMA_BUFFER_SIZE 0x1000
|
---|
19 | #define VBOXWDDM_C_ALLOC_LIST_SIZE 0xc00
|
---|
20 | #define VBOXWDDM_C_PATH_LOCATION_LIST_SIZE 0xc00
|
---|
21 |
|
---|
22 | #define VBOXWDDM_C_POINTER_MAX_WIDTH 64
|
---|
23 | #define VBOXWDDM_C_POINTER_MAX_HEIGHT 64
|
---|
24 |
|
---|
25 | #define VBOXWDDM_C_VDMA_BUFFER_SIZE (64*_1K)
|
---|
26 |
|
---|
27 | #ifdef VBOXWDDM_WITH_VBVA
|
---|
28 | # define VBOXWDDM_RENDER_FROM_SHADOW
|
---|
29 | #endif
|
---|
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 | /* allocation */
|
---|
51 | //#define VBOXWDDM_ALLOCATIONINDEX_VOID (~0U)
|
---|
52 | typedef struct VBOXWDDM_ALLOCATION
|
---|
53 | {
|
---|
54 | VBOXWDDM_ALLOC_TYPE enmType;
|
---|
55 | // D3DDDI_RESOURCEFLAGS fRcFlags;
|
---|
56 | UINT SegmentId;
|
---|
57 | VBOXVIDEOOFFSET offVram;
|
---|
58 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
59 | VBOXVHWA_SURFHANDLE hHostHandle;
|
---|
60 | #endif
|
---|
61 | BOOLEAN bVisible;
|
---|
62 | BOOLEAN bAssigned;
|
---|
63 | VBOXWDDM_SURFACE_DESC SurfDesc;
|
---|
64 | struct VBOXWDDM_RESOURCE *pResource;
|
---|
65 | uint32_t iIndex;
|
---|
66 | } VBOXWDDM_ALLOCATION, *PVBOXWDDM_ALLOCATION;
|
---|
67 |
|
---|
68 | typedef struct VBOXWDDM_RESOURCE
|
---|
69 | {
|
---|
70 | uint32_t fFlags;
|
---|
71 | VBOXWDDM_RC_DESC RcDesc;
|
---|
72 | uint32_t cAllocations;
|
---|
73 | VBOXWDDM_ALLOCATION aAllocations[1];
|
---|
74 | } VBOXWDDM_RESOURCE, *PVBOXWDDM_RESOURCE;
|
---|
75 |
|
---|
76 | DECLINLINE(PVBOXWDDM_RESOURCE) vboxWddmResourceForAlloc(PVBOXWDDM_ALLOCATION pAlloc)
|
---|
77 | {
|
---|
78 | #if 0
|
---|
79 | if(pAlloc->iIndex == VBOXWDDM_ALLOCATIONINDEX_VOID)
|
---|
80 | return NULL;
|
---|
81 | PVBOXWDDM_RESOURCE pRc = (PVBOXWDDM_RESOURCE)(((uint8_t*)pAlloc) - RT_OFFSETOF(VBOXWDDM_RESOURCE, aAllocations[pAlloc->iIndex]));
|
---|
82 | return pRc;
|
---|
83 | #else
|
---|
84 | return pAlloc->pResource;
|
---|
85 | #endif
|
---|
86 | }
|
---|
87 |
|
---|
88 | typedef struct VBOXWDDM_OVERLAY
|
---|
89 | {
|
---|
90 | PDEVICE_EXTENSION pDevExt;
|
---|
91 | PVBOXWDDM_RESOURCE pResource;
|
---|
92 | PVBOXWDDM_ALLOCATION pCurentAlloc;
|
---|
93 | D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
|
---|
94 | } VBOXWDDM_OVERLAY, *PVBOXWDDM_OVERLAY;
|
---|
95 |
|
---|
96 | typedef enum
|
---|
97 | {
|
---|
98 | VBOXWDDM_DEVICE_TYPE_UNDEFINED = 0,
|
---|
99 | VBOXWDDM_DEVICE_TYPE_SYSTEM
|
---|
100 | } VBOXWDDM_DEVICE_TYPE;
|
---|
101 |
|
---|
102 | typedef struct VBOXWDDM_DEVICE
|
---|
103 | {
|
---|
104 | struct _DEVICE_EXTENSION * pAdapter; /* Adapder info */
|
---|
105 | HANDLE hDevice; /* handle passed to CreateDevice */
|
---|
106 | VBOXWDDM_DEVICE_TYPE enmType; /* device creation flags passed to DxgkDdiCreateDevice, not sure we need it */
|
---|
107 | } VBOXWDDM_DEVICE, *PVBOXWDDM_DEVICE;
|
---|
108 |
|
---|
109 | typedef enum
|
---|
110 | {
|
---|
111 | VBOXWDDM_CONTEXT_TYPE_UNDEFINED = 0,
|
---|
112 | VBOXWDDM_CONTEXT_TYPE_SYSTEM
|
---|
113 | } VBOXWDDM_CONTEXT_TYPE;
|
---|
114 |
|
---|
115 | typedef struct VBOXWDDM_CONTEXT
|
---|
116 | {
|
---|
117 | struct VBOXWDDM_DEVICE * pDevice;
|
---|
118 | HANDLE hContext;
|
---|
119 | VBOXWDDM_CONTEXT_TYPE enmType;
|
---|
120 | UINT NodeOrdinal;
|
---|
121 | UINT EngineAffinity;
|
---|
122 | UINT uLastCompletedCmdFenceId;
|
---|
123 | } VBOXWDDM_CONTEXT, *PVBOXWDDM_CONTEXT;
|
---|
124 |
|
---|
125 | typedef struct VBOXWDDM_DMA_PRIVATE_DATA
|
---|
126 | {
|
---|
127 | PVBOXWDDM_CONTEXT pContext;
|
---|
128 | VBOXVDMACMD_TYPE enmCmd;
|
---|
129 | #ifdef VBOXWDDM_RENDER_FROM_SHADOW
|
---|
130 | RECT rect;
|
---|
131 | VBOXVIDEOOFFSET offShadow;
|
---|
132 | UINT segmentIdShadow;
|
---|
133 | D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId;
|
---|
134 | #endif
|
---|
135 | // uint8_t Reserved[8];
|
---|
136 | }VBOXWDDM_DMA_PRIVATE_DATA, *PVBOXWDDM_DMA_PRIVATE_DATA;
|
---|
137 |
|
---|
138 | typedef struct VBOXWDDM_OPENALLOCATION
|
---|
139 | {
|
---|
140 | D3DKMT_HANDLE hAllocation;
|
---|
141 | } VBOXWDDM_OPENALLOCATION, *PVBOXWDDM_OPENALLOCATION;
|
---|
142 |
|
---|
143 | #ifdef VBOXWDDM_RENDER_FROM_SHADOW
|
---|
144 | # define VBOXWDDM_FB_ALLOCATION(_pSrc) ((_pSrc)->pShadowAllocation)
|
---|
145 | #else
|
---|
146 | # define VBOXWDDM_FB_ALLOCATION(_pSrc) ((_pSrc)->pPrimaryAllocation)
|
---|
147 | #endif
|
---|
148 |
|
---|
149 | //DECLINLINE(VBOXVIDEOOFFSET) vboxWddmOffsetFromPhAddress(PHYSICAL_ADDRESS phAddr)
|
---|
150 | //{
|
---|
151 | // return (VBOXVIDEOOFFSET)(phAddr.QuadPart ? phAddr.QuadPart - VBE_DISPI_LFB_PHYSICAL_ADDRESS : VBOXVIDEOOFFSET_VOID);
|
---|
152 | //}
|
---|
153 |
|
---|
154 | #endif /* #ifndef ___VBoxVideoWddm_h___ */
|
---|