VirtualBox

source: vbox/trunk/include/VBox/HostServices/VBoxCrOpenGLSvc.h@ 73768

Last change on this file since 73768 was 69475, checked in by vboxsync, 7 years ago

*: scm updates - header files should have 'svn:keywords=Id Revision' too (doesn't mean they have to use them).

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

© 2023 Oracle
ContactPrivacy policyTerms of Use