1 | /** @file
|
---|
2 | * OpenGL:
|
---|
3 | * Common header for host service and guest clients.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2012 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_HostService_VBoxCrOpenGLSvc_h
|
---|
28 | #define ___VBox_HostService_VBoxCrOpenGLSvc_h
|
---|
29 |
|
---|
30 | #include <VBox/types.h>
|
---|
31 | #include <VBox/VMMDev.h>
|
---|
32 | #include <VBox/VBoxGuest2.h>
|
---|
33 | #include <VBox/hgcmsvc.h>
|
---|
34 | #include <VBox/VBoxVideo.h>
|
---|
35 | #include <VBox/VBoxVideoHost3D.h>
|
---|
36 |
|
---|
37 | /* crOpenGL host functions */
|
---|
38 | #define SHCRGL_HOST_FN_SET_CONSOLE (1)
|
---|
39 | #define SHCRGL_HOST_FN_SET_VISIBLE_REGION (5)
|
---|
40 | #define SHCRGL_HOST_FN_SET_VM (7)
|
---|
41 | #define SHCRGL_HOST_FN_SCREEN_CHANGED (8)
|
---|
42 | #ifdef VBOX_WITH_CRHGSMI
|
---|
43 | #define SHCRGL_HOST_FN_CRHGSMI_CMD (10)
|
---|
44 | #define SHCRGL_HOST_FN_CRHGSMI_CTL (11)
|
---|
45 | #endif
|
---|
46 | #define SHCRGL_HOST_FN_VIEWPORT_CHANGED (15)
|
---|
47 | #define SHCRGL_HOST_FN_SET_OUTPUT_REDIRECT (20)
|
---|
48 | #define SHCRGL_HOST_FN_DEV_RESIZE (22)
|
---|
49 | #define SHCRGL_HOST_FN_VIEWPORT_CHANGED2 (23)
|
---|
50 | #define SHCRGL_HOST_FN_TAKE_SCREENSHOT (24)
|
---|
51 | #define SHCRGL_HOST_FN_WINDOWS_SHOW (25)
|
---|
52 | #define SHCRGL_HOST_FN_CTL (26)
|
---|
53 | /* crOpenGL guest functions */
|
---|
54 | #define SHCRGL_GUEST_FN_WRITE (2)
|
---|
55 | #define SHCRGL_GUEST_FN_READ (3)
|
---|
56 | #define SHCRGL_GUEST_FN_WRITE_READ (4)
|
---|
57 | #define SHCRGL_GUEST_FN_SET_VERSION (6)
|
---|
58 | #define SHCRGL_GUEST_FN_INJECT (9)
|
---|
59 | #define SHCRGL_GUEST_FN_SET_PID (12)
|
---|
60 | #define SHCRGL_GUEST_FN_WRITE_BUFFER (13)
|
---|
61 | #define SHCRGL_GUEST_FN_WRITE_READ_BUFFERED (14)
|
---|
62 | #define SHCRGL_GUEST_FN_GET_CAPS_LEGACY (15)
|
---|
63 | #define SHCRGL_GUEST_FN_GET_CAPS_NEW (16)
|
---|
64 |
|
---|
65 | /* Parameters count */
|
---|
66 | #define SHCRGL_CPARMS_SET_CONSOLE (1)
|
---|
67 | #define SHCRGL_CPARMS_SET_VM (1)
|
---|
68 | #define SHCRGL_CPARMS_SET_VISIBLE_REGION (1)
|
---|
69 | #define SHCRGL_CPARMS_WRITE (1)
|
---|
70 | #define SHCRGL_CPARMS_READ (2)
|
---|
71 | #define SHCRGL_CPARMS_WRITE_READ (3)
|
---|
72 | #define SHCRGL_CPARMS_SET_VERSION (2)
|
---|
73 | #define SHCRGL_CPARMS_SCREEN_CHANGED (1)
|
---|
74 | #define SHCRGL_CPARMS_DEV_RESIZE (1)
|
---|
75 | #define SHCRGL_CPARMS_INJECT (2)
|
---|
76 | #define SHCRGL_CPARMS_SET_PID (1)
|
---|
77 | #define SHCRGL_CPARMS_WRITE_BUFFER (4)
|
---|
78 | #define SHCRGL_CPARMS_WRITE_READ_BUFFERED (3)
|
---|
79 | #define SHCRGL_CPARMS_SET_OUTPUT_REDIRECT (1)
|
---|
80 | #define SHCRGL_CPARMS_CRCMD_NOTIFY_CMDS (0)
|
---|
81 | #define SHCRGL_CPARMS_VIEWPORT_CHANGED (5)
|
---|
82 | #define SHCRGL_CPARMS_VIEWPORT_CHANGED2 (1)
|
---|
83 | #define SHCRGL_CPARMS_GET_CAPS_LEGACY (1)
|
---|
84 | #define SHCRGL_CPARMS_GET_CAPS_NEW (1)
|
---|
85 |
|
---|
86 | /* @todo Move to H3DOR.h begin */
|
---|
87 |
|
---|
88 | /* Names of supported output redirect formats. */
|
---|
89 | #define H3DOR_FMT_RGBA_TOPDOWN "H3DOR_FMT_RGBA_TOPDOWN"
|
---|
90 | #define H3DOR_FMT_RGBA "H3DOR_FMT_RGBA"
|
---|
91 |
|
---|
92 | /* Comma separated list of output formats supported by the output redirect target. */
|
---|
93 | #define H3DOR_PROP_FORMATS 0
|
---|
94 |
|
---|
95 | #pragma pack(1)
|
---|
96 | typedef struct {
|
---|
97 | /* The caller's context of the redirection. */
|
---|
98 | const void *pvContext;
|
---|
99 | /* Inform caller that a new window will be redirected. */
|
---|
100 | DECLR3CALLBACKMEMBER(void, H3DORBegin, (const void *pvContext, void **ppvInstance,
|
---|
101 | const char *pszFormat));
|
---|
102 | /* The window dimension has been changed. */
|
---|
103 | DECLR3CALLBACKMEMBER(void, H3DORGeometry, (void *pvInstance,
|
---|
104 | int32_t x, int32_t y, uint32_t w, uint32_t h));
|
---|
105 | /* Update the window visible region. */
|
---|
106 | DECLR3CALLBACKMEMBER(void, H3DORVisibleRegion, (void *pvInstance,
|
---|
107 | uint32_t cRects, const RTRECT *paRects));
|
---|
108 | /* A rendered 3D frame is ready. Format of pvData is "pszFormat" parameter of H3DORBegin. */
|
---|
109 | DECLR3CALLBACKMEMBER(void, H3DORFrame, (void *pvInstance,
|
---|
110 | void *pvData, uint32_t cbData));
|
---|
111 | /* The window is closed. */
|
---|
112 | DECLR3CALLBACKMEMBER(void, H3DOREnd, (void *pvInstance));
|
---|
113 | /* Obtain caller's parameters: the list of supported formats, etc. */
|
---|
114 | DECLR3CALLBACKMEMBER(int, H3DORContextProperty, (const void *pvContext, uint32_t index,
|
---|
115 | void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut));
|
---|
116 | } H3DOUTPUTREDIRECT;
|
---|
117 | #pragma pack()
|
---|
118 |
|
---|
119 | /* @todo Move to H3DOR.h end */
|
---|
120 |
|
---|
121 | #ifdef VBOX_WITH_CRHGSMI
|
---|
122 | #pragma pack(1)
|
---|
123 | typedef struct
|
---|
124 | {
|
---|
125 | int32_t result; /**< OUT Host HGSMI return code.*/
|
---|
126 | uint32_t u32ClientID; /**< IN The id of the caller. */
|
---|
127 | uint32_t u32Function; /**< IN Function number. */
|
---|
128 | uint32_t u32Reserved;
|
---|
129 | } CRVBOXHGSMIHDR;
|
---|
130 | AssertCompileSize(CRVBOXHGSMIHDR, 16);
|
---|
131 |
|
---|
132 | /** GUEST_FN_WRITE Parameters structure. */
|
---|
133 | typedef struct
|
---|
134 | {
|
---|
135 | CRVBOXHGSMIHDR hdr;
|
---|
136 | /** buffer index, in
|
---|
137 | * Data buffer
|
---|
138 | */
|
---|
139 | uint32_t iBuffer;
|
---|
140 | } CRVBOXHGSMIWRITE;
|
---|
141 |
|
---|
142 | /** GUEST_FN_READ Parameters structure. */
|
---|
143 | typedef struct
|
---|
144 | {
|
---|
145 | CRVBOXHGSMIHDR hdr;
|
---|
146 |
|
---|
147 | /** buffer index, in/out
|
---|
148 | * Data buffer
|
---|
149 | */
|
---|
150 | uint32_t iBuffer;
|
---|
151 | uint32_t cbBuffer;
|
---|
152 | } CRVBOXHGSMIREAD;
|
---|
153 |
|
---|
154 | /** GUEST_FN_WRITE_READ Parameters structure. */
|
---|
155 | typedef struct
|
---|
156 | {
|
---|
157 | CRVBOXHGSMIHDR hdr;
|
---|
158 |
|
---|
159 | /** buffer index, in
|
---|
160 | * Data buffer
|
---|
161 | */
|
---|
162 | uint32_t iBuffer;
|
---|
163 |
|
---|
164 | /** buffer index, out
|
---|
165 | * Writeback buffer
|
---|
166 | */
|
---|
167 | uint32_t iWriteback;
|
---|
168 | uint32_t cbWriteback;
|
---|
169 | } CRVBOXHGSMIWRITEREAD;
|
---|
170 |
|
---|
171 | /** GUEST_FN_SET_VERSION Parameters structure. */
|
---|
172 | typedef struct
|
---|
173 | {
|
---|
174 | CRVBOXHGSMIHDR hdr;
|
---|
175 |
|
---|
176 | /** 32bit, in
|
---|
177 | * Major version
|
---|
178 | */
|
---|
179 | uint32_t vMajor;
|
---|
180 |
|
---|
181 | /** 32bit, in
|
---|
182 | * Minor version
|
---|
183 | */
|
---|
184 | uint32_t vMinor;
|
---|
185 | } CRVBOXHGSMISETVERSION;
|
---|
186 |
|
---|
187 | /** GUEST_FN_INJECT Parameters structure. */
|
---|
188 | typedef struct
|
---|
189 | {
|
---|
190 | CRVBOXHGSMIHDR hdr;
|
---|
191 |
|
---|
192 | /** 32bit, in
|
---|
193 | * ClientID to inject commands buffer for
|
---|
194 | */
|
---|
195 | uint32_t u32ClientID;
|
---|
196 | /** buffer index, in
|
---|
197 | * Data buffer
|
---|
198 | */
|
---|
199 | uint32_t iBuffer;
|
---|
200 | } CRVBOXHGSMIINJECT;
|
---|
201 |
|
---|
202 | /** GUEST_FN_SET_PID Parameters structure. */
|
---|
203 | typedef struct
|
---|
204 | {
|
---|
205 | CRVBOXHGSMIHDR hdr;
|
---|
206 |
|
---|
207 | /** 64bit, in
|
---|
208 | * PID
|
---|
209 | */
|
---|
210 | uint64_t u64PID;
|
---|
211 | } CRVBOXHGSMISETPID;
|
---|
212 |
|
---|
213 | #pragma pack()
|
---|
214 | #endif
|
---|
215 | /**
|
---|
216 | * SHCRGL_GUEST_FN_WRITE
|
---|
217 | */
|
---|
218 |
|
---|
219 | /** GUEST_FN_WRITE Parameters structure. */
|
---|
220 | typedef struct
|
---|
221 | {
|
---|
222 | VBoxGuestHGCMCallInfo hdr;
|
---|
223 |
|
---|
224 | /** pointer, in
|
---|
225 | * Data buffer
|
---|
226 | */
|
---|
227 | HGCMFunctionParameter pBuffer;
|
---|
228 | } CRVBOXHGCMWRITE;
|
---|
229 |
|
---|
230 | /** GUEST_FN_READ Parameters structure. */
|
---|
231 | typedef struct
|
---|
232 | {
|
---|
233 | VBoxGuestHGCMCallInfo hdr;
|
---|
234 |
|
---|
235 | /** pointer, in/out
|
---|
236 | * Data buffer
|
---|
237 | */
|
---|
238 | HGCMFunctionParameter pBuffer;
|
---|
239 |
|
---|
240 | /** 32bit, out
|
---|
241 | * Count of bytes written to buffer
|
---|
242 | */
|
---|
243 | HGCMFunctionParameter cbBuffer;
|
---|
244 |
|
---|
245 | } CRVBOXHGCMREAD;
|
---|
246 |
|
---|
247 | /** GUEST_FN_WRITE_READ Parameters structure. */
|
---|
248 | typedef struct
|
---|
249 | {
|
---|
250 | VBoxGuestHGCMCallInfo hdr;
|
---|
251 |
|
---|
252 | /** pointer, in
|
---|
253 | * Data buffer
|
---|
254 | */
|
---|
255 | HGCMFunctionParameter pBuffer;
|
---|
256 |
|
---|
257 | /** pointer, out
|
---|
258 | * Writeback buffer
|
---|
259 | */
|
---|
260 | HGCMFunctionParameter pWriteback;
|
---|
261 |
|
---|
262 | /** 32bit, out
|
---|
263 | * Count of bytes written to writeback buffer
|
---|
264 | */
|
---|
265 | HGCMFunctionParameter cbWriteback;
|
---|
266 |
|
---|
267 | } CRVBOXHGCMWRITEREAD;
|
---|
268 |
|
---|
269 | /** GUEST_FN_SET_VERSION Parameters structure. */
|
---|
270 | typedef struct
|
---|
271 | {
|
---|
272 | VBoxGuestHGCMCallInfo hdr;
|
---|
273 |
|
---|
274 | /** 32bit, in
|
---|
275 | * Major version
|
---|
276 | */
|
---|
277 | HGCMFunctionParameter vMajor;
|
---|
278 |
|
---|
279 | /** 32bit, in
|
---|
280 | * Minor version
|
---|
281 | */
|
---|
282 | HGCMFunctionParameter vMinor;
|
---|
283 |
|
---|
284 | } CRVBOXHGCMSETVERSION;
|
---|
285 |
|
---|
286 | /** GUEST_FN_GET_CAPS Parameters structure. */
|
---|
287 | typedef struct
|
---|
288 | {
|
---|
289 | VBoxGuestHGCMCallInfo hdr;
|
---|
290 |
|
---|
291 | /** 32bit, out
|
---|
292 | * Caps
|
---|
293 | */
|
---|
294 | HGCMFunctionParameter Caps;
|
---|
295 | } CRVBOXHGCMGETCAPS;
|
---|
296 |
|
---|
297 | /** GUEST_FN_INJECT Parameters structure. */
|
---|
298 | typedef struct
|
---|
299 | {
|
---|
300 | VBoxGuestHGCMCallInfo hdr;
|
---|
301 |
|
---|
302 | /** 32bit, in
|
---|
303 | * ClientID to inject commands buffer for
|
---|
304 | */
|
---|
305 | HGCMFunctionParameter u32ClientID;
|
---|
306 | /** pointer, in
|
---|
307 | * Data buffer
|
---|
308 | */
|
---|
309 | HGCMFunctionParameter pBuffer;
|
---|
310 | } CRVBOXHGCMINJECT;
|
---|
311 |
|
---|
312 | /** GUEST_FN_SET_PID Parameters structure. */
|
---|
313 | typedef struct
|
---|
314 | {
|
---|
315 | VBoxGuestHGCMCallInfo hdr;
|
---|
316 |
|
---|
317 | /** 64bit, in
|
---|
318 | * PID
|
---|
319 | */
|
---|
320 | HGCMFunctionParameter u64PID;
|
---|
321 | } CRVBOXHGCMSETPID;
|
---|
322 |
|
---|
323 | /** GUEST_FN_WRITE_BUFFER Parameters structure. */
|
---|
324 | typedef struct
|
---|
325 | {
|
---|
326 | VBoxGuestHGCMCallInfo hdr;
|
---|
327 |
|
---|
328 | /** 32bit, in/out
|
---|
329 | * Buffer id, 0 means host have to allocate one
|
---|
330 | */
|
---|
331 | HGCMFunctionParameter iBufferID;
|
---|
332 |
|
---|
333 | /** 32bit, in
|
---|
334 | * Buffer size
|
---|
335 | */
|
---|
336 | HGCMFunctionParameter cbBufferSize;
|
---|
337 |
|
---|
338 | /** 32bit, in
|
---|
339 | * Write offset in buffer
|
---|
340 | */
|
---|
341 | HGCMFunctionParameter ui32Offset;
|
---|
342 |
|
---|
343 | /** pointer, in
|
---|
344 | * Data buffer
|
---|
345 | */
|
---|
346 | HGCMFunctionParameter pBuffer;
|
---|
347 |
|
---|
348 | } CRVBOXHGCMWRITEBUFFER;
|
---|
349 |
|
---|
350 | /** GUEST_FN_WRITE_READ_BUFFERED Parameters structure. */
|
---|
351 | typedef struct
|
---|
352 | {
|
---|
353 | VBoxGuestHGCMCallInfo hdr;
|
---|
354 |
|
---|
355 | /** 32bit, in
|
---|
356 | * Buffer id.
|
---|
357 | */
|
---|
358 | HGCMFunctionParameter iBufferID;
|
---|
359 |
|
---|
360 | /** pointer, out
|
---|
361 | * Writeback buffer
|
---|
362 | */
|
---|
363 | HGCMFunctionParameter pWriteback;
|
---|
364 |
|
---|
365 | /** 32bit, out
|
---|
366 | * Count of bytes written to writeback buffer
|
---|
367 | */
|
---|
368 | HGCMFunctionParameter cbWriteback;
|
---|
369 |
|
---|
370 | } CRVBOXHGCMWRITEREADBUFFERED;
|
---|
371 |
|
---|
372 |
|
---|
373 | typedef struct
|
---|
374 | {
|
---|
375 | VBVAINFOSCREEN Screen;
|
---|
376 | void *pvVRAM;
|
---|
377 | } CRVBOXHGCMDEVRESIZE;
|
---|
378 |
|
---|
379 | typedef struct
|
---|
380 | {
|
---|
381 | uint32_t u32Screen;
|
---|
382 | uint32_t x;
|
---|
383 | uint32_t y;
|
---|
384 | uint32_t width;
|
---|
385 | uint32_t height;
|
---|
386 | } CRVBOXHGCMVIEWPORT;
|
---|
387 |
|
---|
388 | typedef DECLCALLBACKPTR(void, PFNCRSCREENSHOTREPORT)(void *pvCtx, uint32_t uScreen,
|
---|
389 | uint32_t x, uint32_t y, uint32_t uBitsPerPixel,
|
---|
390 | uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
|
---|
391 | uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
|
---|
392 |
|
---|
393 | typedef DECLCALLBACKPTR(bool, PFNCRSCREENSHOTBEGIN)(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
|
---|
394 | typedef DECLCALLBACKPTR(void, PFNCRSCREENSHOTEND)(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
|
---|
395 |
|
---|
396 | #define CRSCREEN_ALL (0xffffffff)
|
---|
397 |
|
---|
398 | typedef struct
|
---|
399 | {
|
---|
400 | /* screen id or CRSCREEN_ALL to specify all enabled */
|
---|
401 | uint32_t u32Screen;
|
---|
402 | uint32_t u32Width;
|
---|
403 | uint32_t u32Height;
|
---|
404 | uint32_t u32Pitch;
|
---|
405 | void *pvBuffer;
|
---|
406 | void *pvContext;
|
---|
407 | PFNCRSCREENSHOTBEGIN pfnScreenshotBegin;
|
---|
408 | PFNCRSCREENSHOTREPORT pfnScreenshotPerform;
|
---|
409 | PFNCRSCREENSHOTEND pfnScreenshotEnd;
|
---|
410 | } CRVBOXHGCMTAKESCREENSHOT;
|
---|
411 |
|
---|
412 | #endif
|
---|