[75443] | 1 | /* $Id: VBoxGallium.h 103999 2024-03-22 12:38:39Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
| 3 | * VirtualBox Windows Guest Mesa3D - Gallium driver interface for WDDM user mode driver.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2016-2023 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_VBoxGallium_h
|
---|
| 29 | #define GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_VBoxGallium_h
|
---|
[76540] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[75443] | 33 |
|
---|
| 34 | #include <iprt/win/d3d9.h>
|
---|
| 35 |
|
---|
| 36 | #include <VBoxGaDriver.h>
|
---|
| 37 |
|
---|
| 38 | #include "GaDdi.h"
|
---|
| 39 |
|
---|
[84367] | 40 | #include <iprt/cdefs.h>
|
---|
| 41 | #pragma warning(push)
|
---|
| 42 | #if RT_MSC_PREREQ(RT_MSC_VER_VC142)
|
---|
| 43 | # pragma warning(disable: 5204) /* warning C5204: 'IGaDirect3DDevice9Ex': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly */
|
---|
| 44 | #endif
|
---|
| 45 |
|
---|
[75443] | 46 | class IGalliumStack;
|
---|
| 47 | struct ID3DAdapter9;
|
---|
| 48 |
|
---|
| 49 | DEFINE_GUID(IID_IGaDirect3DDevice9Ex, 0x0EF5C0C0, 0x392D, 0x4220, 0xBA, 0xB3, 0x8B, 0xB2, 0x10, 0x66, 0x14, 0xA4);
|
---|
| 50 | class IGaDirect3DDevice9Ex: public IDirect3DDevice9Ex
|
---|
| 51 | {
|
---|
| 52 | public:
|
---|
| 53 | STDMETHOD(EscapeCb)(THIS_ const void *pvData, uint32_t cbData, bool fHardwareAccess) PURE;
|
---|
| 54 | STDMETHOD(GaSurfaceId)(THIS_ IUnknown *pSurface, uint32_t *pu32Sid) PURE;
|
---|
| 55 | STDMETHOD(GaWDDMContextHandle)(THIS_ HANDLE *phContext) PURE;
|
---|
| 56 | STDMETHOD(GaFlush)(THIS) PURE;
|
---|
| 57 | };
|
---|
| 58 |
|
---|
| 59 | DEFINE_GUID(IID_IGaDirect3D9Ex, 0x20741f1d, 0x6525, 0x490A, 0x87, 0x40, 0x85, 0x4F, 0xFD, 0xD5, 0xCB, 0xB8);
|
---|
| 60 | class IGaDirect3D9Ex: public IDirect3D9Ex
|
---|
| 61 | {
|
---|
| 62 | public:
|
---|
| 63 | STDMETHOD_(IGalliumStack *, GetGalliumStack)(THIS) PURE;
|
---|
| 64 | STDMETHOD_(ID3DAdapter9 *, GetAdapter9)(THIS) PURE;
|
---|
[103999] | 65 | #if VBOX_MESA_V_MAJOR < 24
|
---|
[75443] | 66 | STDMETHOD_(struct pipe_screen *, GetScreen)(THIS) PURE;
|
---|
[103999] | 67 | #else
|
---|
| 68 | STDMETHOD_(const WDDMGalliumDriverEnv *, GetWDDMEnv)(THIS) PURE;
|
---|
| 69 | #endif
|
---|
[75443] | 70 | };
|
---|
| 71 |
|
---|
| 72 | /* Top interface to access Gallium API. */
|
---|
| 73 | class IGalliumStack: public IUnknown
|
---|
| 74 | {
|
---|
| 75 | public:
|
---|
| 76 | STDMETHOD(CreateDirect3DEx)(HANDLE hAdapter,
|
---|
| 77 | HANDLE hDevice,
|
---|
| 78 | const D3DDDI_DEVICECALLBACKS *pDeviceCallbacks,
|
---|
| 79 | const VBOXGAHWINFO *pHWInfo,
|
---|
| 80 | IDirect3D9Ex **ppOut) PURE;
|
---|
| 81 | STDMETHOD(GaCreateDeviceEx)(THIS_
|
---|
| 82 | D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,
|
---|
| 83 | D3DPRESENT_PARAMETERS* pPresentationParameters,
|
---|
| 84 | D3DDISPLAYMODEEX* pFullscreenDisplayMode,
|
---|
| 85 | HANDLE hAdapter,
|
---|
| 86 | HANDLE hDevice,
|
---|
| 87 | const D3DDDI_DEVICECALLBACKS *pDeviceCallbacks,
|
---|
| 88 | const VBOXGAHWINFO *pHWInfo,
|
---|
| 89 | IDirect3DDevice9Ex** ppReturnedDeviceInterface) PURE;
|
---|
| 90 |
|
---|
[103999] | 91 | #if VBOX_MESA_V_MAJOR < 24
|
---|
[75443] | 92 | STDMETHOD(GaNineD3DAdapter9Create)(struct pipe_screen *s, ID3DAdapter9 **ppOut) PURE;
|
---|
| 93 | STDMETHOD_(struct pipe_resource *, GaNinePipeResourceFromSurface)(IUnknown *pSurface) PURE;
|
---|
| 94 | STDMETHOD_(struct pipe_context *, GaNinePipeContextFromDevice)(IDirect3DDevice9 *pDevice) PURE;
|
---|
[103999] | 95 | #else
|
---|
| 96 | STDMETHOD(GaNineD3DAdapter9Create)(const WDDMGalliumDriverEnv *pEnv, ID3DAdapter9 **ppOut) PURE;
|
---|
| 97 | STDMETHOD_(uint32_t, GaNineGetSurfaceId)(IUnknown *pSurface) PURE;
|
---|
| 98 | STDMETHOD_(uint32_t, GaNineGetContextId)(IDirect3DDevice9 *pDevice) PURE;
|
---|
| 99 | STDMETHOD_(void, GaNineFlush)(IDirect3DDevice9 *pDevice) PURE;
|
---|
| 100 | #endif
|
---|
[75443] | 101 |
|
---|
[103999] | 102 | #if VBOX_MESA_V_MAJOR < 24
|
---|
[75443] | 103 | STDMETHOD_(struct pipe_screen *, GaDrvScreenCreate)(const WDDMGalliumDriverEnv *pEnv) PURE;
|
---|
| 104 | STDMETHOD_(void, GaDrvScreenDestroy)(struct pipe_screen *s) PURE;
|
---|
| 105 | STDMETHOD_(WDDMGalliumDriverEnv const *, GaDrvGetWDDMEnv)(struct pipe_screen *pScreen) PURE;
|
---|
| 106 | STDMETHOD_(uint32_t, GaDrvGetContextId)(struct pipe_context *pPipeContext) PURE;
|
---|
| 107 | STDMETHOD_(uint32_t, GaDrvGetSurfaceId)(struct pipe_screen *pScreen, struct pipe_resource *pResource) PURE;
|
---|
| 108 | STDMETHOD_(void, GaDrvContextFlush)(struct pipe_context *pPipeContext) PURE;
|
---|
[103999] | 109 | #endif
|
---|
[75443] | 110 | };
|
---|
| 111 |
|
---|
[84367] | 112 | #pragma warning(pop)
|
---|
[75443] | 113 |
|
---|
[84367] | 114 |
|
---|
[75443] | 115 | HRESULT GalliumStackCreate(IGalliumStack **ppOut);
|
---|
| 116 |
|
---|
| 117 | /*
|
---|
| 118 | * WDDM helpers.
|
---|
| 119 | */
|
---|
| 120 | HRESULT GaD3DIfDeviceCreate(struct VBOXWDDMDISP_DEVICE *pDevice);
|
---|
| 121 | HRESULT GaD3DIfCreateForRc(struct VBOXWDDMDISP_RESOURCE *pRc);
|
---|
| 122 | IUnknown *GaD3DIfCreateSharedPrimary(struct VBOXWDDMDISP_ALLOCATION *pAlloc);
|
---|
| 123 | HRESULT GaD3DResourceSynchMem(struct VBOXWDDMDISP_RESOURCE *pRc, bool fToBackend);
|
---|
| 124 |
|
---|
[76563] | 125 | #endif /* !GA_INCLUDED_SRC_WINNT_Graphics_Video_disp_wddm_gallium_VBoxGallium_h */
|
---|