1 | /* $Id: VBoxUhgsmi.h 85121 2020-07-08 19:33:26Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Document me, pretty please.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2020 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 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef VBOX_INCLUDED_Graphics_VBoxUhgsmi_h
|
---|
28 | #define VBOX_INCLUDED_Graphics_VBoxUhgsmi_h
|
---|
29 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
30 | # pragma once
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #include <iprt/cdefs.h>
|
---|
34 | #include <iprt/types.h>
|
---|
35 |
|
---|
36 | typedef struct VBOXUHGSMI *PVBOXUHGSMI;
|
---|
37 |
|
---|
38 | typedef struct VBOXUHGSMI_BUFFER *PVBOXUHGSMI_BUFFER;
|
---|
39 |
|
---|
40 | typedef union VBOXUHGSMI_BUFFER_TYPE_FLAGS
|
---|
41 | {
|
---|
42 | uint32_t Value;
|
---|
43 | struct
|
---|
44 | {
|
---|
45 | uint32_t fCommand : 1;
|
---|
46 | uint32_t Reserved : 31;
|
---|
47 | } s;
|
---|
48 | } VBOXUHGSMI_BUFFER_TYPE_FLAGS;
|
---|
49 |
|
---|
50 | typedef union VBOXUHGSMI_BUFFER_LOCK_FLAGS
|
---|
51 | {
|
---|
52 | uint32_t Value;
|
---|
53 | struct
|
---|
54 | {
|
---|
55 | uint32_t fReadOnly : 1;
|
---|
56 | uint32_t fWriteOnly : 1;
|
---|
57 | uint32_t fDonotWait : 1;
|
---|
58 | uint32_t fDiscard : 1;
|
---|
59 | uint32_t fLockEntire : 1;
|
---|
60 | uint32_t Reserved : 27;
|
---|
61 | } s;
|
---|
62 | } VBOXUHGSMI_BUFFER_LOCK_FLAGS;
|
---|
63 |
|
---|
64 | typedef union VBOXUHGSMI_BUFFER_SUBMIT_FLAGS
|
---|
65 | {
|
---|
66 | uint32_t Value;
|
---|
67 | struct
|
---|
68 | {
|
---|
69 | uint32_t fHostReadOnly : 1;
|
---|
70 | uint32_t fHostWriteOnly : 1;
|
---|
71 | uint32_t fDoNotRetire : 1; /**< the buffer will be used in a subsequent command */
|
---|
72 | uint32_t fEntireBuffer : 1;
|
---|
73 | uint32_t Reserved : 28;
|
---|
74 | } s;
|
---|
75 | } VBOXUHGSMI_BUFFER_SUBMIT_FLAGS, *PVBOXUHGSMI_BUFFER_SUBMIT_FLAGS;
|
---|
76 |
|
---|
77 | /* the caller can specify NULL as a hSynch and specify a valid enmSynchType to make UHGSMI create a proper object itself,
|
---|
78 | * */
|
---|
79 | typedef DECLCALLBACKTYPE(int, FNVBOXUHGSMI_BUFFER_CREATE,(PVBOXUHGSMI pHgsmi, uint32_t cbBuf, VBOXUHGSMI_BUFFER_TYPE_FLAGS fType,
|
---|
80 | PVBOXUHGSMI_BUFFER* ppBuf));
|
---|
81 | typedef FNVBOXUHGSMI_BUFFER_CREATE *PFNVBOXUHGSMI_BUFFER_CREATE;
|
---|
82 |
|
---|
83 | typedef struct VBOXUHGSMI_BUFFER_SUBMIT
|
---|
84 | {
|
---|
85 | PVBOXUHGSMI_BUFFER pBuf;
|
---|
86 | uint32_t offData;
|
---|
87 | uint32_t cbData;
|
---|
88 | VBOXUHGSMI_BUFFER_SUBMIT_FLAGS fFlags;
|
---|
89 | } VBOXUHGSMI_BUFFER_SUBMIT, *PVBOXUHGSMI_BUFFER_SUBMIT;
|
---|
90 |
|
---|
91 | typedef DECLCALLBACKTYPE(int, FNVBOXUHGSMI_BUFFER_SUBMIT,(PVBOXUHGSMI pHgsmi, PVBOXUHGSMI_BUFFER_SUBMIT aBuffers,
|
---|
92 | uint32_t cBuffers));
|
---|
93 | typedef FNVBOXUHGSMI_BUFFER_SUBMIT *PFNVBOXUHGSMI_BUFFER_SUBMIT;
|
---|
94 |
|
---|
95 | typedef DECLCALLBACKTYPE(int, FNVBOXUHGSMI_BUFFER_DESTROY,(PVBOXUHGSMI_BUFFER pBuf));
|
---|
96 | typedef FNVBOXUHGSMI_BUFFER_DESTROY *PFNVBOXUHGSMI_BUFFER_DESTROY;
|
---|
97 |
|
---|
98 | typedef DECLCALLBACKTYPE(int, FNVBOXUHGSMI_BUFFER_LOCK,(PVBOXUHGSMI_BUFFER pBuf, uint32_t offLock, uint32_t cbLock,
|
---|
99 | VBOXUHGSMI_BUFFER_LOCK_FLAGS fFlags, void**pvLock));
|
---|
100 | typedef FNVBOXUHGSMI_BUFFER_LOCK *PFNVBOXUHGSMI_BUFFER_LOCK;
|
---|
101 |
|
---|
102 | typedef DECLCALLBACKTYPE(int, FNVBOXUHGSMI_BUFFER_UNLOCK,(PVBOXUHGSMI_BUFFER pBuf));
|
---|
103 | typedef FNVBOXUHGSMI_BUFFER_UNLOCK *PFNVBOXUHGSMI_BUFFER_UNLOCK;
|
---|
104 |
|
---|
105 | typedef struct VBOXUHGSMI
|
---|
106 | {
|
---|
107 | PFNVBOXUHGSMI_BUFFER_CREATE pfnBufferCreate;
|
---|
108 | PFNVBOXUHGSMI_BUFFER_SUBMIT pfnBufferSubmit;
|
---|
109 | /** User custom data. */
|
---|
110 | void *pvUserData;
|
---|
111 | } VBOXUHGSMI;
|
---|
112 |
|
---|
113 | typedef struct VBOXUHGSMI_BUFFER
|
---|
114 | {
|
---|
115 | PFNVBOXUHGSMI_BUFFER_LOCK pfnLock;
|
---|
116 | PFNVBOXUHGSMI_BUFFER_UNLOCK pfnUnlock;
|
---|
117 | PFNVBOXUHGSMI_BUFFER_DESTROY pfnDestroy;
|
---|
118 |
|
---|
119 | /* r/o data added for ease of access and simplicity
|
---|
120 | * modifying it leads to unpredictable behavior */
|
---|
121 | VBOXUHGSMI_BUFFER_TYPE_FLAGS fType;
|
---|
122 | uint32_t cbBuffer;
|
---|
123 | /** User custom data. */
|
---|
124 | void *pvUserData;
|
---|
125 | } VBOXUHGSMI_BUFFER;
|
---|
126 |
|
---|
127 | #define VBoxUhgsmiBufferCreate(_pUhgsmi, _cbBuf, _fType, _ppBuf) ((_pUhgsmi)->pfnBufferCreate(_pUhgsmi, _cbBuf, _fType, _ppBuf))
|
---|
128 | #define VBoxUhgsmiBufferSubmit(_pUhgsmi, _aBuffers, _cBuffers) ((_pUhgsmi)->pfnBufferSubmit(_pUhgsmi, _aBuffers, _cBuffers))
|
---|
129 |
|
---|
130 | #define VBoxUhgsmiBufferLock(_pBuf, _offLock, _cbLock, _fFlags, _pvLock) ((_pBuf)->pfnLock(_pBuf, _offLock, _cbLock, _fFlags, _pvLock))
|
---|
131 | #define VBoxUhgsmiBufferUnlock(_pBuf) ((_pBuf)->pfnUnlock(_pBuf))
|
---|
132 | #define VBoxUhgsmiBufferDestroy(_pBuf) ((_pBuf)->pfnDestroy(_pBuf))
|
---|
133 |
|
---|
134 | #endif /* !VBOX_INCLUDED_Graphics_VBoxUhgsmi_h */
|
---|
135 |
|
---|