[75443] | 1 | /* $Id: GaDrvEnvWddm.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
| 3 | * VirtualBox Windows Guest Mesa3D - Gallium driver interface to the WDDM miniport driver.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[96407] | 7 | * Copyright (C) 2016-2022 Oracle and/or its affiliates.
|
---|
[75443] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
| 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or
|
---|
| 13 | * modify it under the terms of the GNU General Public License
|
---|
| 14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | * License.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful, but
|
---|
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | * General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | *
|
---|
| 25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
[75443] | 26 | */
|
---|
| 27 |
|
---|
[76563] | 28 | #ifndef GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_GaDrvEnvWddm_h
|
---|
| 29 | #define GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_GaDrvEnvWddm_h
|
---|
[76540] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[75443] | 33 |
|
---|
| 34 | #include <VBoxGaDriver.h>
|
---|
| 35 |
|
---|
| 36 | #include <iprt/win/d3d9.h>
|
---|
| 37 | #include <d3dumddi.h>
|
---|
| 38 |
|
---|
| 39 | #include <iprt/avl.h>
|
---|
| 40 |
|
---|
| 41 | typedef struct GaWddmCallbacks
|
---|
| 42 | {
|
---|
| 43 | HANDLE hAdapter;
|
---|
| 44 | HANDLE hDevice;
|
---|
| 45 | D3DDDI_DEVICECALLBACKS DeviceCallbacks;
|
---|
| 46 | } GaWddmCallbacks;
|
---|
| 47 |
|
---|
| 48 | class GaDrvEnvWddm
|
---|
| 49 | {
|
---|
| 50 | public:
|
---|
| 51 | GaDrvEnvWddm();
|
---|
| 52 | ~GaDrvEnvWddm();
|
---|
| 53 |
|
---|
| 54 | HRESULT Init(HANDLE hAdapter,
|
---|
| 55 | HANDLE hDevice,
|
---|
| 56 | const D3DDDI_DEVICECALLBACKS *pDeviceCallbacks,
|
---|
| 57 | const VBOXGAHWINFO *pHWInfo);
|
---|
| 58 |
|
---|
| 59 | const WDDMGalliumDriverEnv *Env();
|
---|
| 60 |
|
---|
| 61 | HANDLE GaDrvEnvWddmContextHandle(uint32_t u32Cid);
|
---|
| 62 |
|
---|
| 63 | private:
|
---|
| 64 | GaWddmCallbacks mWddmCallbacks;
|
---|
| 65 |
|
---|
| 66 | VBOXGAHWINFO mHWInfo;
|
---|
| 67 |
|
---|
| 68 | /* Map to convert context id (cid) to WDDM context information (GAWDDMCONTEXTINFO).
|
---|
| 69 | * Key is the 32 bit context id.
|
---|
| 70 | */
|
---|
| 71 | AVLU32TREE mContextTree;
|
---|
| 72 |
|
---|
| 73 | WDDMGalliumDriverEnv mEnv;
|
---|
| 74 |
|
---|
| 75 | static DECLCALLBACK(uint32_t) gaEnvWddmContextCreate(void *pvEnv,
|
---|
| 76 | boolean extended,
|
---|
| 77 | boolean vgpu10);
|
---|
| 78 | static DECLCALLBACK(void) gaEnvWddmContextDestroy(void *pvEnv,
|
---|
| 79 | uint32_t u32Cid);
|
---|
| 80 | static DECLCALLBACK(int) gaEnvWddmSurfaceDefine(void *pvEnv,
|
---|
| 81 | GASURFCREATE *pCreateParms,
|
---|
| 82 | GASURFSIZE *paSizes,
|
---|
| 83 | uint32_t cSizes,
|
---|
| 84 | uint32_t *pu32Sid);
|
---|
[75630] | 85 | static DECLCALLBACK(void) gaEnvWddmSurfaceDestroy(void *pvEnv,
|
---|
| 86 | uint32_t u32Sid);
|
---|
[75443] | 87 | static DECLCALLBACK(int) gaEnvWddmRender(void *pvEnv,
|
---|
| 88 | uint32_t u32Cid,
|
---|
| 89 | void *pvCommands,
|
---|
| 90 | uint32_t cbCommands,
|
---|
| 91 | GAFENCEQUERY *pFenceQuery);
|
---|
| 92 | static DECLCALLBACK(void) gaEnvWddmFenceUnref(void *pvEnv,
|
---|
| 93 | uint32_t u32FenceHandle);
|
---|
| 94 | static DECLCALLBACK(int) gaEnvWddmFenceQuery(void *pvEnv,
|
---|
| 95 | uint32_t u32FenceHandle,
|
---|
| 96 | GAFENCEQUERY *pFenceQuery);
|
---|
| 97 | static DECLCALLBACK(int) gaEnvWddmFenceWait(void *pvEnv,
|
---|
| 98 | uint32_t u32FenceHandle,
|
---|
| 99 | uint32_t u32TimeoutUS);
|
---|
| 100 | static DECLCALLBACK(int) gaEnvWddmRegionCreate(void *pvEnv,
|
---|
| 101 | uint32_t u32RegionSize,
|
---|
| 102 | uint32_t *pu32GmrId,
|
---|
| 103 | void **ppvMap);
|
---|
| 104 | static DECLCALLBACK(void) gaEnvWddmRegionDestroy(void *pvEnv,
|
---|
| 105 | uint32_t u32GmrId,
|
---|
| 106 | void *pvMap);
|
---|
[95234] | 107 |
|
---|
| 108 | /* VGPU10 */
|
---|
| 109 | static DECLCALLBACK(int) gaEnvWddmGBSurfaceDefine(void *pvEnv,
|
---|
| 110 | SVGAGBSURFCREATE *pCreateParms);
|
---|
[75443] | 111 | };
|
---|
| 112 |
|
---|
[76563] | 113 | #endif /* !GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_GaDrvEnvWddm_h */
|
---|