1 | /* $Id: VBoxWddmUmHlp.h 76553 2019-01-01 01:45:53Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox WDDM User Mode Driver Helpers
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2018-2019 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 ___VBoxWddmUmHlp_h__
|
---|
19 | #define ___VBoxWddmUmHlp_h__
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include <iprt/win/d3d9.h>
|
---|
25 | #include <d3dumddi.h>
|
---|
26 | #include <d3dkmthk.h>
|
---|
27 |
|
---|
28 | #include <iprt/asm.h>
|
---|
29 | #include <iprt/cdefs.h>
|
---|
30 |
|
---|
31 | /* Do not require IPRT library. */
|
---|
32 | #if defined(Assert)
|
---|
33 | #undef Assert
|
---|
34 | #endif
|
---|
35 | #ifdef RT_STRICT
|
---|
36 | #define Assert(_e) (void)( (!!(_e)) || (ASMBreakpoint(), 0) )
|
---|
37 | #else
|
---|
38 | #define Assert(_e) (void)( 0 )
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | /* Do not require ntstatus.h.
|
---|
42 | * D3DKMT functions return NTSTATUS, but the driver code uses it only as a success/failure indicator.
|
---|
43 | * Therefore define the success and a failure status here.
|
---|
44 | */
|
---|
45 | #ifndef STATUS_SUCCESS
|
---|
46 | #define STATUS_SUCCESS 0
|
---|
47 | #endif
|
---|
48 | #ifndef STATUS_NOT_SUPPORTED
|
---|
49 | #define STATUS_NOT_SUPPORTED ((NTSTATUS)0xC00000BBL)
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | RT_C_DECLS_BEGIN
|
---|
53 |
|
---|
54 | typedef struct VBOXWDDMDLLPROC
|
---|
55 | {
|
---|
56 | char const *pszName;
|
---|
57 | FARPROC *ppfn;
|
---|
58 | } VBOXWDDMDLLPROC;
|
---|
59 |
|
---|
60 | typedef struct D3DKMTFUNCTIONS
|
---|
61 | {
|
---|
62 | PFND3DKMT_OPENADAPTERFROMHDC pfnD3DKMTOpenAdapterFromHdc;
|
---|
63 | PFND3DKMT_OPENADAPTERFROMDEVICENAME pfnD3DKMTOpenAdapterFromDeviceName;
|
---|
64 | PFND3DKMT_CLOSEADAPTER pfnD3DKMTCloseAdapter;
|
---|
65 | PFND3DKMT_QUERYADAPTERINFO pfnD3DKMTQueryAdapterInfo;
|
---|
66 | PFND3DKMT_ESCAPE pfnD3DKMTEscape;
|
---|
67 | PFND3DKMT_CREATEDEVICE pfnD3DKMTCreateDevice;
|
---|
68 | PFND3DKMT_DESTROYDEVICE pfnD3DKMTDestroyDevice;
|
---|
69 | PFND3DKMT_CREATECONTEXT pfnD3DKMTCreateContext;
|
---|
70 | PFND3DKMT_DESTROYCONTEXT pfnD3DKMTDestroyContext;
|
---|
71 | PFND3DKMT_CREATEALLOCATION pfnD3DKMTCreateAllocation;
|
---|
72 | PFND3DKMT_DESTROYALLOCATION pfnD3DKMTDestroyAllocation;
|
---|
73 | PFND3DKMT_RENDER pfnD3DKMTRender;
|
---|
74 | PFND3DKMT_PRESENT pfnD3DKMTPresent;
|
---|
75 | PFND3DKMT_GETSHAREDPRIMARYHANDLE pfnD3DKMTGetSharedPrimaryHandle;
|
---|
76 | PFND3DKMT_QUERYRESOURCEINFO pfnD3DKMTQueryResourceInfo;
|
---|
77 | PFND3DKMT_OPENRESOURCE pfnD3DKMTOpenResource;
|
---|
78 |
|
---|
79 | /* Win 8+ */
|
---|
80 | PFND3DKMT_ENUMADAPTERS pfnD3DKMTEnumAdapters;
|
---|
81 | PFND3DKMT_OPENADAPTERFROMLUID pfnD3DKMTOpenAdapterFromLuid;
|
---|
82 | } D3DKMTFUNCTIONS;
|
---|
83 |
|
---|
84 | DECLCALLBACK(HMODULE) VBoxWddmLoadSystemDll(const char *pszName);
|
---|
85 | DECLCALLBACK(void) VBoxWddmLoadAdresses(HMODULE hmod, VBOXWDDMDLLPROC *paProcs);
|
---|
86 |
|
---|
87 | DECLCALLBACK(int) D3DKMTLoad(void);
|
---|
88 | DECLCALLBACK(D3DKMTFUNCTIONS const *) D3DKMTFunctions(void);
|
---|
89 |
|
---|
90 | DECLCALLBACK(void) VBoxDispMpLoggerLogF(const char *pszString, ...);
|
---|
91 | DECLCALLBACK(void) VBoxWddmUmLog(const char *pszString);
|
---|
92 |
|
---|
93 | /** @todo Rename to VBoxWddm* */
|
---|
94 | NTSTATUS vboxDispKmtOpenAdapter2(D3DKMT_HANDLE *phAdapter, LUID *pLuid);
|
---|
95 | NTSTATUS vboxDispKmtOpenAdapter(D3DKMT_HANDLE *phAdapter);
|
---|
96 | NTSTATUS vboxDispKmtCloseAdapter(D3DKMT_HANDLE hAdapter);
|
---|
97 |
|
---|
98 | RT_C_DECLS_END
|
---|
99 |
|
---|
100 | #endif
|
---|