summaryrefslogtreecommitdiffstats
path: root/src/VBox/Additions/3D/win/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Additions/3D/win/include')
-rw-r--r--src/VBox/Additions/3D/win/include/VBoxGaDriver.h115
-rw-r--r--src/VBox/Additions/3D/win/include/VBoxGaHWInfo.h64
-rw-r--r--src/VBox/Additions/3D/win/include/VBoxGaHwSVGA.h66
-rw-r--r--src/VBox/Additions/3D/win/include/VBoxGaNine.h58
-rw-r--r--src/VBox/Additions/3D/win/include/VBoxGaTypes.h114
5 files changed, 417 insertions, 0 deletions
diff --git a/src/VBox/Additions/3D/win/include/VBoxGaDriver.h b/src/VBox/Additions/3D/win/include/VBoxGaDriver.h
new file mode 100644
index 00000000..0f964999
--- /dev/null
+++ b/src/VBox/Additions/3D/win/include/VBoxGaDriver.h
@@ -0,0 +1,115 @@
+/* $Id: VBoxGaDriver.h $ */
+/** @file
+ * VirtualBox Windows Guest Mesa3D - Gallium driver interface.
+ */
+
+/*
+ * Copyright (C) 2016-2023 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+#ifndef GA_INCLUDED_3D_WIN_VBoxGaDriver_h
+#define GA_INCLUDED_3D_WIN_VBoxGaDriver_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <VBoxGaHWInfo.h>
+#include <VBoxGaTypes.h>
+
+#include <iprt/win/windows.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct WDDMGalliumDriverEnv
+{
+ /* Size of the structure. */
+ DWORD cb;
+ const VBOXGAHWINFO *pHWInfo;
+ /* The environment context pointer to use in the following callbacks. */
+ void *pvEnv;
+ /* The callbacks to use by the driver. */
+ DECLCALLBACKMEMBER(uint32_t, pfnContextCreate,(void *pvEnv,
+ boolean extended,
+ boolean vgpu10));
+ DECLCALLBACKMEMBER(void, pfnContextDestroy,(void *pvEnv,
+ uint32_t u32Cid));
+ DECLCALLBACKMEMBER(int, pfnSurfaceDefine,(void *pvEnv,
+ GASURFCREATE *pCreateParms,
+ GASURFSIZE *paSizes,
+ uint32_t cSizes,
+ uint32_t *pu32Sid));
+ DECLCALLBACKMEMBER(void, pfnSurfaceDestroy,(void *pvEnv,
+ uint32_t u32Sid));
+ DECLCALLBACKMEMBER(int, pfnRender,(void *pvEnv,
+ uint32_t u32Cid,
+ void *pvCommands,
+ uint32_t cbCommands,
+ GAFENCEQUERY *pFenceQuery));
+ DECLCALLBACKMEMBER(void, pfnFenceUnref,(void *pvEnv,
+ uint32_t u32FenceHandle));
+ DECLCALLBACKMEMBER(int, pfnFenceQuery,(void *pvEnv,
+ uint32_t u32FenceHandle,
+ GAFENCEQUERY *pFenceQuery));
+ DECLCALLBACKMEMBER(int, pfnFenceWait,(void *pvEnv,
+ uint32_t u32FenceHandle,
+ uint32_t u32TimeoutUS));
+ DECLCALLBACKMEMBER(int, pfnRegionCreate,(void *pvEnv,
+ uint32_t u32RegionSize,
+ uint32_t *pu32GmrId,
+ void **ppvMap));
+ DECLCALLBACKMEMBER(void, pfnRegionDestroy,(void *pvEnv,
+ uint32_t u32GmrId,
+ void *pvMap));
+ /* VGPU10 */
+ DECLCALLBACKMEMBER(int, pfnGBSurfaceDefine,(void *pvEnv,
+ SVGAGBSURFCREATE *pCreateParms));
+} WDDMGalliumDriverEnv;
+
+struct pipe_context;
+struct pipe_screen;
+struct pipe_resource;
+
+typedef struct pipe_screen * WINAPI FNGaDrvScreenCreate(const WDDMGalliumDriverEnv *pEnv);
+typedef FNGaDrvScreenCreate *PFNGaDrvScreenCreate;
+
+typedef void WINAPI FNGaDrvScreenDestroy(struct pipe_screen *s);
+typedef FNGaDrvScreenDestroy *PFNGaDrvScreenDestroy;
+
+typedef const WDDMGalliumDriverEnv * WINAPI FNGaDrvGetWDDMEnv(struct pipe_screen *pScreen);
+typedef FNGaDrvGetWDDMEnv *PFNGaDrvGetWDDMEnv;
+
+typedef uint32_t WINAPI FNGaDrvGetContextId(struct pipe_context *pPipeContext);
+typedef FNGaDrvGetContextId *PFNGaDrvGetContextId;
+
+typedef uint32_t WINAPI FNGaDrvGetSurfaceId(struct pipe_screen *pScreen, struct pipe_resource *pResource);
+typedef FNGaDrvGetSurfaceId *PFNGaDrvGetSurfaceId;
+
+typedef void WINAPI FNGaDrvContextFlush(struct pipe_context *pPipeContext);
+typedef FNGaDrvContextFlush *PFNGaDrvContextFlush;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !GA_INCLUDED_3D_WIN_VBoxGaDriver_h */
+
diff --git a/src/VBox/Additions/3D/win/include/VBoxGaHWInfo.h b/src/VBox/Additions/3D/win/include/VBoxGaHWInfo.h
new file mode 100644
index 00000000..54a38eda
--- /dev/null
+++ b/src/VBox/Additions/3D/win/include/VBoxGaHWInfo.h
@@ -0,0 +1,64 @@
+/* $Id: VBoxGaHWInfo.h $ */
+/** @file
+ * VirtualBox Windows Guest Mesa3D - Gallium driver interface.
+ */
+
+/*
+ * Copyright (C) 2016-2023 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+#ifndef GA_INCLUDED_3D_WIN_VBoxGaHWInfo_h
+#define GA_INCLUDED_3D_WIN_VBoxGaHWInfo_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <iprt/assert.h>
+
+#include <VBoxGaHwSVGA.h>
+
+/* Gallium virtual hardware supported by the miniport. */
+#define VBOX_GA_HW_TYPE_UNKNOWN 0
+#define VBOX_GA_HW_TYPE_VMSVGA 1
+
+/*
+ * VBOXGAHWINFO contains information about the virtual hardware, which is passed
+ * to the user mode Gallium driver. The driver can not query the info at the initialization time,
+ * therefore we send the complete info to the driver.
+ *
+ * VBOXGAHWINFO struct goes both to 32 and 64 bit user mode binaries, take care of alignment.
+ */
+#pragma pack(1)
+typedef struct VBOXGAHWINFO
+{
+ uint32_t u32HwType; /* VBOX_GA_HW_TYPE_* */
+ uint32_t u32Reserved;
+ union
+ {
+ VBOXGAHWINFOSVGA svga;
+ uint8_t au8Raw[65536];
+ } u;
+} VBOXGAHWINFO;
+#pragma pack()
+
+AssertCompile(RT_SIZEOFMEMB(VBOXGAHWINFO, u) <= RT_SIZEOFMEMB(VBOXGAHWINFO, u.au8Raw));
+
+#endif /* !GA_INCLUDED_3D_WIN_VBoxGaHWInfo_h */
diff --git a/src/VBox/Additions/3D/win/include/VBoxGaHwSVGA.h b/src/VBox/Additions/3D/win/include/VBoxGaHwSVGA.h
new file mode 100644
index 00000000..6c145eb0
--- /dev/null
+++ b/src/VBox/Additions/3D/win/include/VBoxGaHwSVGA.h
@@ -0,0 +1,66 @@
+/* $Id: VBoxGaHwSVGA.h $ */
+/** @file
+ * VirtualBox Windows Guest Mesa3D - Gallium driver interface.
+ */
+
+/*
+ * Copyright (C) 2016-2023 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+#ifndef GA_INCLUDED_3D_WIN_VBoxGaHwSVGA_h
+#define GA_INCLUDED_3D_WIN_VBoxGaHwSVGA_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <iprt/types.h>
+
+/*
+ * VBOXGAHWINFOSVGA contains information about the virtual hardware, which is neede dy the user mode
+ * Gallium driver. The driver can not query the info at the initialization time, therefore
+ * we send the complete info to the driver.
+ *
+ * Since both FIFO and SVGA_REG_ are expanded over time, we reserve some space.
+ * The Gallium user mode driver can figure out which part of au32Regs and au32Fifo
+ * is valid from the raw data.
+ *
+ * VBOXGAHWINFOSVGA struct goes both to 32 and 64 bit user mode binaries, take care of alignment.
+ */
+#pragma pack(1)
+typedef struct VBOXGAHWINFOSVGA
+{
+ uint32_t cbInfoSVGA;
+
+ /* Copy of SVGA_REG_*, up to 256, currently 58 are used. */
+ uint32_t au32Regs[256];
+
+ /* Copy of FIFO registers, up to 1024, currently 290 are used. */
+ uint32_t au32Fifo[1024];
+
+ /* Currently SVGA has 260 caps, 512 should be ok for near future.
+ * This is a copy of SVGA3D_DEVCAP_* values returned by the host.
+ * Only valid if SVGA_CAP_GBOBJECTS is set in SVGA_REG_CAPABILITIES.
+ */
+ uint32_t au32Caps[512];
+} VBOXGAHWINFOSVGA;
+#pragma pack()
+
+#endif /* !GA_INCLUDED_3D_WIN_VBoxGaHwSVGA_h */
diff --git a/src/VBox/Additions/3D/win/include/VBoxGaNine.h b/src/VBox/Additions/3D/win/include/VBoxGaNine.h
new file mode 100644
index 00000000..cb896c5e
--- /dev/null
+++ b/src/VBox/Additions/3D/win/include/VBoxGaNine.h
@@ -0,0 +1,58 @@
+/* $Id: VBoxGaNine.h $ */
+/** @file
+ * VirtualBox Windows Guest Mesa3D - Gallium driver interface for WDDM user mode driver.
+ */
+
+/*
+ * Copyright (C) 2016-2023 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+#ifndef GA_INCLUDED_3D_WIN_VBoxGaNine_h
+#define GA_INCLUDED_3D_WIN_VBoxGaNine_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <iprt/win/d3d9.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct pipe_screen;
+struct pipe_resource;
+struct pipe_context;
+typedef struct ID3DAdapter9 ID3DAdapter9;
+
+typedef HRESULT WINAPI FNGaNineD3DAdapter9Create(struct pipe_screen *s, ID3DAdapter9 **ppOut);
+typedef FNGaNineD3DAdapter9Create *PFNGaNineD3DAdapter9Create;
+
+typedef struct pipe_resource * WINAPI FNGaNinePipeResourceFromSurface(IUnknown *pSurface);
+typedef FNGaNinePipeResourceFromSurface *PFNGaNinePipeResourceFromSurface;
+
+typedef struct pipe_context * WINAPI FNGaNinePipeContextFromDevice(IDirect3DDevice9 *pDevice);
+typedef FNGaNinePipeContextFromDevice *PFNGaNinePipeContextFromDevice;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !GA_INCLUDED_3D_WIN_VBoxGaNine_h */
diff --git a/src/VBox/Additions/3D/win/include/VBoxGaTypes.h b/src/VBox/Additions/3D/win/include/VBoxGaTypes.h
new file mode 100644
index 00000000..cfd379a1
--- /dev/null
+++ b/src/VBox/Additions/3D/win/include/VBoxGaTypes.h
@@ -0,0 +1,114 @@
+/* $Id: VBoxGaTypes.h $ */
+/** @file
+ * VirtualBox Windows Guest Mesa3D - Gallium driver interface.
+ */
+
+/*
+ * Copyright (C) 2016-2023 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+#ifndef GA_INCLUDED_3D_WIN_VBoxGaTypes_h
+#define GA_INCLUDED_3D_WIN_VBoxGaTypes_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <iprt/types.h>
+
+#pragma pack(1) /* VMSVGA structures are '__packed'. */
+#include <svga3d_caps.h>
+#include <svga3d_reg.h>
+#pragma pack()
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GA_MAX_SURFACE_FACES 6
+#define GA_MAX_MIP_LEVELS 24
+
+typedef struct GASURFCREATE
+{
+ uint32_t flags; /* SVGA3dSurfaceFlags */
+ uint32_t format; /* SVGA3dSurfaceFormat */
+ uint32_t usage; /* SVGA_SURFACE_USAGE_* */
+ uint32_t mip_levels[GA_MAX_SURFACE_FACES];
+} GASURFCREATE;
+
+typedef struct GASURFSIZE
+{
+ uint32_t cWidth;
+ uint32_t cHeight;
+ uint32_t cDepth;
+ uint32_t u32Reserved;
+} GASURFSIZE;
+
+#define GA_FENCE_STATUS_NULL 0 /* Fence not found */
+#define GA_FENCE_STATUS_IDLE 1
+#define GA_FENCE_STATUS_SUBMITTED 2
+#define GA_FENCE_STATUS_SIGNALED 3
+
+typedef struct GAFENCEQUERY
+{
+ /* IN: The miniport's handle of the fence.
+ * Assigned by the miniport. Not DXGK fence id!
+ */
+ uint32_t u32FenceHandle;
+
+ /* OUT: The miniport's sequence number associated with the command buffer.
+ */
+ uint32_t u32SubmittedSeqNo;
+
+ /* OUT: The miniport's sequence number associated with the last command buffer completed on host.
+ */
+ uint32_t u32ProcessedSeqNo;
+
+ /* OUT: GA_FENCE_STATUS_*. */
+ uint32_t u32FenceStatus;
+} GAFENCEQUERY;
+
+typedef struct SVGAGBSURFCREATE
+{
+ /* Surface data. */
+ struct
+ {
+ SVGA3dSurfaceAllFlags flags;
+ SVGA3dSurfaceFormat format;
+ unsigned usage;
+ SVGA3dSize size;
+ uint32_t numFaces;
+ uint32_t numMipLevels;
+ unsigned sampleCount;
+ SVGA3dMSPattern multisamplePattern;
+ SVGA3dMSQualityLevel qualityLevel;
+ } s;
+ uint32_t gmrid; /* In/Out: Backing GMR. */
+ uint32_t cbGB; /* Out: Size of backing memory. */
+ uint64_t u64UserAddress; /* Out: R3 mapping of the backing memory. */
+ uint32_t u32Sid; /* Out: Surface id. */
+} SVGAGBSURFCREATE, *PSVGAGBSURFCREATE;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !GA_INCLUDED_3D_WIN_VBoxGaTypes_h */
+