VirtualBox

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

Last change on this file since 78151 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette