summaryrefslogtreecommitdiffstats
path: root/src/VBox/Additions/3D/win/include/VBoxGaDriver.h
blob: 0f96499924f7d2bdd47df8435a04ec439c8ef87f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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 */