VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.h@ 55759

Last change on this file since 55759 was 52350, checked in by vboxsync, 10 years ago

more resize fixes, dumper fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.2 KB
Line 
1/* $Id: VBoxMPMisc.h 52350 2014-08-11 18:30:55Z vboxsync $ */
2
3/** @file
4 * VBox WDDM Miniport driver
5 */
6
7/*
8 * Copyright (C) 2011-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
19#ifndef ___VBoxMPMisc_h__
20#define ___VBoxMPMisc_h__
21
22#include "../../common/VBoxVideoTools.h"
23
24DECLINLINE(void) vboxVideoLeDetach(LIST_ENTRY *pList, LIST_ENTRY *pDstList)
25{
26 if (IsListEmpty(pList))
27 {
28 InitializeListHead(pDstList);
29 }
30 else
31 {
32 *pDstList = *pList;
33 Assert(pDstList->Flink->Blink == pList);
34 Assert(pDstList->Blink->Flink == pList);
35 /* pDstList->Flink & pDstList->Blink point to the "real| entries, never to pList
36 * since we've checked IsListEmpty(pList) above */
37 pDstList->Flink->Blink = pDstList;
38 pDstList->Blink->Flink = pDstList;
39 InitializeListHead(pList);
40 }
41}
42
43typedef uint32_t VBOXWDDM_HANDLE;
44#define VBOXWDDM_HANDLE_INVALID 0UL
45
46typedef struct VBOXWDDM_HTABLE
47{
48 uint32_t cData;
49 uint32_t iNext2Search;
50 uint32_t cSize;
51 PVOID *paData;
52} VBOXWDDM_HTABLE, *PVBOXWDDM_HTABLE;
53
54typedef struct VBOXWDDM_HTABLE_ITERATOR
55{
56 PVBOXWDDM_HTABLE pTbl;
57 uint32_t iCur;
58 uint32_t cLeft;
59} VBOXWDDM_HTABLE_ITERATOR, *PVBOXWDDM_HTABLE_ITERATOR;
60
61VOID vboxWddmHTableIterInit(PVBOXWDDM_HTABLE pTbl, PVBOXWDDM_HTABLE_ITERATOR pIter);
62PVOID vboxWddmHTableIterNext(PVBOXWDDM_HTABLE_ITERATOR pIter, VBOXWDDM_HANDLE *phHandle);
63BOOL vboxWddmHTableIterHasNext(PVBOXWDDM_HTABLE_ITERATOR pIter);
64PVOID vboxWddmHTableIterRemoveCur(PVBOXWDDM_HTABLE_ITERATOR pIter);
65NTSTATUS vboxWddmHTableCreate(PVBOXWDDM_HTABLE pTbl, uint32_t cSize);
66VOID vboxWddmHTableDestroy(PVBOXWDDM_HTABLE pTbl);
67NTSTATUS vboxWddmHTableRealloc(PVBOXWDDM_HTABLE pTbl, uint32_t cNewSize);
68VBOXWDDM_HANDLE vboxWddmHTablePut(PVBOXWDDM_HTABLE pTbl, PVOID pvData);
69PVOID vboxWddmHTableRemove(PVBOXWDDM_HTABLE pTbl, VBOXWDDM_HANDLE hHandle);
70PVOID vboxWddmHTableGet(PVBOXWDDM_HTABLE pTbl, VBOXWDDM_HANDLE hHandle);
71
72#ifdef VBOX_WITH_CROGL
73PVBOXWDDM_SWAPCHAIN vboxWddmSwapchainCreate();
74BOOLEAN vboxWddmSwapchainRetain(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SWAPCHAIN pSwapchain);
75VOID vboxWddmSwapchainRelease(PVBOXWDDM_SWAPCHAIN pSwapchain);
76PVBOXWDDM_SWAPCHAIN vboxWddmSwapchainRetainByAlloc(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOCATION *pAlloc);
77PVBOXWDDM_SWAPCHAIN vboxWddmSwapchainRetainByAllocData(PVBOXMP_DEVEXT pDevExt, const struct VBOXWDDM_ALLOC_DATA *pAllocData);
78VOID vboxWddmSwapchainAllocRemove(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SWAPCHAIN pSwapchain, PVBOXWDDM_ALLOCATION pAlloc);
79BOOLEAN vboxWddmSwapchainAllocAdd(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SWAPCHAIN pSwapchain, PVBOXWDDM_ALLOCATION pAlloc);
80VOID vboxWddmSwapchainAllocRemoveAll(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SWAPCHAIN pSwapchain);
81VOID vboxWddmSwapchainDestroy(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SWAPCHAIN pSwapchain);
82VOID vboxWddmSwapchainCtxDestroyAll(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_CONTEXT pContext);
83NTSTATUS vboxWddmSwapchainCtxEscape(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_CONTEXT pContext, PVBOXDISPIFESCAPE_SWAPCHAININFO pSwapchainInfo, UINT cbSize);
84NTSTATUS vboxWddmSwapchainCtxInit(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_CONTEXT pContext);
85VOID vboxWddmSwapchainCtxTerm(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_CONTEXT pContext);
86#endif
87
88
89NTSTATUS vboxWddmRegQueryDisplaySettingsKeyName(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId,
90 ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult);
91NTSTATUS vboxWddmRegOpenDisplaySettingsKey(IN PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, OUT PHANDLE phKey);
92NTSTATUS vboxWddmRegDisplaySettingsQueryRelX(HANDLE hKey, int * pResult);
93NTSTATUS vboxWddmRegDisplaySettingsQueryRelY(HANDLE hKey, int * pResult);
94NTSTATUS vboxWddmDisplaySettingsQueryPos(IN PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, POINT * pPos);
95void vboxWddmDisplaySettingsCheckPos(IN PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId);
96NTSTATUS vboxWddmRegQueryVideoGuidString(PVBOXMP_DEVEXT pDevExt, ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult);
97
98NTSTATUS vboxWddmRegQueryDrvKeyName(PVBOXMP_DEVEXT pDevExt, ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult);
99
100NTSTATUS vboxWddmRegOpenKeyEx(OUT PHANDLE phKey, IN HANDLE hRootKey, IN PWCHAR pName, IN ACCESS_MASK fAccess);
101NTSTATUS vboxWddmRegOpenKey(OUT PHANDLE phKey, IN PWCHAR pName, IN ACCESS_MASK fAccess);
102NTSTATUS vboxWddmRegQueryValueDword(IN HANDLE hKey, IN PWCHAR pName, OUT PDWORD pDword);
103NTSTATUS vboxWddmRegSetValueDword(IN HANDLE hKey, IN PWCHAR pName, IN DWORD val);
104
105NTSTATUS vboxWddmRegDrvFlagsSet(PVBOXMP_DEVEXT pDevExt, DWORD fVal);
106DWORD vboxWddmRegDrvFlagsGet(PVBOXMP_DEVEXT pDevExt, DWORD fDefault);
107
108UNICODE_STRING* vboxWddmVGuidGet(PVBOXMP_DEVEXT pDevExt);
109VOID vboxWddmVGuidFree(PVBOXMP_DEVEXT pDevExt);
110
111#define VBOXWDDM_MM_VOID 0xffffffffUL
112
113typedef struct VBOXWDDM_MM
114{
115 RTL_BITMAP BitMap;
116 UINT cPages;
117 UINT cAllocs;
118 PULONG pBuffer;
119} VBOXWDDM_MM, *PVBOXWDDM_MM;
120
121NTSTATUS vboxMmInit(PVBOXWDDM_MM pMm, UINT cPages);
122ULONG vboxMmAlloc(PVBOXWDDM_MM pMm, UINT cPages);
123VOID vboxMmFree(PVBOXWDDM_MM pMm, UINT iPage, UINT cPages);
124NTSTATUS vboxMmTerm(PVBOXWDDM_MM pMm);
125
126typedef struct VBOXVIDEOCM_ALLOC_MGR
127{
128 /* synch lock */
129 FAST_MUTEX Mutex;
130 VBOXWDDM_HTABLE AllocTable;
131 VBOXWDDM_MM Mm;
132// PHYSICAL_ADDRESS PhData;
133 uint8_t *pvData;
134 uint32_t offData;
135 uint32_t cbData;
136} VBOXVIDEOCM_ALLOC_MGR, *PVBOXVIDEOCM_ALLOC_MGR;
137
138typedef struct VBOXVIDEOCM_ALLOC_CONTEXT
139{
140 PVBOXVIDEOCM_ALLOC_MGR pMgr;
141 /* synch lock */
142 FAST_MUTEX Mutex;
143 VBOXWDDM_HTABLE AllocTable;
144} VBOXVIDEOCM_ALLOC_CONTEXT, *PVBOXVIDEOCM_ALLOC_CONTEXT;
145
146NTSTATUS vboxVideoAMgrCreate(PVBOXMP_DEVEXT pDevExt, PVBOXVIDEOCM_ALLOC_MGR pMgr, uint32_t offData, uint32_t cbData);
147NTSTATUS vboxVideoAMgrDestroy(PVBOXMP_DEVEXT pDevExt, PVBOXVIDEOCM_ALLOC_MGR pMgr);
148
149NTSTATUS vboxVideoAMgrCtxCreate(PVBOXVIDEOCM_ALLOC_MGR pMgr, PVBOXVIDEOCM_ALLOC_CONTEXT pCtx);
150NTSTATUS vboxVideoAMgrCtxDestroy(PVBOXVIDEOCM_ALLOC_CONTEXT pCtx);
151
152NTSTATUS vboxVideoAMgrCtxAllocCreate(PVBOXVIDEOCM_ALLOC_CONTEXT pContext, PVBOXVIDEOCM_UM_ALLOC pUmAlloc);
153NTSTATUS vboxVideoAMgrCtxAllocDestroy(PVBOXVIDEOCM_ALLOC_CONTEXT pContext, VBOXDISP_KMHANDLE hSesionHandle);
154
155#ifdef VBOX_WITH_CRHGSMI
156NTSTATUS vboxVideoAMgrCtxAllocSubmit(PVBOXMP_DEVEXT pDevExt, PVBOXVIDEOCM_ALLOC_CONTEXT pContext, UINT cBuffers, VBOXWDDM_UHGSMI_BUFFER_UI_INFO_ESCAPE *paBuffers);
157#endif
158
159VOID vboxWddmSleep(uint32_t u32Val);
160VOID vboxWddmCounterU32Wait(uint32_t volatile * pu32, uint32_t u32Val);
161
162NTSTATUS vboxUmdDumpBuf(PVBOXDISPIFESCAPE_DBGDUMPBUF pBuf, uint32_t cbBuffer);
163
164#if 0
165/* wine shrc handle -> allocation map */
166VOID vboxShRcTreeInit(PVBOXMP_DEVEXT pDevExt);
167VOID vboxShRcTreeTerm(PVBOXMP_DEVEXT pDevExt);
168BOOLEAN vboxShRcTreePut(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pAlloc);
169PVBOXWDDM_ALLOCATION vboxShRcTreeGet(PVBOXMP_DEVEXT pDevExt, HANDLE hSharedRc);
170BOOLEAN vboxShRcTreeRemove(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pAlloc);
171#endif
172
173NTSTATUS vboxWddmDrvCfgInit(PUNICODE_STRING pRegStr);
174
175#ifdef VBOX_VDMA_WITH_WATCHDOG
176NTSTATUS vboxWddmWdInit(PVBOXMP_DEVEXT pDevExt);
177NTSTATUS vboxWddmWdTerm(PVBOXMP_DEVEXT pDevExt);
178#endif
179
180NTSTATUS VBoxWddmSlEnableVSyncNotification(PVBOXMP_DEVEXT pDevExt, BOOLEAN fEnable);
181NTSTATUS VBoxWddmSlGetScanLine(PVBOXMP_DEVEXT pDevExt, DXGKARG_GETSCANLINE *pSl);
182NTSTATUS VBoxWddmSlInit(PVBOXMP_DEVEXT pDevExt);
183NTSTATUS VBoxWddmSlTerm(PVBOXMP_DEVEXT pDevExt);
184
185#ifdef VBOX_WDDM_WIN8
186void vboxWddmDiInitDefault(DXGK_DISPLAY_INFORMATION *pInfo, PHYSICAL_ADDRESS PhAddr, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId);
187void vboxWddmDiToAllocData(PVBOXMP_DEVEXT pDevExt, const DXGK_DISPLAY_INFORMATION *pInfo, struct VBOXWDDM_ALLOC_DATA *pAllocData);
188void vboxWddmDmSetupDefaultVramLocation(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID ModifiedVidPnSourceId, struct VBOXWDDM_SOURCE *paSources);
189#endif
190
191#endif /* #ifndef ___VBoxMPMisc_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