VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoMisc.h@ 33879

Last change on this file since 33879 was 33531, checked in by vboxsync, 14 years ago

adds burn fix

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.3 KB
Line 
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
13#ifndef ___VBoxVideoMisc_h__
14#define ___VBoxVideoMisc_h__
15
16DECLINLINE(void) vboxVideoLeDetach(LIST_ENTRY *pList, LIST_ENTRY *pDstList)
17{
18 if (IsListEmpty(pList))
19 {
20 InitializeListHead(pDstList);
21 }
22 else
23 {
24 *pDstList = *pList;
25 Assert(pDstList->Flink->Blink == pList);
26 Assert(pDstList->Blink->Flink == pList);
27 /* pDstList->Flink & pDstList->Blink point to the "real| entries, never to pList
28 * since we've checked IsListEmpty(pList) above */
29 pDstList->Flink->Blink = pDstList;
30 pDstList->Blink->Flink = pDstList;
31 InitializeListHead(pList);
32 }
33}
34
35typedef struct _DEVICE_EXTENSION *PDEVICE_EXTENSION;
36typedef struct VBOXWDDM_SWAPCHAIN *PVBOXWDDM_SWAPCHAIN;
37typedef struct VBOXWDDM_CONTEXT *PVBOXWDDM_CONTEXT;
38typedef struct VBOXWDDM_ALLOCATION *PVBOXWDDM_ALLOCATION;
39
40typedef uint32_t VBOXWDDM_HANDLE;
41#define VBOXWDDM_HANDLE_INVALID 0UL
42
43typedef struct VBOXWDDM_HTABLE
44{
45 uint32_t cData;
46 uint32_t iNext2Search;
47 uint32_t cSize;
48 PVOID *paData;
49} VBOXWDDM_HTABLE, *PVBOXWDDM_HTABLE;
50
51typedef struct VBOXWDDM_HTABLE_ITERATOR
52{
53 PVBOXWDDM_HTABLE pTbl;
54 uint32_t iCur;
55 uint32_t cLeft;
56} VBOXWDDM_HTABLE_ITERATOR, *PVBOXWDDM_HTABLE_ITERATOR;
57
58VOID vboxWddmHTableIterInit(PVBOXWDDM_HTABLE pTbl, PVBOXWDDM_HTABLE_ITERATOR pIter);
59PVOID vboxWddmHTableIterNext(PVBOXWDDM_HTABLE_ITERATOR pIter, VBOXWDDM_HANDLE *phHandle);
60BOOL vboxWddmHTableIterHasNext(PVBOXWDDM_HTABLE_ITERATOR pIter);
61PVOID vboxWddmHTableIterRemoveCur(PVBOXWDDM_HTABLE_ITERATOR pIter);
62NTSTATUS vboxWddmHTableCreate(PVBOXWDDM_HTABLE pTbl, uint32_t cSize);
63VOID vboxWddmHTableDestroy(PVBOXWDDM_HTABLE pTbl);
64NTSTATUS vboxWddmHTableRealloc(PVBOXWDDM_HTABLE pTbl, uint32_t cNewSize);
65VBOXWDDM_HANDLE vboxWddmHTablePut(PVBOXWDDM_HTABLE pTbl, PVOID pvData);
66PVOID vboxWddmHTableRemove(PVBOXWDDM_HTABLE pTbl, VBOXWDDM_HANDLE hHandle);
67PVOID vboxWddmHTableGet(PVBOXWDDM_HTABLE pTbl, VBOXWDDM_HANDLE hHandle);
68
69
70PVBOXWDDM_SWAPCHAIN vboxWddmSwapchainCreate();
71DECLINLINE(BOOLEAN) vboxWddmSwapchainRetain(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SWAPCHAIN pSwapchain);
72DECLINLINE(VOID) vboxWddmSwapchainRelease(PVBOXWDDM_SWAPCHAIN pSwapchain);
73PVBOXWDDM_SWAPCHAIN vboxWddmSwapchainRetainByAlloc(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pAlloc);
74VOID vboxWddmSwapchainAllocRemove(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SWAPCHAIN pSwapchain, PVBOXWDDM_ALLOCATION pAlloc);
75BOOLEAN vboxWddmSwapchainAllocAdd(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SWAPCHAIN pSwapchain, PVBOXWDDM_ALLOCATION pAlloc);
76VOID vboxWddmSwapchainAllocRemoveAll(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SWAPCHAIN pSwapchain);
77VOID vboxWddmSwapchainDestroy(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SWAPCHAIN pSwapchain);
78VOID vboxWddmSwapchainCtxDestroyAll(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_CONTEXT pContext);
79NTSTATUS vboxWddmSwapchainCtxEscape(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_CONTEXT pContext, PVBOXDISPIFESCAPE_SWAPCHAININFO pSwapchainInfo, UINT cbSize);
80
81
82NTSTATUS vboxWddmRegQueryDisplaySettingsKeyName(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId,
83 ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult);
84NTSTATUS vboxWddmRegOpenDisplaySettingsKey(IN PDEVICE_EXTENSION pDeviceExtension, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, OUT PHANDLE phKey);
85NTSTATUS vboxWddmRegDisplaySettingsQueryRelX(HANDLE hKey, int * pResult);
86NTSTATUS vboxWddmRegDisplaySettingsQueryRelY(HANDLE hKey, int * pResult);
87NTSTATUS vboxWddmDisplaySettingsQueryPos(IN PDEVICE_EXTENSION pDeviceExtension, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, POINT * pPos);
88NTSTATUS vboxWddmRegQueryVideoGuidString(ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult);
89
90NTSTATUS vboxWddmRegQueryDrvKeyName(PDEVICE_EXTENSION pDevExt, ULONG cbBuf, PWCHAR pBuf, PULONG pcbResult);
91
92NTSTATUS vboxWddmRegOpenKey(OUT PHANDLE phKey, IN PWCHAR pName, IN ACCESS_MASK fAccess);
93NTSTATUS vboxWddmRegQueryValueDword(IN HANDLE hKey, IN PWCHAR pName, OUT PDWORD pDword);
94NTSTATUS vboxWddmRegSetValueDword(IN HANDLE hKey, IN PWCHAR pName, OUT DWORD val);
95
96UNICODE_STRING* vboxWddmVGuidGet(PDEVICE_EXTENSION pDevExt);
97VOID vboxWddmVGuidFree(PDEVICE_EXTENSION pDevExt);
98
99#define VBOXWDDM_MM_VOID 0xffffffffUL
100
101typedef struct VBOXWDDM_MM
102{
103 RTL_BITMAP BitMap;
104 UINT cPages;
105 UINT cAllocs;
106 PULONG pBuffer;
107} VBOXWDDM_MM, *PVBOXWDDM_MM;
108
109NTSTATUS vboxMmInit(PVBOXWDDM_MM pMm, UINT cPages);
110ULONG vboxMmAlloc(PVBOXWDDM_MM pMm, UINT cPages);
111VOID vboxMmFree(PVBOXWDDM_MM pMm, UINT iPage, UINT cPages);
112NTSTATUS vboxMmTerm(PVBOXWDDM_MM pMm);
113
114typedef struct VBOXVIDEOCM_ALLOC_MGR
115{
116 /* synch lock */
117 FAST_MUTEX Mutex;
118 VBOXWDDM_HTABLE AllocTable;
119 VBOXWDDM_MM Mm;
120// PHYSICAL_ADDRESS PhData;
121 uint8_t *pvData;
122 uint32_t offData;
123 uint32_t cbData;
124} VBOXVIDEOCM_ALLOC_MGR, *PVBOXVIDEOCM_ALLOC_MGR;
125
126typedef struct VBOXVIDEOCM_ALLOC_CONTEXT
127{
128 PVBOXVIDEOCM_ALLOC_MGR pMgr;
129 /* synch lock */
130 FAST_MUTEX Mutex;
131 VBOXWDDM_HTABLE AllocTable;
132} VBOXVIDEOCM_ALLOC_CONTEXT, *PVBOXVIDEOCM_ALLOC_CONTEXT;
133
134NTSTATUS vboxVideoAMgrCreate(PDEVICE_EXTENSION pDevExt, PVBOXVIDEOCM_ALLOC_MGR pMgr, uint32_t offData, uint32_t cbData);
135NTSTATUS vboxVideoAMgrDestroy(PDEVICE_EXTENSION pDevExt, PVBOXVIDEOCM_ALLOC_MGR pMgr);
136
137NTSTATUS vboxVideoAMgrCtxCreate(PVBOXVIDEOCM_ALLOC_MGR pMgr, PVBOXVIDEOCM_ALLOC_CONTEXT pCtx);
138NTSTATUS vboxVideoAMgrCtxDestroy(PVBOXVIDEOCM_ALLOC_CONTEXT pCtx);
139
140NTSTATUS vboxVideoAMgrCtxAllocCreate(PVBOXVIDEOCM_ALLOC_CONTEXT pContext, PVBOXVIDEOCM_UM_ALLOC pUmAlloc);
141NTSTATUS vboxVideoAMgrCtxAllocDestroy(PVBOXVIDEOCM_ALLOC_CONTEXT pContext, VBOXDISP_KMHANDLE hSesionHandle);
142
143#ifdef VBOX_WITH_VDMA
144NTSTATUS vboxVideoAMgrCtxAllocSubmit(PDEVICE_EXTENSION pDevExt, PVBOXVIDEOCM_ALLOC_CONTEXT pContext, UINT cBuffers, VBOXWDDM_UHGSMI_BUFFER_UI_INFO_ESCAPE *paBuffers);
145#endif
146
147#endif /* #ifndef ___VBoxVideoMisc_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