1 | /** @file
|
---|
2 | * VirtualBox Video interface
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006 Sun Microsystems, Inc.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | *
|
---|
25 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
26 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
27 | * additional information or have any questions.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef ___VBox_VBoxVideo_h
|
---|
31 | #define ___VBox_VBoxVideo_h
|
---|
32 |
|
---|
33 | #include <iprt/cdefs.h>
|
---|
34 | #include <iprt/types.h>
|
---|
35 |
|
---|
36 | /*
|
---|
37 | * The last 4096 bytes of the guest VRAM contains the generic info for all
|
---|
38 | * DualView chunks: sizes and offsets of chunks. This is filled by miniport.
|
---|
39 | *
|
---|
40 | * Last 4096 bytes of each chunk contain chunk specific data: framebuffer info,
|
---|
41 | * etc. This is used exclusively by the corresponding instance of a display driver.
|
---|
42 | *
|
---|
43 | * The VRAM layout:
|
---|
44 | * Last 4096 bytes - Adapter information area.
|
---|
45 | * 4096 bytes aligned miniport heap (value specified in the config rouded up).
|
---|
46 | * Slack - what left after dividing the VRAM.
|
---|
47 | * 4096 bytes aligned framebuffers:
|
---|
48 | * last 4096 bytes of each framebuffer is the display information area.
|
---|
49 | *
|
---|
50 | * The Virtual Graphics Adapter information in the guest VRAM is stored by the
|
---|
51 | * guest video driver using structures prepended by VBOXVIDEOINFOHDR.
|
---|
52 | *
|
---|
53 | * When the guest driver writes dword 0 to the VBE_DISPI_INDEX_VBOX_VIDEO
|
---|
54 | * the host starts to process the info. The first element at the start of
|
---|
55 | * the 4096 bytes region should be normally be a LINK that points to
|
---|
56 | * actual information chain. That way the guest driver can have some
|
---|
57 | * fixed layout of the information memory block and just rewrite
|
---|
58 | * the link to point to relevant memory chain.
|
---|
59 | *
|
---|
60 | * The processing stops at the END element.
|
---|
61 | *
|
---|
62 | * The host can access the memory only when the port IO is processed.
|
---|
63 | * All data that will be needed later must be copied from these 4096 bytes.
|
---|
64 | * But other VRAM can be used by host until the mode is disabled.
|
---|
65 | *
|
---|
66 | * The guest driver writes dword 0xffffffff to the VBE_DISPI_INDEX_VBOX_VIDEO
|
---|
67 | * to disable the mode.
|
---|
68 | *
|
---|
69 | * VBE_DISPI_INDEX_VBOX_VIDEO is used to read the configuration information
|
---|
70 | * from the host and issue commands to the host.
|
---|
71 | *
|
---|
72 | * The guest writes the VBE_DISPI_INDEX_VBOX_VIDEO index register, the the
|
---|
73 | * following operations with the VBE data register can be performed:
|
---|
74 | *
|
---|
75 | * Operation Result
|
---|
76 | * write 16 bit value NOP
|
---|
77 | * read 16 bit value count of monitors
|
---|
78 | * write 32 bit value sets the vbox command value and the command processed by the host
|
---|
79 | * read 32 bit value result of the last vbox command is returned
|
---|
80 | */
|
---|
81 |
|
---|
82 | #define VBOX_VIDEO_PRIMARY_SCREEN 0
|
---|
83 | #define VBOX_VIDEO_NO_SCREEN ~0
|
---|
84 |
|
---|
85 | #define VBOX_VIDEO_MAX_SCREENS 64
|
---|
86 |
|
---|
87 | /* The size of the information. */
|
---|
88 | #ifndef VBOX_WITH_HGSMI
|
---|
89 | #define VBOX_VIDEO_ADAPTER_INFORMATION_SIZE 4096
|
---|
90 | #define VBOX_VIDEO_DISPLAY_INFORMATION_SIZE 4096
|
---|
91 | #else
|
---|
92 | /*
|
---|
93 | * The minimum HGSMI heap size is PAGE_SIZE (4096 bytes) and is a restriction of the
|
---|
94 | * runtime heapsimple API. Use minimum 2 pages here, because the info area also may
|
---|
95 | * contain other data (for example HGSMIHOSTFLAGS structure).
|
---|
96 | */
|
---|
97 | #define VBVA_ADAPTER_INFORMATION_SIZE (8*_1K)
|
---|
98 | #define VBVA_DISPLAY_INFORMATION_SIZE (8*_1K)
|
---|
99 | #define VBVA_MIN_BUFFER_SIZE (64*_1K)
|
---|
100 | #endif /* VBOX_WITH_HGSMI */
|
---|
101 |
|
---|
102 |
|
---|
103 | /* The value for port IO to let the adapter to interpret the adapter memory. */
|
---|
104 | #define VBOX_VIDEO_DISABLE_ADAPTER_MEMORY 0xFFFFFFFF
|
---|
105 |
|
---|
106 | /* The value for port IO to let the adapter to interpret the adapter memory. */
|
---|
107 | #define VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY 0x00000000
|
---|
108 |
|
---|
109 | /* The value for port IO to let the adapter to interpret the display memory.
|
---|
110 | * The display number is encoded in low 16 bits.
|
---|
111 | */
|
---|
112 | #define VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE 0x00010000
|
---|
113 |
|
---|
114 |
|
---|
115 | /* The end of the information. */
|
---|
116 | #define VBOX_VIDEO_INFO_TYPE_END 0
|
---|
117 | /* Instructs the host to fetch the next VBOXVIDEOINFOHDR at the given offset of VRAM. */
|
---|
118 | #define VBOX_VIDEO_INFO_TYPE_LINK 1
|
---|
119 | /* Information about a display memory position. */
|
---|
120 | #define VBOX_VIDEO_INFO_TYPE_DISPLAY 2
|
---|
121 | /* Information about a screen. */
|
---|
122 | #define VBOX_VIDEO_INFO_TYPE_SCREEN 3
|
---|
123 | /* Information about host notifications for the driver. */
|
---|
124 | #define VBOX_VIDEO_INFO_TYPE_HOST_EVENTS 4
|
---|
125 | /* Information about non-volatile guest VRAM heap. */
|
---|
126 | #define VBOX_VIDEO_INFO_TYPE_NV_HEAP 5
|
---|
127 | /* VBVA enable/disable. */
|
---|
128 | #define VBOX_VIDEO_INFO_TYPE_VBVA_STATUS 6
|
---|
129 | /* VBVA flush. */
|
---|
130 | #define VBOX_VIDEO_INFO_TYPE_VBVA_FLUSH 7
|
---|
131 | /* Query configuration value. */
|
---|
132 | #define VBOX_VIDEO_INFO_TYPE_QUERY_CONF32 8
|
---|
133 |
|
---|
134 |
|
---|
135 | #pragma pack(1)
|
---|
136 | typedef struct _VBOXVIDEOINFOHDR
|
---|
137 | {
|
---|
138 | uint8_t u8Type;
|
---|
139 | uint8_t u8Reserved;
|
---|
140 | uint16_t u16Length;
|
---|
141 | } VBOXVIDEOINFOHDR;
|
---|
142 |
|
---|
143 |
|
---|
144 | typedef struct _VBOXVIDEOINFOLINK
|
---|
145 | {
|
---|
146 | /* Relative offset in VRAM */
|
---|
147 | int32_t i32Offset;
|
---|
148 | } VBOXVIDEOINFOLINK;
|
---|
149 |
|
---|
150 |
|
---|
151 | /* Resides in adapter info memory. Describes a display VRAM chunk. */
|
---|
152 | typedef struct _VBOXVIDEOINFODISPLAY
|
---|
153 | {
|
---|
154 | /* Index of the framebuffer assigned by guest. */
|
---|
155 | uint32_t u32Index;
|
---|
156 |
|
---|
157 | /* Absolute offset in VRAM of the framebuffer to be displayed on the monitor. */
|
---|
158 | uint32_t u32Offset;
|
---|
159 |
|
---|
160 | /* The size of the memory that can be used for the screen. */
|
---|
161 | uint32_t u32FramebufferSize;
|
---|
162 |
|
---|
163 | /* The size of the memory that is used for the Display information.
|
---|
164 | * The information is at u32Offset + u32FramebufferSize
|
---|
165 | */
|
---|
166 | uint32_t u32InformationSize;
|
---|
167 |
|
---|
168 | } VBOXVIDEOINFODISPLAY;
|
---|
169 |
|
---|
170 |
|
---|
171 | /* Resides in display info area, describes the current video mode. */
|
---|
172 | #define VBOX_VIDEO_INFO_SCREEN_F_NONE 0x00
|
---|
173 | #define VBOX_VIDEO_INFO_SCREEN_F_ACTIVE 0x01
|
---|
174 |
|
---|
175 | typedef struct _VBOXVIDEOINFOSCREEN
|
---|
176 | {
|
---|
177 | /* Physical X origin relative to the primary screen. */
|
---|
178 | int32_t xOrigin;
|
---|
179 |
|
---|
180 | /* Physical Y origin relative to the primary screen. */
|
---|
181 | int32_t yOrigin;
|
---|
182 |
|
---|
183 | /* The scan line size in bytes. */
|
---|
184 | uint32_t u32LineSize;
|
---|
185 |
|
---|
186 | /* Width of the screen. */
|
---|
187 | uint16_t u16Width;
|
---|
188 |
|
---|
189 | /* Height of the screen. */
|
---|
190 | uint16_t u16Height;
|
---|
191 |
|
---|
192 | /* Color depth. */
|
---|
193 | uint8_t bitsPerPixel;
|
---|
194 |
|
---|
195 | /* VBOX_VIDEO_INFO_SCREEN_F_* */
|
---|
196 | uint8_t u8Flags;
|
---|
197 | } VBOXVIDEOINFOSCREEN;
|
---|
198 |
|
---|
199 | /* The guest initializes the structure to 0. The positions of the structure in the
|
---|
200 | * display info area must not be changed, host will update the structure. Guest checks
|
---|
201 | * the events and modifies the structure as a response to host.
|
---|
202 | */
|
---|
203 | #define VBOX_VIDEO_INFO_HOST_EVENTS_F_NONE 0x00000000
|
---|
204 | #define VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET 0x00000080
|
---|
205 |
|
---|
206 | typedef struct _VBOXVIDEOINFOHOSTEVENTS
|
---|
207 | {
|
---|
208 | /* Host events. */
|
---|
209 | uint32_t fu32Events;
|
---|
210 | } VBOXVIDEOINFOHOSTEVENTS;
|
---|
211 |
|
---|
212 | /* Resides in adapter info memory. Describes the non-volatile VRAM heap. */
|
---|
213 | typedef struct _VBOXVIDEOINFONVHEAP
|
---|
214 | {
|
---|
215 | /* Absolute offset in VRAM of the start of the heap. */
|
---|
216 | uint32_t u32HeapOffset;
|
---|
217 |
|
---|
218 | /* The size of the heap. */
|
---|
219 | uint32_t u32HeapSize;
|
---|
220 |
|
---|
221 | } VBOXVIDEOINFONVHEAP;
|
---|
222 |
|
---|
223 | /* Display information area. */
|
---|
224 | typedef struct _VBOXVIDEOINFOVBVASTATUS
|
---|
225 | {
|
---|
226 | /* Absolute offset in VRAM of the start of the VBVA QUEUE. 0 to disable VBVA. */
|
---|
227 | uint32_t u32QueueOffset;
|
---|
228 |
|
---|
229 | /* The size of the VBVA QUEUE. 0 to disable VBVA. */
|
---|
230 | uint32_t u32QueueSize;
|
---|
231 |
|
---|
232 | } VBOXVIDEOINFOVBVASTATUS;
|
---|
233 |
|
---|
234 | typedef struct _VBOXVIDEOINFOVBVAFLUSH
|
---|
235 | {
|
---|
236 | uint32_t u32DataStart;
|
---|
237 |
|
---|
238 | uint32_t u32DataEnd;
|
---|
239 |
|
---|
240 | } VBOXVIDEOINFOVBVAFLUSH;
|
---|
241 |
|
---|
242 | #define VBOX_VIDEO_QCI32_MONITOR_COUNT 0
|
---|
243 | #define VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE 1
|
---|
244 |
|
---|
245 | typedef struct _VBOXVIDEOINFOQUERYCONF32
|
---|
246 | {
|
---|
247 | uint32_t u32Index;
|
---|
248 |
|
---|
249 | uint32_t u32Value;
|
---|
250 |
|
---|
251 | } VBOXVIDEOINFOQUERYCONF32;
|
---|
252 | #pragma pack()
|
---|
253 |
|
---|
254 | # ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
255 | #pragma pack(1)
|
---|
256 |
|
---|
257 | typedef enum
|
---|
258 | {
|
---|
259 | VBOXVHWACMD_TYPE_SURF_CANCREATE = 1,
|
---|
260 | VBOXVHWACMD_TYPE_SURF_CREATE,
|
---|
261 | VBOXVHWACMD_TYPE_SURF_DESTROY,
|
---|
262 | VBOXVHWACMD_TYPE_SURF_LOCK,
|
---|
263 | VBOXVHWACMD_TYPE_SURF_UNLOCK,
|
---|
264 | VBOXVHWACMD_TYPE_SURF_BLT,
|
---|
265 | VBOXVHWACMD_TYPE_QUERY_INFO1,
|
---|
266 | VBOXVHWACMD_TYPE_QUERY_INFO2,
|
---|
267 | VBOXVHWACMD_TYPE_ENABLE,
|
---|
268 | VBOXVHWACMD_TYPE_DISABLE
|
---|
269 | } VBOXVHWACMD_TYPE;
|
---|
270 |
|
---|
271 | /* the command processing was asynch, set by the host to indicate asynch command completion
|
---|
272 | * must not be cleared once set, the command completion is performed by issuing a host->guest completion command
|
---|
273 | * while keeping this flag unchanged */
|
---|
274 | #define VBOXVHWACMD_FLAG_ASYNCH 0x00000001
|
---|
275 | /* asynch completion is performed by issuing the event */
|
---|
276 | #define VBOXVHWACMD_FLAG_ASYNCH_EVENT 0x00000002
|
---|
277 |
|
---|
278 | typedef struct _VBOXVHWACMD
|
---|
279 | {
|
---|
280 | VBOXVHWACMD_TYPE enmCmd; /* command type */
|
---|
281 | volatile int32_t rc; /* command result */
|
---|
282 | int32_t iDisplay; /* display index */
|
---|
283 | volatile int32_t Flags; /* ored VBOXVHWACMD_FLAG_xxx values */
|
---|
284 | uint64_t GuestVBVAReserved1; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
|
---|
285 | uint64_t GuestVBVAReserved2; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
|
---|
286 | union
|
---|
287 | {
|
---|
288 | struct _VBOXVHWACMD *pNext;
|
---|
289 | uint32_t offNext;
|
---|
290 | uint64_t Data; /* the body is 64-bit aligned */
|
---|
291 | } u;
|
---|
292 | char body[1];
|
---|
293 | } VBOXVHWACMD;
|
---|
294 |
|
---|
295 | #define VBOXVHWACMD_HEADSIZE() (RT_OFFSETOF(VBOXVHWACMD, body))
|
---|
296 | #define VBOXVHWACMD_SIZE(_tCmd) (VBOXVHWACMD_HEADSIZE() + sizeof(_tCmd))
|
---|
297 | typedef unsigned int VBOXVHWACMD_LENGTH;
|
---|
298 | typedef uint64_t VBOXVHWA_SURFHANDLE;
|
---|
299 | #define VBOXVHWACMD_SURFHANDLE_INVALID 0
|
---|
300 | #define VBOXVHWACMD_BODY(_p, _t) ((_t*)(_p)->body)
|
---|
301 | #define VBOXVHWACMD_HEAD(_pb) ((VBOXVHWACMD*)((uint8_t *)(_pb) - RT_OFFSETOF(VBOXVHWACMD, body)))
|
---|
302 |
|
---|
303 | typedef struct _VBOXVHWA_RECTL
|
---|
304 | {
|
---|
305 | int32_t x;
|
---|
306 | int32_t y;
|
---|
307 | uint32_t w;
|
---|
308 | uint32_t h;
|
---|
309 | } VBOXVHWA_RECTL;
|
---|
310 |
|
---|
311 | typedef struct _VBOXVHWA_COLORKEY
|
---|
312 | {
|
---|
313 | uint32_t low;
|
---|
314 | uint32_t high;
|
---|
315 | } VBOXVHWA_COLORKEY;
|
---|
316 |
|
---|
317 | typedef struct _VBOXVHWA_PIXELFORMAT
|
---|
318 | {
|
---|
319 | uint32_t flags;
|
---|
320 | uint32_t fourCC;
|
---|
321 | union
|
---|
322 | {
|
---|
323 | uint32_t rgbBitCount;
|
---|
324 | uint32_t yuvBitCount;
|
---|
325 | } c;
|
---|
326 |
|
---|
327 | union
|
---|
328 | {
|
---|
329 | uint32_t rgbRBitMask;
|
---|
330 | uint32_t yuvYBitMask;
|
---|
331 | } m1;
|
---|
332 |
|
---|
333 | union
|
---|
334 | {
|
---|
335 | uint32_t rgbGBitMask;
|
---|
336 | uint32_t yuvUBitMask;
|
---|
337 | } m2;
|
---|
338 |
|
---|
339 | union
|
---|
340 | {
|
---|
341 | uint32_t rgbBBitMask;
|
---|
342 | uint32_t yuvVBitMask;
|
---|
343 | } m3;
|
---|
344 | } VBOXVHWA_PIXELFORMAT;
|
---|
345 |
|
---|
346 | typedef struct _VBOXVHWA_SURFINFO
|
---|
347 | {
|
---|
348 | uint32_t height;
|
---|
349 | uint32_t width;
|
---|
350 | VBOXVHWA_COLORKEY DstOverlayCK;
|
---|
351 | VBOXVHWA_COLORKEY DstBltCK;
|
---|
352 | VBOXVHWA_COLORKEY SrcOverlayCK;
|
---|
353 | VBOXVHWA_COLORKEY SrcBltCK;
|
---|
354 | VBOXVHWA_PIXELFORMAT PixelFormat;
|
---|
355 | uint32_t surfCaps;
|
---|
356 | uint32_t Reserved;
|
---|
357 | } VBOXVHWA_SURFINFO;
|
---|
358 |
|
---|
359 | #define VBOXVHWA_CAPS_BLT 0x00000001
|
---|
360 | #define VBOXVHWA_CAPS_BLTCOLORFILL 0x00000002
|
---|
361 | #define VBOXVHWA_CAPS_BLTFOURCC 0x00000004
|
---|
362 | #define VBOXVHWA_CAPS_BLTSTRETCH 0x00000008
|
---|
363 |
|
---|
364 | #define VBOXVHWA_CAPS_OVERLAY 0x00000100
|
---|
365 | #define VBOXVHWA_CAPS_OVERLAYFOURCC 0x00000200
|
---|
366 | #define VBOXVHWA_CAPS_OVERLAYSTRETCH 0x00000400
|
---|
367 |
|
---|
368 | #define VBOXVHWA_CAPS_COLORKEY 0x00001000
|
---|
369 | //#define VBOXVHWA_CAPS_COLORKEYHWASSIST 0x00002000 /* always set COLORKEYHWASSIST in case host reports colorkey support */
|
---|
370 |
|
---|
371 | #define VBOXVHWA_CAPS2_COPYFOURCC 0x00000001
|
---|
372 |
|
---|
373 | #define VBOXVHWA_SCAPS_FLIP 0x00000001
|
---|
374 | #define VBOXVHWA_SCAPS_PRIMARYSURFACE 0x00000002
|
---|
375 | #define VBOXVHWA_SCAPS_OVERLAY 0x00000008
|
---|
376 |
|
---|
377 | #define VBOXVHWA_PF_RGB 0x00000001
|
---|
378 | #define VBOXVHWA_PF_RGBTOYUV 0x00000002
|
---|
379 | #define VBOXVHWA_PF_YUV 0x00000008
|
---|
380 | #define VBOXVHWA_PF_FOURCC 0x00000010
|
---|
381 |
|
---|
382 | #define VBOXVHWA_LOCK_DISCARDCONTENTS 0x00000001
|
---|
383 |
|
---|
384 | #define VBOXVHWA_CFG_ENABLED 0x00000001
|
---|
385 |
|
---|
386 | #define VBOXVHWA_OFFSET64_VOID (~0L)
|
---|
387 |
|
---|
388 | typedef struct _VBOXVHWACMD_QUERYINFO1
|
---|
389 | {
|
---|
390 | uint32_t cfgFlags;
|
---|
391 | uint32_t caps;
|
---|
392 | uint32_t colorKeyCaps;
|
---|
393 | uint32_t stretchCaps;
|
---|
394 | uint32_t surfaceCaps;
|
---|
395 | uint32_t numOverlays;
|
---|
396 | uint32_t numFourCC;
|
---|
397 |
|
---|
398 | } VBOXVHWACMD_QUERYINFO1;
|
---|
399 |
|
---|
400 | typedef struct _VBOXVHWACMD_QUERYINFO2
|
---|
401 | {
|
---|
402 | uint32_t numFourCC;
|
---|
403 | uint32_t FourCC[1];
|
---|
404 | } VBOXVHWACMD_QUERYINFO2;
|
---|
405 |
|
---|
406 | #define VBOXVHWAINFO2_SIZE(_cFourCC) RT_OFFSETOF(VBOXVHWAINFO2, FourCC[_cFourCC])
|
---|
407 |
|
---|
408 | typedef struct _VBOXVHWACMD_SURF_CANCREATE
|
---|
409 | {
|
---|
410 | union
|
---|
411 | {
|
---|
412 | struct
|
---|
413 | {
|
---|
414 | VBOXVHWA_SURFINFO SurfInfo;
|
---|
415 | } in;
|
---|
416 |
|
---|
417 | struct
|
---|
418 | {
|
---|
419 | uint32_t ErrInfo;
|
---|
420 | } out;
|
---|
421 | } u;
|
---|
422 | } VBOXVHWACMD_SURF_CANCREATE;
|
---|
423 |
|
---|
424 | typedef struct _VBOXVHWACMD_SURF_CREATE
|
---|
425 | {
|
---|
426 | union
|
---|
427 | {
|
---|
428 | struct
|
---|
429 | {
|
---|
430 | VBOXVHWA_SURFINFO SurfInfo;
|
---|
431 | uint64_t offSurface;
|
---|
432 | } in;
|
---|
433 |
|
---|
434 | struct
|
---|
435 | {
|
---|
436 | VBOXVHWA_SURFHANDLE hSurf;
|
---|
437 | } out;
|
---|
438 | } u;
|
---|
439 | } VBOXVHWACMD_SURF_CREATE;
|
---|
440 |
|
---|
441 | typedef struct _VBOXVHWACMD_SURF_DESTROY
|
---|
442 | {
|
---|
443 | union
|
---|
444 | {
|
---|
445 | struct
|
---|
446 | {
|
---|
447 | VBOXVHWA_SURFHANDLE hSurf;
|
---|
448 | } in;
|
---|
449 | } u;
|
---|
450 | } VBOXVHWACMD_SURF_DESTROY;
|
---|
451 |
|
---|
452 | typedef struct _VBOXVHWACMD_SURF_LOCK
|
---|
453 | {
|
---|
454 | union
|
---|
455 | {
|
---|
456 | struct
|
---|
457 | {
|
---|
458 | VBOXVHWA_SURFHANDLE hSurf;
|
---|
459 | uint64_t offSurface;
|
---|
460 | uint32_t flags;
|
---|
461 | uint32_t rectValid;
|
---|
462 | VBOXVHWA_RECTL rect;
|
---|
463 | } in;
|
---|
464 | } u;
|
---|
465 | } VBOXVHWACMD_SURF_LOCK;
|
---|
466 |
|
---|
467 | typedef struct _VBOXVHWACMD_SURF_UNLOCK
|
---|
468 | {
|
---|
469 | union
|
---|
470 | {
|
---|
471 | struct
|
---|
472 | {
|
---|
473 | VBOXVHWA_SURFHANDLE hSurf;
|
---|
474 | } in;
|
---|
475 | } u;
|
---|
476 | } VBOXVHWACMD_SURF_UNLOCK;
|
---|
477 |
|
---|
478 | typedef struct _VBOXVHWACMD_SURF_BLT
|
---|
479 | {
|
---|
480 | uint64_t DstGuestSurfInfo;
|
---|
481 | uint64_t SrcGuestSurfInfo;
|
---|
482 | union
|
---|
483 | {
|
---|
484 | struct
|
---|
485 | {
|
---|
486 | VBOXVHWA_SURFHANDLE hDstSurf;
|
---|
487 | uint64_t offDstSurface;
|
---|
488 | VBOXVHWA_RECTL dstRect;
|
---|
489 | VBOXVHWA_SURFHANDLE hSrcSurf;
|
---|
490 | uint64_t offSrcSurface;
|
---|
491 | VBOXVHWA_RECTL srcRect;
|
---|
492 | uint32_t flags;
|
---|
493 | uint32_t reserved;
|
---|
494 | } in;
|
---|
495 | } u;
|
---|
496 | } VBOXVHWACMD_SURF_BLT;
|
---|
497 |
|
---|
498 | #pragma pack()
|
---|
499 | # endif /* #ifdef VBOX_WITH_VIDEOHWACCEL */
|
---|
500 |
|
---|
501 | #ifdef VBOX_WITH_HGSMI
|
---|
502 |
|
---|
503 | /* All structures are without alignment. */
|
---|
504 | #pragma pack(1)
|
---|
505 |
|
---|
506 | typedef struct _VBVABUFFER
|
---|
507 | {
|
---|
508 | uint32_t u32HostEvents;
|
---|
509 | uint32_t u32SupportedOrders;
|
---|
510 |
|
---|
511 | /* The offset where the data start in the buffer. */
|
---|
512 | uint32_t off32Data;
|
---|
513 | /* The offset where next data must be placed in the buffer. */
|
---|
514 | uint32_t off32Free;
|
---|
515 |
|
---|
516 | /* The queue of record descriptions. */
|
---|
517 | VBVARECORD aRecords[VBVA_MAX_RECORDS];
|
---|
518 | uint32_t indexRecordFirst;
|
---|
519 | uint32_t indexRecordFree;
|
---|
520 |
|
---|
521 | /* Space to leave free in the buffer when large partial records are transferred. */
|
---|
522 | uint32_t cbPartialWriteThreshold;
|
---|
523 |
|
---|
524 | uint32_t cbData;
|
---|
525 | uint8_t au8Data[1]; /* variable size for the rest of the VBVABUFFER area in VRAM. */
|
---|
526 | } VBVABUFFER;
|
---|
527 |
|
---|
528 | /* guest->host commands */
|
---|
529 | #define VBVA_QUERY_CONF32 1
|
---|
530 | #define VBVA_SET_CONF32 2
|
---|
531 | #define VBVA_INFO_VIEW 3
|
---|
532 | #define VBVA_INFO_HEAP 4
|
---|
533 | #define VBVA_FLUSH 5
|
---|
534 | #define VBVA_INFO_SCREEN 6
|
---|
535 | #define VBVA_ENABLE 7
|
---|
536 | #define VBVA_MOUSE_POINTER_SHAPE 8
|
---|
537 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
538 | # define VBVA_VHWA_CMD 9
|
---|
539 | #endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
|
---|
540 |
|
---|
541 | /* host->guest commands */
|
---|
542 | # define VBVAHG_EVENT 1
|
---|
543 | # define VBVAHG_DISPLAY_CUSTOM 2
|
---|
544 |
|
---|
545 | # ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
546 | #define VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE 1
|
---|
547 | #pragma pack(1)
|
---|
548 | typedef struct _VBVAHOSTCMDVHWACMDCOMPLETE
|
---|
549 | {
|
---|
550 | uint32_t offCmd;
|
---|
551 | }VBVAHOSTCMDVHWACMDCOMPLETE;
|
---|
552 | #pragma pack()
|
---|
553 | # endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
|
---|
554 |
|
---|
555 | #pragma pack(1)
|
---|
556 | typedef enum
|
---|
557 | {
|
---|
558 | VBVAHOSTCMD_OP_EVENT = 1,
|
---|
559 | VBVAHOSTCMD_OP_CUSTOM
|
---|
560 | }VBVAHOSTCMD_OP_TYPE;
|
---|
561 |
|
---|
562 | typedef struct _VBVAHOSTCMDEVENT
|
---|
563 | {
|
---|
564 | uint64_t pEvent;
|
---|
565 | }VBVAHOSTCMDEVENT;
|
---|
566 |
|
---|
567 |
|
---|
568 | typedef struct _VBVAHOSTCMD
|
---|
569 | {
|
---|
570 | /* destination ID if >=0 specifies display index, otherwize the command is directed to the miniport */
|
---|
571 | int32_t iDstID;
|
---|
572 | int32_t customOpCode;
|
---|
573 | union
|
---|
574 | {
|
---|
575 | struct _VBVAHOSTCMD *pNext;
|
---|
576 | uint32_t offNext;
|
---|
577 | uint64_t Data; /* the body is 64-bit aligned */
|
---|
578 | } u;
|
---|
579 | char body[1];
|
---|
580 | }VBVAHOSTCMD;
|
---|
581 |
|
---|
582 | #define VBVAHOSTCMD_SIZE(_size) (sizeof(VBVAHOSTCMD) + (_size))
|
---|
583 | #define VBVAHOSTCMD_BODY(_pCmd, _tBody) ((_tBody*)(_pCmd)->body)
|
---|
584 | #define VBVAHOSTCMD_HDR(_pBody) ((VBVAHOSTCMD*)(((uint8_t*)_pBody) - RT_OFFSETOF(VBVAHOSTCMD, body)))
|
---|
585 | #define VBVAHOSTCMD_HDRSIZE (RT_OFFSETOF(VBVAHOSTCMD, body))
|
---|
586 |
|
---|
587 | #pragma pack()
|
---|
588 |
|
---|
589 | /* VBVACONF32::u32Index */
|
---|
590 | #define VBOX_VBVA_CONF32_MONITOR_COUNT 0
|
---|
591 | #define VBOX_VBVA_CONF32_HOST_HEAP_SIZE 1
|
---|
592 |
|
---|
593 | typedef struct _VBVACONF32
|
---|
594 | {
|
---|
595 | uint32_t u32Index;
|
---|
596 | uint32_t u32Value;
|
---|
597 | } VBVACONF32;
|
---|
598 |
|
---|
599 | typedef struct _VBVAINFOVIEW
|
---|
600 | {
|
---|
601 | /* Index of the screen, assigned by the guest. */
|
---|
602 | uint32_t u32ViewIndex;
|
---|
603 |
|
---|
604 | /* The screen offset in VRAM, the framebuffer starts here. */
|
---|
605 | uint32_t u32ViewOffset;
|
---|
606 |
|
---|
607 | /* The size of the VRAM memory that can be used for the view. */
|
---|
608 | uint32_t u32ViewSize;
|
---|
609 |
|
---|
610 | /* The recommended maximum size of the VRAM memory for the screen. */
|
---|
611 | uint32_t u32MaxScreenSize;
|
---|
612 | } VBVAINFOVIEW;
|
---|
613 |
|
---|
614 | typedef struct _VBVAINFOHEAP
|
---|
615 | {
|
---|
616 | /* Absolute offset in VRAM of the start of the heap. */
|
---|
617 | uint32_t u32HeapOffset;
|
---|
618 |
|
---|
619 | /* The size of the heap. */
|
---|
620 | uint32_t u32HeapSize;
|
---|
621 |
|
---|
622 | } VBVAINFOHEAP;
|
---|
623 |
|
---|
624 | typedef struct _VBVAFLUSH
|
---|
625 | {
|
---|
626 | uint32_t u32Reserved;
|
---|
627 |
|
---|
628 | } VBVAFLUSH;
|
---|
629 |
|
---|
630 | /* VBVAINFOSCREEN::u8Flags */
|
---|
631 | #define VBVA_SCREEN_F_NONE 0x0000
|
---|
632 | #define VBVA_SCREEN_F_ACTIVE 0x0001
|
---|
633 |
|
---|
634 | typedef struct _VBVAINFOSCREEN
|
---|
635 | {
|
---|
636 | /* Which view contains the screen. */
|
---|
637 | uint32_t u32ViewIndex;
|
---|
638 |
|
---|
639 | /* Physical X origin relative to the primary screen. */
|
---|
640 | int32_t i32OriginX;
|
---|
641 |
|
---|
642 | /* Physical Y origin relative to the primary screen. */
|
---|
643 | int32_t i32OriginY;
|
---|
644 |
|
---|
645 | /* The scan line size in bytes. */
|
---|
646 | uint32_t u32LineSize;
|
---|
647 |
|
---|
648 | /* Width of the screen. */
|
---|
649 | uint32_t u32Width;
|
---|
650 |
|
---|
651 | /* Height of the screen. */
|
---|
652 | uint32_t u32Height;
|
---|
653 |
|
---|
654 | /* Color depth. */
|
---|
655 | uint16_t u16BitsPerPixel;
|
---|
656 |
|
---|
657 | /* VBVA_SCREEN_F_* */
|
---|
658 | uint16_t u16Flags;
|
---|
659 | } VBVAINFOSCREEN;
|
---|
660 |
|
---|
661 |
|
---|
662 | /* VBVAENABLE::u32Flags */
|
---|
663 | #define VBVA_F_NONE 0x00000000
|
---|
664 | #define VBVA_F_ENABLE 0x00000001
|
---|
665 | #define VBVA_F_DISABLE 0x00000002
|
---|
666 |
|
---|
667 | typedef struct _VBVAENABLE
|
---|
668 | {
|
---|
669 | uint32_t u32Flags;
|
---|
670 | uint32_t u32Offset;
|
---|
671 |
|
---|
672 | } VBVAENABLE;
|
---|
673 |
|
---|
674 | typedef struct _VBVAMOUSEPOINTERSHAPE
|
---|
675 | {
|
---|
676 | /* The host result. */
|
---|
677 | uint32_t u32Result;
|
---|
678 |
|
---|
679 | /* VBOX_MOUSE_POINTER_* bit flags. */
|
---|
680 | uint32_t fu32Flags;
|
---|
681 |
|
---|
682 | /* X coordinate of the hot spot. */
|
---|
683 | uint32_t u32HotX;
|
---|
684 |
|
---|
685 | /* Y coordinate of the hot spot. */
|
---|
686 | uint32_t u32HotY;
|
---|
687 |
|
---|
688 | /* Width of the pointer in pixels. */
|
---|
689 | uint32_t u32Width;
|
---|
690 |
|
---|
691 | /* Height of the pointer in scanlines. */
|
---|
692 | uint32_t u32Height;
|
---|
693 |
|
---|
694 | /* Pointer data.
|
---|
695 | *
|
---|
696 | ****
|
---|
697 | * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
|
---|
698 | *
|
---|
699 | * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
|
---|
700 | * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
|
---|
701 | *
|
---|
702 | * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
|
---|
703 | * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
|
---|
704 | * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
|
---|
705 | *
|
---|
706 | * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
|
---|
707 | * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
|
---|
708 | * end of any scanline are undefined.
|
---|
709 | *
|
---|
710 | * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
|
---|
711 | * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
|
---|
712 | * Bytes in the gap between the AND and the XOR mask are undefined.
|
---|
713 | * XOR mask scanlines have no gap between them and size of XOR mask is:
|
---|
714 | * cXor = width * 4 * height.
|
---|
715 | ****
|
---|
716 | *
|
---|
717 | * Preallocate 4 bytes for accessing actual data as p->au8Data.
|
---|
718 | */
|
---|
719 | uint8_t au8Data[4];
|
---|
720 |
|
---|
721 | } VBVAMOUSEPOINTERSHAPE;
|
---|
722 |
|
---|
723 | #pragma pack()
|
---|
724 |
|
---|
725 | #endif /* VBOX_WITH_HGSMI */
|
---|
726 |
|
---|
727 | #endif
|
---|