1 | /* $Id: GaDrvEnvWddm.h 95234 2022-06-08 16:31:28Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Windows Guest Mesa3D - Gallium driver interface to the WDDM miniport driver.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2016-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_disp_wddm_gallium_GaDrvEnvWddm_h
|
---|
19 | #define GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_GaDrvEnvWddm_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include <VBoxGaDriver.h>
|
---|
25 |
|
---|
26 | #include <iprt/win/d3d9.h>
|
---|
27 | #include <d3dumddi.h>
|
---|
28 |
|
---|
29 | #include <iprt/avl.h>
|
---|
30 |
|
---|
31 | typedef struct GaWddmCallbacks
|
---|
32 | {
|
---|
33 | HANDLE hAdapter;
|
---|
34 | HANDLE hDevice;
|
---|
35 | D3DDDI_DEVICECALLBACKS DeviceCallbacks;
|
---|
36 | } GaWddmCallbacks;
|
---|
37 |
|
---|
38 | class GaDrvEnvWddm
|
---|
39 | {
|
---|
40 | public:
|
---|
41 | GaDrvEnvWddm();
|
---|
42 | ~GaDrvEnvWddm();
|
---|
43 |
|
---|
44 | HRESULT Init(HANDLE hAdapter,
|
---|
45 | HANDLE hDevice,
|
---|
46 | const D3DDDI_DEVICECALLBACKS *pDeviceCallbacks,
|
---|
47 | const VBOXGAHWINFO *pHWInfo);
|
---|
48 |
|
---|
49 | const WDDMGalliumDriverEnv *Env();
|
---|
50 |
|
---|
51 | HANDLE GaDrvEnvWddmContextHandle(uint32_t u32Cid);
|
---|
52 |
|
---|
53 | private:
|
---|
54 | GaWddmCallbacks mWddmCallbacks;
|
---|
55 |
|
---|
56 | VBOXGAHWINFO mHWInfo;
|
---|
57 |
|
---|
58 | /* Map to convert context id (cid) to WDDM context information (GAWDDMCONTEXTINFO).
|
---|
59 | * Key is the 32 bit context id.
|
---|
60 | */
|
---|
61 | AVLU32TREE mContextTree;
|
---|
62 |
|
---|
63 | WDDMGalliumDriverEnv mEnv;
|
---|
64 |
|
---|
65 | static DECLCALLBACK(uint32_t) gaEnvWddmContextCreate(void *pvEnv,
|
---|
66 | boolean extended,
|
---|
67 | boolean vgpu10);
|
---|
68 | static DECLCALLBACK(void) gaEnvWddmContextDestroy(void *pvEnv,
|
---|
69 | uint32_t u32Cid);
|
---|
70 | static DECLCALLBACK(int) gaEnvWddmSurfaceDefine(void *pvEnv,
|
---|
71 | GASURFCREATE *pCreateParms,
|
---|
72 | GASURFSIZE *paSizes,
|
---|
73 | uint32_t cSizes,
|
---|
74 | uint32_t *pu32Sid);
|
---|
75 | static DECLCALLBACK(void) gaEnvWddmSurfaceDestroy(void *pvEnv,
|
---|
76 | uint32_t u32Sid);
|
---|
77 | static DECLCALLBACK(int) gaEnvWddmRender(void *pvEnv,
|
---|
78 | uint32_t u32Cid,
|
---|
79 | void *pvCommands,
|
---|
80 | uint32_t cbCommands,
|
---|
81 | GAFENCEQUERY *pFenceQuery);
|
---|
82 | static DECLCALLBACK(void) gaEnvWddmFenceUnref(void *pvEnv,
|
---|
83 | uint32_t u32FenceHandle);
|
---|
84 | static DECLCALLBACK(int) gaEnvWddmFenceQuery(void *pvEnv,
|
---|
85 | uint32_t u32FenceHandle,
|
---|
86 | GAFENCEQUERY *pFenceQuery);
|
---|
87 | static DECLCALLBACK(int) gaEnvWddmFenceWait(void *pvEnv,
|
---|
88 | uint32_t u32FenceHandle,
|
---|
89 | uint32_t u32TimeoutUS);
|
---|
90 | static DECLCALLBACK(int) gaEnvWddmRegionCreate(void *pvEnv,
|
---|
91 | uint32_t u32RegionSize,
|
---|
92 | uint32_t *pu32GmrId,
|
---|
93 | void **ppvMap);
|
---|
94 | static DECLCALLBACK(void) gaEnvWddmRegionDestroy(void *pvEnv,
|
---|
95 | uint32_t u32GmrId,
|
---|
96 | void *pvMap);
|
---|
97 |
|
---|
98 | /* VGPU10 */
|
---|
99 | static DECLCALLBACK(int) gaEnvWddmGBSurfaceDefine(void *pvEnv,
|
---|
100 | SVGAGBSURFCREATE *pCreateParms);
|
---|
101 | };
|
---|
102 |
|
---|
103 | #endif /* !GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_GaDrvEnvWddm_h */
|
---|