VirtualBox

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

Last change on this file since 95009 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.8 KB
Line 
1/* $Id: VBoxMPMisc.h 93115 2022-01-01 11:31:46Z vboxsync $ */
2/** @file
3 * VBox WDDM Miniport driver
4 */
5
6/*
7 * Copyright (C) 2011-2022 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef GA_INCLUDED_SRC_WINNT_Graphics_Video_mp_wddm_VBoxMPMisc_h
19#define GA_INCLUDED_SRC_WINNT_Graphics_Video_mp_wddm_VBoxMPMisc_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include "../../common/VBoxVideoTools.h"
25
26DECLINLINE(void) vboxVideoLeDetach(LIST_ENTRY *pList, LIST_ENTRY *pDstList)
27{
28 if (IsListEmpty(pList))
29 {
30 InitializeListHead(pDstList);
31 }
32 else
33 {
34 *pDstList = *pList;
35 Assert(pDstList->Flink->Blink == pList);
36 Assert(pDstList->Blink->Flink == pList);
37 /* pDstList->Flink & pDstList->Blink point to the "real| entries, never to pList
38 * since we've checked IsListEmpty(pList) above */
39 pDstList->Flink->Blink = pDstList;
40 pDstList->Blink->Flink = pDstList;
41 InitializeListHead(pList);
42 }
43}
44
45typedef uint32_t VBOXWDDM_HANDLE;
46#define VBOXWDDM_HANDLE_INVALID 0UL
47
48typedef struct VBOXWDDM_HTABLE
49{
50 uint32_t cData;
51 uint32_t iNext2Search;
52 uint32_t cSize;
53 PVOID *paData;
54} VBOXWDDM_HTABLE, *PVBOXWDDM_HTABLE;
55
56typedef struct VBOXWDDM_HTABLE_ITERATOR
57{
58 PVBOXWDDM_HTABLE pTbl;
59 uint32_t iCur;
60 uint32_t cLeft;
61} VBOXWDDM_HTABLE_ITERATOR, *PVBOXWDDM_HTABLE_ITERATOR;
62
63VOID vboxWddmHTableIterInit(PVBOXWDDM_HTABLE pTbl, PVBOXWDDM_HTABLE_ITERATOR pIter);
64PVOID vboxWddmHTableIterNext(PVBOXWDDM_HTABLE_ITERATOR pIter, VBOXWDDM_HANDLE *phHandle);
65BOOL vboxWddmHTableIterHasNext(PVBOXWDDM_HTABLE_ITERATOR pIter);
66PVOID vboxWddmHTableIterRemoveCur(PVBOXWDDM_HTABLE_ITERATOR pIter);
67NTSTATUS vboxWddmHTableCreate(PVBOXWDDM_HTABLE pTbl, uint32_t cSize);
68VOID vboxWddmHTableDestroy(PVBOXWDDM_HTABLE pTbl);
69NTSTATUS vboxWddmHTableRealloc(PVBOXWDDM_HTABLE pTbl, uint32_t cNewSize);
70VBOXWDDM_HANDLE vboxWddmHTablePut(PVBOXWDDM_HTABLE pTbl, PVOID pvData);
71PVOID vboxWddmHTableRemove(PVBOXWDDM_HTABLE pTbl, VBOXWDDM_HANDLE hHandle);
72PVOID vboxWddmHTableGet(PVBOXWDDM_HTABLE pTbl, VBOXWDDM_HANDLE hHandle);
73
74NTSTATUS vboxWddmRegQueryDisplaySettingsKeyName(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId,
75 ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult);
76NTSTATUS vboxWddmRegOpenDisplaySettingsKey(IN PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, OUT PHANDLE phKey);
77NTSTATUS vboxWddmRegDisplaySettingsQueryRelX(HANDLE hKey, int * pResult);
78NTSTATUS vboxWddmRegDisplaySettingsQueryRelY(HANDLE hKey, int * pResult);
79NTSTATUS vboxWddmDisplaySettingsQueryPos(IN PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, POINT * pPos);
80void vboxWddmDisplaySettingsCheckPos(IN PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId);
81NTSTATUS vboxWddmRegQueryVideoGuidString(PVBOXMP_DEVEXT pDevExt, ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult);
82
83NTSTATUS vboxWddmRegQueryDrvKeyName(PVBOXMP_DEVEXT pDevExt, ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult);
84
85NTSTATUS vboxWddmRegOpenKeyEx(OUT PHANDLE phKey, IN HANDLE hRootKey, IN PWCHAR pName, IN ACCESS_MASK fAccess);
86NTSTATUS vboxWddmRegOpenKey(OUT PHANDLE phKey, IN PWCHAR pName, IN ACCESS_MASK fAccess);
87NTSTATUS vboxWddmRegQueryValueDword(IN HANDLE hKey, IN PWCHAR pName, OUT PDWORD pDword);
88NTSTATUS vboxWddmRegSetValueDword(IN HANDLE hKey, IN PWCHAR pName, IN DWORD val);
89
90NTSTATUS vboxWddmRegDrvFlagsSet(PVBOXMP_DEVEXT pDevExt, DWORD fVal);
91DWORD vboxWddmRegDrvFlagsGet(PVBOXMP_DEVEXT pDevExt, DWORD fDefault);
92
93UNICODE_STRING* vboxWddmVGuidGet(PVBOXMP_DEVEXT pDevExt);
94VOID vboxWddmVGuidFree(PVBOXMP_DEVEXT pDevExt);
95
96#define VBOXWDDM_MM_VOID 0xffffffffUL
97
98typedef struct VBOXWDDM_MM
99{
100 RTL_BITMAP BitMap;
101 UINT cPages;
102 UINT cAllocs;
103 PULONG pBuffer;
104} VBOXWDDM_MM, *PVBOXWDDM_MM;
105
106NTSTATUS vboxMmInit(PVBOXWDDM_MM pMm, UINT cPages);
107ULONG vboxMmAlloc(PVBOXWDDM_MM pMm, UINT cPages);
108VOID vboxMmFree(PVBOXWDDM_MM pMm, UINT iPage, UINT cPages);
109NTSTATUS vboxMmTerm(PVBOXWDDM_MM pMm);
110
111typedef struct VBOXVIDEOCM_ALLOC_MGR
112{
113 /* synch lock */
114 FAST_MUTEX Mutex;
115 VBOXWDDM_HTABLE AllocTable;
116 VBOXWDDM_MM Mm;
117// PHYSICAL_ADDRESS PhData;
118 uint8_t *pvData;
119 uint32_t offData;
120 uint32_t cbData;
121} VBOXVIDEOCM_ALLOC_MGR, *PVBOXVIDEOCM_ALLOC_MGR;
122
123typedef struct VBOXVIDEOCM_ALLOC_CONTEXT
124{
125 PVBOXVIDEOCM_ALLOC_MGR pMgr;
126 /* synch lock */
127 FAST_MUTEX Mutex;
128 VBOXWDDM_HTABLE AllocTable;
129} VBOXVIDEOCM_ALLOC_CONTEXT, *PVBOXVIDEOCM_ALLOC_CONTEXT;
130
131NTSTATUS vboxVideoAMgrCreate(PVBOXMP_DEVEXT pDevExt, PVBOXVIDEOCM_ALLOC_MGR pMgr, uint32_t offData, uint32_t cbData);
132NTSTATUS vboxVideoAMgrDestroy(PVBOXMP_DEVEXT pDevExt, PVBOXVIDEOCM_ALLOC_MGR pMgr);
133
134NTSTATUS vboxVideoAMgrCtxCreate(PVBOXVIDEOCM_ALLOC_MGR pMgr, PVBOXVIDEOCM_ALLOC_CONTEXT pCtx);
135NTSTATUS vboxVideoAMgrCtxDestroy(PVBOXVIDEOCM_ALLOC_CONTEXT pCtx);
136
137NTSTATUS vboxVideoAMgrCtxAllocCreate(PVBOXVIDEOCM_ALLOC_CONTEXT pContext, PVBOXVIDEOCM_UM_ALLOC pUmAlloc);
138NTSTATUS vboxVideoAMgrCtxAllocDestroy(PVBOXVIDEOCM_ALLOC_CONTEXT pContext, VBOXDISP_KMHANDLE hSesionHandle);
139
140VOID vboxWddmSleep(uint32_t u32Val);
141VOID vboxWddmCounterU32Wait(uint32_t volatile * pu32, uint32_t u32Val);
142
143NTSTATUS vboxUmdDumpBuf(PVBOXDISPIFESCAPE_DBGDUMPBUF pBuf, uint32_t cbBuffer);
144
145#if 0
146/* wine shrc handle -> allocation map */
147VOID vboxShRcTreeInit(PVBOXMP_DEVEXT pDevExt);
148VOID vboxShRcTreeTerm(PVBOXMP_DEVEXT pDevExt);
149BOOLEAN vboxShRcTreePut(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pAlloc);
150PVBOXWDDM_ALLOCATION vboxShRcTreeGet(PVBOXMP_DEVEXT pDevExt, HANDLE hSharedRc);
151BOOLEAN vboxShRcTreeRemove(PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_ALLOCATION pAlloc);
152#endif
153
154NTSTATUS vboxWddmDrvCfgInit(PUNICODE_STRING pRegStr);
155
156NTSTATUS VBoxWddmSlEnableVSyncNotification(PVBOXMP_DEVEXT pDevExt, BOOLEAN fEnable);
157NTSTATUS VBoxWddmSlGetScanLine(PVBOXMP_DEVEXT pDevExt, DXGKARG_GETSCANLINE *pSl);
158NTSTATUS VBoxWddmSlInit(PVBOXMP_DEVEXT pDevExt);
159NTSTATUS VBoxWddmSlTerm(PVBOXMP_DEVEXT pDevExt);
160
161void vboxWddmDiInitDefault(DXGK_DISPLAY_INFORMATION *pInfo, PHYSICAL_ADDRESS PhAddr, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId);
162void vboxWddmDiToAllocData(PVBOXMP_DEVEXT pDevExt, const DXGK_DISPLAY_INFORMATION *pInfo, struct VBOXWDDM_ALLOC_DATA *pAllocData);
163void vboxWddmDmSetupDefaultVramLocation(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID ModifiedVidPnSourceId, struct VBOXWDDM_SOURCE *paSources);
164
165char const *vboxWddmAllocTypeString(PVBOXWDDM_ALLOCATION pAlloc);
166
167#endif /* !GA_INCLUDED_SRC_WINNT_Graphics_Video_mp_wddm_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