1 | /** @file
|
---|
2 | * VBox Host Guest Shared Memory Interface (HGSMI).
|
---|
3 | * OS-independent guest structures.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2017 Oracle Corporation
|
---|
8 | *
|
---|
9 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
10 | * copy of this software and associated documentation files (the "Software"),
|
---|
11 | * to deal in the Software without restriction, including without limitation
|
---|
12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
13 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
14 | * Software is furnished to do so, subject to the following conditions:
|
---|
15 | *
|
---|
16 | * The above copyright notice and this permission notice shall be included in
|
---|
17 | * all copies or substantial portions of the Software.
|
---|
18 | *
|
---|
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
22 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
---|
23 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
---|
24 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
25 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
26 | */
|
---|
27 |
|
---|
28 |
|
---|
29 | #ifndef ___VBox_Graphics_VBoxVideoGuest_h___
|
---|
30 | #define ___VBox_Graphics_VBoxVideoGuest_h___
|
---|
31 |
|
---|
32 | #include <HGSMIBase.h>
|
---|
33 | #include <VBoxVideo.h>
|
---|
34 | #include <VBoxVideoIPRT.h>
|
---|
35 |
|
---|
36 | RT_C_DECLS_BEGIN
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Structure grouping the context needed for sending graphics acceleration
|
---|
40 | * information to the host via VBVA. Each screen has its own VBVA buffer.
|
---|
41 | */
|
---|
42 | typedef struct VBVABUFFERCONTEXT
|
---|
43 | {
|
---|
44 | /** Offset of the buffer in the VRAM section for the screen */
|
---|
45 | uint32_t offVRAMBuffer;
|
---|
46 | /** Length of the buffer in bytes */
|
---|
47 | uint32_t cbBuffer;
|
---|
48 | /** This flag is set if we wrote to the buffer faster than the host could
|
---|
49 | * read it. */
|
---|
50 | bool fHwBufferOverflow;
|
---|
51 | /** The VBVA record that we are currently preparing for the host, NULL if
|
---|
52 | * none. */
|
---|
53 | struct VBVARECORD *pRecord;
|
---|
54 | /** Pointer to the VBVA buffer mapped into the current address space. Will
|
---|
55 | * be NULL if VBVA is not enabled. */
|
---|
56 | struct VBVABUFFER *pVBVA;
|
---|
57 | } VBVABUFFERCONTEXT, *PVBVABUFFERCONTEXT;
|
---|
58 |
|
---|
59 | /** @name Base HGSMI APIs
|
---|
60 | * @{ */
|
---|
61 |
|
---|
62 | DECLHIDDEN(bool) VBoxHGSMIIsSupported(void);
|
---|
63 | DECLHIDDEN(void) VBoxHGSMIGetBaseMappingInfo(uint32_t cbVRAM,
|
---|
64 | uint32_t *poffVRAMBaseMapping,
|
---|
65 | uint32_t *pcbMapping,
|
---|
66 | uint32_t *poffGuestHeapMemory,
|
---|
67 | uint32_t *pcbGuestHeapMemory,
|
---|
68 | uint32_t *poffHostFlags);
|
---|
69 | DECLHIDDEN(int) VBoxHGSMIReportFlagsLocation(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
70 | HGSMIOFFSET offLocation);
|
---|
71 | DECLHIDDEN(int) VBoxHGSMISendCapsInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
72 | uint32_t fCaps);
|
---|
73 | DECLHIDDEN(void) VBoxHGSMIGetHostAreaMapping(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
74 | uint32_t cbVRAM,
|
---|
75 | uint32_t offVRAMBaseMapping,
|
---|
76 | uint32_t *poffVRAMHostArea,
|
---|
77 | uint32_t *pcbHostArea);
|
---|
78 | DECLHIDDEN(int) VBoxHGSMISendHostCtxInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
79 | HGSMIOFFSET offVRAMFlagsLocation,
|
---|
80 | uint32_t fCaps,
|
---|
81 | uint32_t offVRAMHostArea,
|
---|
82 | uint32_t cbHostArea);
|
---|
83 | DECLHIDDEN(int) VBoxQueryConfHGSMI(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
84 | uint32_t u32Index, uint32_t *pulValue);
|
---|
85 | DECLHIDDEN(int) VBoxQueryConfHGSMIDef(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
86 | uint32_t u32Index, uint32_t u32DefValue, uint32_t *pulValue);
|
---|
87 | DECLHIDDEN(int) VBoxHGSMIUpdatePointerShape(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
88 | uint32_t fFlags,
|
---|
89 | uint32_t cHotX,
|
---|
90 | uint32_t cHotY,
|
---|
91 | uint32_t cWidth,
|
---|
92 | uint32_t cHeight,
|
---|
93 | uint8_t *pPixels,
|
---|
94 | uint32_t cbLength);
|
---|
95 | DECLHIDDEN(int) VBoxHGSMICursorPosition(PHGSMIGUESTCOMMANDCONTEXT pCtx, bool fReportPosition, uint32_t x, uint32_t y,
|
---|
96 | uint32_t *pxHost, uint32_t *pyHost);
|
---|
97 |
|
---|
98 | /** @} */
|
---|
99 |
|
---|
100 | /** @name VBVA APIs
|
---|
101 | * @{ */
|
---|
102 | DECLHIDDEN(bool) VBoxVBVAEnable(PVBVABUFFERCONTEXT pCtx,
|
---|
103 | PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
|
---|
104 | struct VBVABUFFER *pVBVA, int32_t cScreen);
|
---|
105 | DECLHIDDEN(void) VBoxVBVADisable(PVBVABUFFERCONTEXT pCtx,
|
---|
106 | PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
|
---|
107 | int32_t cScreen);
|
---|
108 | DECLHIDDEN(bool) VBoxVBVABufferBeginUpdate(PVBVABUFFERCONTEXT pCtx,
|
---|
109 | PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx);
|
---|
110 | DECLHIDDEN(void) VBoxVBVABufferEndUpdate(PVBVABUFFERCONTEXT pCtx);
|
---|
111 | DECLHIDDEN(bool) VBoxVBVAWrite(PVBVABUFFERCONTEXT pCtx,
|
---|
112 | PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
|
---|
113 | const void *pv, uint32_t cb);
|
---|
114 | DECLHIDDEN(bool) VBoxVBVAOrderSupported(PVBVABUFFERCONTEXT pCtx, unsigned code);
|
---|
115 | DECLHIDDEN(void) VBoxVBVASetupBufferContext(PVBVABUFFERCONTEXT pCtx,
|
---|
116 | uint32_t offVRAMBuffer,
|
---|
117 | uint32_t cbBuffer);
|
---|
118 |
|
---|
119 | /** @} */
|
---|
120 |
|
---|
121 | /** @name Modesetting APIs
|
---|
122 | * @{ */
|
---|
123 |
|
---|
124 | DECLHIDDEN(uint32_t) VBoxHGSMIGetMonitorCount(PHGSMIGUESTCOMMANDCONTEXT pCtx);
|
---|
125 | DECLHIDDEN(uint32_t) VBoxVideoGetVRAMSize(void);
|
---|
126 | DECLHIDDEN(bool) VBoxVideoAnyWidthAllowed(void);
|
---|
127 | DECLHIDDEN(uint16_t) VBoxHGSMIGetScreenFlags(PHGSMIGUESTCOMMANDCONTEXT pCtx);
|
---|
128 |
|
---|
129 | struct VBVAINFOVIEW;
|
---|
130 | /**
|
---|
131 | * Callback funtion called from @a VBoxHGSMISendViewInfo to initialise
|
---|
132 | * the @a VBVAINFOVIEW structure for each screen.
|
---|
133 | *
|
---|
134 | * @returns iprt status code
|
---|
135 | * @param pvData context data for the callback, passed to @a
|
---|
136 | * VBoxHGSMISendViewInfo along with the callback
|
---|
137 | * @param pInfo array of @a VBVAINFOVIEW structures to be filled in
|
---|
138 | * @todo explicitly pass the array size
|
---|
139 | */
|
---|
140 | typedef DECLCALLBACK(int) FNHGSMIFILLVIEWINFO(void *pvData,
|
---|
141 | struct VBVAINFOVIEW *pInfo,
|
---|
142 | uint32_t cViews);
|
---|
143 | /** Pointer to a FNHGSMIFILLVIEWINFO callback */
|
---|
144 | typedef FNHGSMIFILLVIEWINFO *PFNHGSMIFILLVIEWINFO;
|
---|
145 |
|
---|
146 | DECLHIDDEN(int) VBoxHGSMISendViewInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
147 | uint32_t u32Count,
|
---|
148 | PFNHGSMIFILLVIEWINFO pfnFill,
|
---|
149 | void *pvData);
|
---|
150 | DECLHIDDEN(void) VBoxVideoSetModeRegisters(uint16_t cWidth, uint16_t cHeight,
|
---|
151 | uint16_t cVirtWidth, uint16_t cBPP,
|
---|
152 | uint16_t fFlags,
|
---|
153 | uint16_t cx, uint16_t cy);
|
---|
154 | DECLHIDDEN(bool) VBoxVideoGetModeRegisters(uint16_t *pcWidth,
|
---|
155 | uint16_t *pcHeight,
|
---|
156 | uint16_t *pcVirtWidth,
|
---|
157 | uint16_t *pcBPP,
|
---|
158 | uint16_t *pfFlags);
|
---|
159 | DECLHIDDEN(void) VBoxVideoDisableVBE(void);
|
---|
160 | DECLHIDDEN(void) VBoxHGSMIProcessDisplayInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
161 | uint32_t cDisplay,
|
---|
162 | int32_t cOriginX,
|
---|
163 | int32_t cOriginY,
|
---|
164 | uint32_t offStart,
|
---|
165 | uint32_t cbPitch,
|
---|
166 | uint32_t cWidth,
|
---|
167 | uint32_t cHeight,
|
---|
168 | uint16_t cBPP,
|
---|
169 | uint16_t fFlags);
|
---|
170 | DECLHIDDEN(int) VBoxHGSMIUpdateInputMapping(PHGSMIGUESTCOMMANDCONTEXT pCtx, int32_t cOriginX, int32_t cOriginY,
|
---|
171 | uint32_t cWidth, uint32_t cHeight);
|
---|
172 | DECLHIDDEN(int) VBoxHGSMIGetModeHints(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
173 | unsigned cScreens, VBVAMODEHINT *paHints);
|
---|
174 |
|
---|
175 | /** @} */
|
---|
176 |
|
---|
177 | RT_C_DECLS_END
|
---|
178 |
|
---|
179 | #endif
|
---|
180 |
|
---|