VirtualBox

source: vbox/trunk/include/VBox/VBoxVideo.h@ 22247

Last change on this file since 22247 was 22247, checked in by vboxsync, 16 years ago

video hw accel: more saved state support impl, bugfixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 27.9 KB
Line 
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)
136typedef struct _VBOXVIDEOINFOHDR
137{
138 uint8_t u8Type;
139 uint8_t u8Reserved;
140 uint16_t u16Length;
141} VBOXVIDEOINFOHDR;
142
143
144typedef 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. */
152typedef 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
175typedef 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
206typedef 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. */
213typedef 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. */
224typedef 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
234typedef 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
245typedef 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#define VBOXVHWA_VERSION_MAJ 0
258#define VBOXVHWA_VERSION_MIN 0
259#define VBOXVHWA_VERSION_BLD 3
260#define VBOXVHWA_VERSION_RSV 0
261
262typedef enum
263{
264 VBOXVHWACMD_TYPE_SURF_CANCREATE = 1,
265 VBOXVHWACMD_TYPE_SURF_CREATE,
266 VBOXVHWACMD_TYPE_SURF_DESTROY,
267 VBOXVHWACMD_TYPE_SURF_LOCK,
268 VBOXVHWACMD_TYPE_SURF_UNLOCK,
269 VBOXVHWACMD_TYPE_SURF_BLT,
270 VBOXVHWACMD_TYPE_SURF_FLIP,
271 VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE,
272 VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION,
273 VBOXVHWACMD_TYPE_SURF_COLORKEY_SET,
274 VBOXVHWACMD_TYPE_QUERY_INFO1,
275 VBOXVHWACMD_TYPE_QUERY_INFO2,
276 VBOXVHWACMD_TYPE_ENABLE,
277 VBOXVHWACMD_TYPE_DISABLE,
278 VBOXVHWACMD_TYPE_HH_CONSTRUCT
279} VBOXVHWACMD_TYPE;
280
281/* the command processing was asynch, set by the host to indicate asynch command completion
282 * must not be cleared once set, the command completion is performed by issuing a host->guest completion command
283 * while keeping this flag unchanged */
284#define VBOXVHWACMD_FLAG_HG_ASYNCH 0x00010000
285/* asynch completion is performed by issuing the event */
286#define VBOXVHWACMD_FLAG_GH_ASYNCH_EVENT 0x00000001
287/* issue interrupt on asynch completion */
288#define VBOXVHWACMD_FLAG_GH_ASYNCH_IRQ 0x00000002
289/* guest does not do any op on completion of this command, the host may copy the command and indicate that it does not need the command anymore
290 * by setting the VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED flag */
291#define VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION 0x00000004
292/* the host has copied the VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION command and returned it to the guest */
293#define VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED 0x00020000
294/* this is the host->host cmd, i.e. a configuration command posted by the host to the framebuffer */
295#define VBOXVHWACMD_FLAG_HH_CMD 0x10000000
296
297typedef struct _VBOXVHWACMD
298{
299 VBOXVHWACMD_TYPE enmCmd; /* command type */
300 volatile int32_t rc; /* command result */
301 int32_t iDisplay; /* display index */
302 volatile int32_t Flags; /* ored VBOXVHWACMD_FLAG_xxx values */
303 uint64_t GuestVBVAReserved1; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
304 uint64_t GuestVBVAReserved2; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
305 volatile uint32_t cRefs;
306 int32_t Reserved;
307 union
308 {
309 struct _VBOXVHWACMD *pNext;
310 uint32_t offNext;
311 uint64_t Data; /* the body is 64-bit aligned */
312 } u;
313 char body[1];
314} VBOXVHWACMD;
315
316#define VBOXVHWACMD_HEADSIZE() (RT_OFFSETOF(VBOXVHWACMD, body))
317#define VBOXVHWACMD_SIZE(_tCmd) (VBOXVHWACMD_HEADSIZE() + sizeof(_tCmd))
318typedef unsigned int VBOXVHWACMD_LENGTH;
319typedef uint64_t VBOXVHWA_SURFHANDLE;
320#define VBOXVHWA_SURFHANDLE_INVALID 0
321#define VBOXVHWACMD_BODY(_p, _t) ((_t*)(_p)->body)
322#define VBOXVHWACMD_HEAD(_pb) ((VBOXVHWACMD*)((uint8_t *)(_pb) - RT_OFFSETOF(VBOXVHWACMD, body)))
323
324typedef struct _VBOXVHWA_RECTL
325{
326 int32_t left;
327 int32_t top;
328 int32_t right;
329 int32_t bottom;
330} VBOXVHWA_RECTL;
331
332typedef struct _VBOXVHWA_COLORKEY
333{
334 uint32_t low;
335 uint32_t high;
336} VBOXVHWA_COLORKEY;
337
338typedef struct _VBOXVHWA_PIXELFORMAT
339{
340 uint32_t flags;
341 uint32_t fourCC;
342 union
343 {
344 uint32_t rgbBitCount;
345 uint32_t yuvBitCount;
346 } c;
347
348 union
349 {
350 uint32_t rgbRBitMask;
351 uint32_t yuvYBitMask;
352 } m1;
353
354 union
355 {
356 uint32_t rgbGBitMask;
357 uint32_t yuvUBitMask;
358 } m2;
359
360 union
361 {
362 uint32_t rgbBBitMask;
363 uint32_t yuvVBitMask;
364 } m3;
365
366 union
367 {
368 uint32_t rgbABitMask;
369 } m4;
370} VBOXVHWA_PIXELFORMAT;
371
372typedef struct _VBOXVHWA_SURFACEDESC
373{
374 uint32_t flags;
375 uint32_t height;
376 uint32_t width;
377 uint32_t pitch;
378 uint32_t sizeX;
379 uint32_t sizeY;
380 uint32_t cBackBuffers;
381 uint32_t Reserved;
382 VBOXVHWA_COLORKEY DstOverlayCK;
383 VBOXVHWA_COLORKEY DstBltCK;
384 VBOXVHWA_COLORKEY SrcOverlayCK;
385 VBOXVHWA_COLORKEY SrcBltCK;
386 VBOXVHWA_PIXELFORMAT PixelFormat;
387 uint32_t surfCaps;
388 uint32_t Reserved2;
389 VBOXVHWA_SURFHANDLE hSurf;
390 uint64_t offSurface;
391} VBOXVHWA_SURFACEDESC;
392
393typedef struct _VBOXVHWA_BLTFX
394{
395 uint32_t flags;
396 uint32_t rop;
397 uint32_t rotationOp;
398 uint32_t rotation;
399 uint32_t fillColor;
400 uint32_t Reserved;
401 VBOXVHWA_COLORKEY DstCK;
402 VBOXVHWA_COLORKEY SrcCK;
403} VBOXVHWA_BLTFX;
404
405typedef struct _VBOXVHWA_OVERLAYFX
406{
407 uint32_t flags;
408 uint32_t Reserved1;
409 uint32_t fxFlags;
410 uint32_t Reserved2;
411 VBOXVHWA_COLORKEY DstCK;
412 VBOXVHWA_COLORKEY SrcCK;
413} VBOXVHWA_OVERLAYFX;
414
415#define VBOXVHWA_CAPS_BLT 0x00000001
416#define VBOXVHWA_CAPS_BLTCOLORFILL 0x00000002
417#define VBOXVHWA_CAPS_BLTFOURCC 0x00000004
418#define VBOXVHWA_CAPS_BLTSTRETCH 0x00000008
419#define VBOXVHWA_CAPS_BLTQUEUE 0x00000010
420
421#define VBOXVHWA_CAPS_OVERLAY 0x00000100
422#define VBOXVHWA_CAPS_OVERLAYFOURCC 0x00000200
423#define VBOXVHWA_CAPS_OVERLAYSTRETCH 0x00000400
424#define VBOXVHWA_CAPS_OVERLAYCANTCLIP 0x00000800
425
426#define VBOXVHWA_CAPS_COLORKEY 0x00010000
427#define VBOXVHWA_CAPS_COLORKEYHWASSIST 0x00020000
428
429
430#define VBOXVHWA_SCAPS_FLIP 0x00000001
431#define VBOXVHWA_SCAPS_PRIMARYSURFACE 0x00000002
432#define VBOXVHWA_SCAPS_OFFSCREENPLAIN 0x00000004
433#define VBOXVHWA_SCAPS_OVERLAY 0x00000008
434#define VBOXVHWA_SCAPS_VISIBLE 0x00000010
435#define VBOXVHWA_SCAPS_VIDEOMEMORY 0x00000020
436#define VBOXVHWA_SCAPS_LOCALVIDMEM 0x00000040
437#define VBOXVHWA_SCAPS_COMPLEX 0x00000080
438
439
440#define VBOXVHWA_PF_RGB 0x00000001
441#define VBOXVHWA_PF_RGBTOYUV 0x00000002
442#define VBOXVHWA_PF_YUV 0x00000008
443#define VBOXVHWA_PF_FOURCC 0x00000010
444
445#define VBOXVHWA_LOCK_DISCARDCONTENTS 0x00000001
446
447#define VBOXVHWA_CFG_ENABLED 0x00000001
448
449#define VBOXVHWA_SD_BACKBUFFERCOUNT 0x00000001
450#define VBOXVHWA_SD_CAPS 0x00000002
451#define VBOXVHWA_SD_CKDESTBLT 0x00000004
452#define VBOXVHWA_SD_CKDESTOVERLAY 0x00000008
453#define VBOXVHWA_SD_CKSRCBLT 0x00000010
454#define VBOXVHWA_SD_CKSRCOVERLAY 0x00000020
455#define VBOXVHWA_SD_HEIGHT 0x00000040
456#define VBOXVHWA_SD_PITCH 0x00000080
457#define VBOXVHWA_SD_PIXELFORMAT 0x00000100
458//#define VBOXVHWA_SD_REFRESHRATE 0x00000200
459#define VBOXVHWA_SD_WIDTH 0x00000400
460
461#define VBOXVHWA_CKEYCAPS_DESTBLT 0x00000001
462#define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACE 0x00000002
463#define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004
464#define VBOXVHWA_CKEYCAPS_DESTBLTYUV 0x00000008
465#define VBOXVHWA_CKEYCAPS_DESTOVERLAY 0x00000010
466#define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020
467#define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040
468#define VBOXVHWA_CKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080
469#define VBOXVHWA_CKEYCAPS_DESTOVERLAYYUV 0x00000100
470#define VBOXVHWA_CKEYCAPS_NOCOSTOVERLAY 0x00000200
471#define VBOXVHWA_CKEYCAPS_SRCBLT 0x00000400
472#define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACE 0x00000800
473#define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACEYUV 0x00001000
474#define VBOXVHWA_CKEYCAPS_SRCBLTYUV 0x00002000
475#define VBOXVHWA_CKEYCAPS_SRCOVERLAY 0x00004000
476#define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACE 0x00008000
477#define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00010000
478#define VBOXVHWA_CKEYCAPS_SRCOVERLAYONEACTIVE 0x00020000
479#define VBOXVHWA_CKEYCAPS_SRCOVERLAYYUV 0x00040000
480
481
482#define VBOXVHWA_BLT_COLORFILL 0x00000400
483#define VBOXVHWA_BLT_DDFX 0x00000800
484#define VBOXVHWA_BLT_EXTENDED_FLAGS 0x40000000
485#define VBOXVHWA_BLT_EXTENDED_LINEAR_CONTENT 0x00000004
486#define VBOXVHWA_BLT_EXTENDED_PRESENTATION_STRETCHFACTOR 0x00000010
487#define VBOXVHWA_BLT_KEYDESTOVERRIDE 0x00004000
488#define VBOXVHWA_BLT_KEYSRCOVERRIDE 0x00010000
489#define VBOXVHWA_BLT_LAST_PRESENTATION 0x20000000
490#define VBOXVHWA_BLT_PRESENTATION 0x10000000
491#define VBOXVHWA_BLT_ROP 0x00020000
492
493
494#define VBOXVHWA_OVER_DDFX 0x00080000
495#define VBOXVHWA_OVER_HIDE 0x00000200
496#define VBOXVHWA_OVER_KEYDEST 0x00000400
497#define VBOXVHWA_OVER_KEYDESTOVERRIDE 0x00000800
498#define VBOXVHWA_OVER_KEYSRC 0x00001000
499#define VBOXVHWA_OVER_KEYSRCOVERRIDE 0x00002000
500#define VBOXVHWA_OVER_SHOW 0x00004000
501
502#define VBOXVHWA_CKEY_COLORSPACE 0x00000001
503#define VBOXVHWA_CKEY_DESTBLT 0x00000002
504#define VBOXVHWA_CKEY_DESTOVERLAY 0x00000004
505#define VBOXVHWA_CKEY_SRCBLT 0x00000008
506#define VBOXVHWA_CKEY_SRCOVERLAY 0x00000010
507
508#define VBOXVHWA_BLT_ARITHSTRETCHY 0x00000001
509#define VBOXVHWA_BLT_MIRRORLEFTRIGHT 0x00000002
510#define VBOXVHWA_BLT_MIRRORUPDOWN 0x00000004
511
512#define VBOXVHWA_OVERFX_ARITHSTRETCHY 0x00000001
513#define VBOXVHWA_OVERFX_MIRRORLEFTRIGHT 0x00000002
514#define VBOXVHWA_OVERFX_MIRRORUPDOWN 0x00000004
515
516#define VBOXVHWA_CAPS2_CANRENDERWINDOWED 0x00080000
517#define VBOXVHWA_CAPS2_WIDESURFACES 0x00001000
518#define VBOXVHWA_CAPS2_COPYFOURCC 0x00008000
519//#define VBOXVHWA_CAPS2_FLIPINTERVAL 0x00200000
520//#define VBOXVHWA_CAPS2_FLIPNOVSYNC 0x00400000
521
522
523#define VBOXVHWA_OFFSET64_VOID (~0L)
524
525typedef struct _VBOXVHWA_VERSION
526{
527 uint32_t maj;
528 uint32_t min;
529 uint32_t bld;
530 uint32_t reserved;
531} VBOXVHWA_VERSION;
532
533typedef struct _VBOXVHWACMD_QUERYINFO1
534{
535 union
536 {
537 struct
538 {
539 VBOXVHWA_VERSION guestVersion;
540 } in;
541
542 struct
543 {
544 uint32_t cfgFlags;
545 uint32_t caps;
546
547 uint32_t caps2;
548 uint32_t colorKeyCaps;
549
550 uint32_t stretchCaps;
551 uint32_t surfaceCaps;
552
553 uint32_t numOverlays;
554 uint32_t curOverlays;
555
556 uint32_t numFourCC;
557 uint32_t reserved;
558 } out;
559 } u;
560} VBOXVHWACMD_QUERYINFO1;
561
562typedef struct _VBOXVHWACMD_QUERYINFO2
563{
564 uint32_t numFourCC;
565 uint32_t FourCC[1];
566} VBOXVHWACMD_QUERYINFO2;
567
568#define VBOXVHWAINFO2_SIZE(_cFourCC) RT_OFFSETOF(VBOXVHWACMD_QUERYINFO2, FourCC[_cFourCC])
569
570typedef struct _VBOXVHWACMD_SURF_CANCREATE
571{
572 VBOXVHWA_SURFACEDESC SurfInfo;
573 union
574 {
575 struct
576 {
577 uint32_t bIsDifferentPixelFormat;
578 uint32_t Reserved;
579 } in;
580
581 struct
582 {
583 uint32_t ErrInfo;
584 } out;
585 } u;
586} VBOXVHWACMD_SURF_CANCREATE;
587
588typedef struct _VBOXVHWACMD_SURF_CREATE
589{
590 VBOXVHWA_SURFACEDESC SurfInfo;
591} VBOXVHWACMD_SURF_CREATE;
592
593typedef struct _VBOXVHWACMD_SURF_DESTROY
594{
595 union
596 {
597 struct
598 {
599 VBOXVHWA_SURFHANDLE hSurf;
600 } in;
601 } u;
602} VBOXVHWACMD_SURF_DESTROY;
603
604typedef struct _VBOXVHWACMD_SURF_LOCK
605{
606 union
607 {
608 struct
609 {
610 VBOXVHWA_SURFHANDLE hSurf;
611 uint64_t offSurface;
612 uint32_t flags;
613 uint32_t rectValid;
614 VBOXVHWA_RECTL rect;
615 } in;
616 } u;
617} VBOXVHWACMD_SURF_LOCK;
618
619typedef struct _VBOXVHWACMD_SURF_UNLOCK
620{
621 union
622 {
623 struct
624 {
625 VBOXVHWA_SURFHANDLE hSurf;
626 uint32_t xUpdatedMemValid;
627 uint32_t reserved;
628 VBOXVHWA_RECTL xUpdatedMemRect;
629 } in;
630 } u;
631} VBOXVHWACMD_SURF_UNLOCK;
632
633typedef struct _VBOXVHWACMD_SURF_BLT
634{
635 uint64_t DstGuestSurfInfo;
636 uint64_t SrcGuestSurfInfo;
637 union
638 {
639 struct
640 {
641 VBOXVHWA_SURFHANDLE hDstSurf;
642 uint64_t offDstSurface;
643 VBOXVHWA_RECTL dstRect;
644 VBOXVHWA_SURFHANDLE hSrcSurf;
645 uint64_t offSrcSurface;
646 VBOXVHWA_RECTL srcRect;
647 uint32_t flags;
648 uint32_t xUpdatedSrcMemValid;
649 VBOXVHWA_BLTFX desc;
650 VBOXVHWA_RECTL xUpdatedSrcMemRect;
651 } in;
652 } u;
653} VBOXVHWACMD_SURF_BLT;
654
655typedef struct _VBOXVHWACMD_SURF_FLIP
656{
657 uint64_t TargGuestSurfInfo;
658 uint64_t CurrGuestSurfInfo;
659 union
660 {
661 struct
662 {
663 VBOXVHWA_SURFHANDLE hTargSurf;
664 uint64_t offTargSurface;
665 VBOXVHWA_SURFHANDLE hCurrSurf;
666 uint64_t offCurrSurface;
667 uint32_t flags;
668 uint32_t xUpdatedTargMemValid;
669 VBOXVHWA_RECTL xUpdatedTargMemRect;
670 } in;
671 } u;
672} VBOXVHWACMD_SURF_FLIP;
673
674typedef struct _VBOXVHWACMD_SURF_COLORKEY_SET
675{
676 union
677 {
678 struct
679 {
680 VBOXVHWA_SURFHANDLE hSurf;
681 uint64_t offSurface;
682 VBOXVHWA_COLORKEY CKey;
683 uint32_t flags;
684 uint32_t reserved;
685 } in;
686 } u;
687} VBOXVHWACMD_SURF_COLORKEY_SET;
688
689typedef struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE
690{
691 union
692 {
693 struct
694 {
695 VBOXVHWA_SURFHANDLE hDstSurf;
696 uint64_t offDstSurface;
697 VBOXVHWA_RECTL dstRect;
698 VBOXVHWA_SURFHANDLE hSrcSurf;
699 uint64_t offSrcSurface;
700 VBOXVHWA_RECTL srcRect;
701 uint32_t flags;
702 uint32_t xUpdatedSrcMemValid;
703 VBOXVHWA_OVERLAYFX desc;
704 VBOXVHWA_RECTL xUpdatedSrcMemRect;
705 } in;
706 } u;
707}VBOXVHWACMD_SURF_OVERLAY_UPDATE;
708
709typedef struct _VBOXVHWACMD_SURF_OVERLAY_SETPOSITION
710{
711 union
712 {
713 struct
714 {
715 VBOXVHWA_SURFHANDLE hDstSurf;
716 uint64_t offDstSurface;
717 VBOXVHWA_SURFHANDLE hSrcSurf;
718 uint64_t offSrcSurface;
719 uint32_t xPos;
720 uint32_t yPos;
721 uint32_t flags;
722 uint32_t reserved;
723 } in;
724 } u;
725} VBOXVHWACMD_SURF_OVERLAY_SETPOSITION;
726
727typedef struct _VBOXVHWACMD_HH_CONSTRUCT
728{
729 void * pVM;
730} VBOXVHWACMD_HH_CONSTRUCT;
731
732#pragma pack()
733# endif /* #ifdef VBOX_WITH_VIDEOHWACCEL */
734
735#ifdef VBOX_WITH_HGSMI
736
737/* All structures are without alignment. */
738#pragma pack(1)
739
740typedef struct _VBVABUFFER
741{
742 uint32_t u32HostEvents;
743 uint32_t u32SupportedOrders;
744
745 /* The offset where the data start in the buffer. */
746 uint32_t off32Data;
747 /* The offset where next data must be placed in the buffer. */
748 uint32_t off32Free;
749
750 /* The queue of record descriptions. */
751 VBVARECORD aRecords[VBVA_MAX_RECORDS];
752 uint32_t indexRecordFirst;
753 uint32_t indexRecordFree;
754
755 /* Space to leave free in the buffer when large partial records are transferred. */
756 uint32_t cbPartialWriteThreshold;
757
758 uint32_t cbData;
759 uint8_t au8Data[1]; /* variable size for the rest of the VBVABUFFER area in VRAM. */
760} VBVABUFFER;
761
762/* guest->host commands */
763#define VBVA_QUERY_CONF32 1
764#define VBVA_SET_CONF32 2
765#define VBVA_INFO_VIEW 3
766#define VBVA_INFO_HEAP 4
767#define VBVA_FLUSH 5
768#define VBVA_INFO_SCREEN 6
769#define VBVA_ENABLE 7
770#define VBVA_MOUSE_POINTER_SHAPE 8
771#ifdef VBOX_WITH_VIDEOHWACCEL
772# define VBVA_VHWA_CMD 9
773#endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
774
775/* host->guest commands */
776# define VBVAHG_EVENT 1
777# define VBVAHG_DISPLAY_CUSTOM 2
778
779# ifdef VBOX_WITH_VIDEOHWACCEL
780#define VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE 1
781#pragma pack(1)
782typedef struct _VBVAHOSTCMDVHWACMDCOMPLETE
783{
784 uint32_t offCmd;
785}VBVAHOSTCMDVHWACMDCOMPLETE;
786#pragma pack()
787# endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
788
789#pragma pack(1)
790typedef enum
791{
792 VBVAHOSTCMD_OP_EVENT = 1,
793 VBVAHOSTCMD_OP_CUSTOM
794}VBVAHOSTCMD_OP_TYPE;
795
796typedef struct _VBVAHOSTCMDEVENT
797{
798 uint64_t pEvent;
799}VBVAHOSTCMDEVENT;
800
801
802typedef struct _VBVAHOSTCMD
803{
804 /* destination ID if >=0 specifies display index, otherwize the command is directed to the miniport */
805 int32_t iDstID;
806 int32_t customOpCode;
807 union
808 {
809 struct _VBVAHOSTCMD *pNext;
810 uint32_t offNext;
811 uint64_t Data; /* the body is 64-bit aligned */
812 } u;
813 char body[1];
814}VBVAHOSTCMD;
815
816#define VBVAHOSTCMD_SIZE(_size) (sizeof(VBVAHOSTCMD) + (_size))
817#define VBVAHOSTCMD_BODY(_pCmd, _tBody) ((_tBody*)(_pCmd)->body)
818#define VBVAHOSTCMD_HDR(_pBody) ((VBVAHOSTCMD*)(((uint8_t*)_pBody) - RT_OFFSETOF(VBVAHOSTCMD, body)))
819#define VBVAHOSTCMD_HDRSIZE (RT_OFFSETOF(VBVAHOSTCMD, body))
820
821#pragma pack()
822
823/* VBVACONF32::u32Index */
824#define VBOX_VBVA_CONF32_MONITOR_COUNT 0
825#define VBOX_VBVA_CONF32_HOST_HEAP_SIZE 1
826
827typedef struct _VBVACONF32
828{
829 uint32_t u32Index;
830 uint32_t u32Value;
831} VBVACONF32;
832
833typedef struct _VBVAINFOVIEW
834{
835 /* Index of the screen, assigned by the guest. */
836 uint32_t u32ViewIndex;
837
838 /* The screen offset in VRAM, the framebuffer starts here. */
839 uint32_t u32ViewOffset;
840
841 /* The size of the VRAM memory that can be used for the view. */
842 uint32_t u32ViewSize;
843
844 /* The recommended maximum size of the VRAM memory for the screen. */
845 uint32_t u32MaxScreenSize;
846} VBVAINFOVIEW;
847
848typedef struct _VBVAINFOHEAP
849{
850 /* Absolute offset in VRAM of the start of the heap. */
851 uint32_t u32HeapOffset;
852
853 /* The size of the heap. */
854 uint32_t u32HeapSize;
855
856} VBVAINFOHEAP;
857
858typedef struct _VBVAFLUSH
859{
860 uint32_t u32Reserved;
861
862} VBVAFLUSH;
863
864/* VBVAINFOSCREEN::u8Flags */
865#define VBVA_SCREEN_F_NONE 0x0000
866#define VBVA_SCREEN_F_ACTIVE 0x0001
867
868typedef struct _VBVAINFOSCREEN
869{
870 /* Which view contains the screen. */
871 uint32_t u32ViewIndex;
872
873 /* Physical X origin relative to the primary screen. */
874 int32_t i32OriginX;
875
876 /* Physical Y origin relative to the primary screen. */
877 int32_t i32OriginY;
878
879 /* The scan line size in bytes. */
880 uint32_t u32LineSize;
881
882 /* Width of the screen. */
883 uint32_t u32Width;
884
885 /* Height of the screen. */
886 uint32_t u32Height;
887
888 /* Color depth. */
889 uint16_t u16BitsPerPixel;
890
891 /* VBVA_SCREEN_F_* */
892 uint16_t u16Flags;
893} VBVAINFOSCREEN;
894
895
896/* VBVAENABLE::u32Flags */
897#define VBVA_F_NONE 0x00000000
898#define VBVA_F_ENABLE 0x00000001
899#define VBVA_F_DISABLE 0x00000002
900
901typedef struct _VBVAENABLE
902{
903 uint32_t u32Flags;
904 uint32_t u32Offset;
905
906} VBVAENABLE;
907
908typedef struct _VBVAMOUSEPOINTERSHAPE
909{
910 /* The host result. */
911 uint32_t u32Result;
912
913 /* VBOX_MOUSE_POINTER_* bit flags. */
914 uint32_t fu32Flags;
915
916 /* X coordinate of the hot spot. */
917 uint32_t u32HotX;
918
919 /* Y coordinate of the hot spot. */
920 uint32_t u32HotY;
921
922 /* Width of the pointer in pixels. */
923 uint32_t u32Width;
924
925 /* Height of the pointer in scanlines. */
926 uint32_t u32Height;
927
928 /* Pointer data.
929 *
930 ****
931 * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
932 *
933 * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
934 * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
935 *
936 * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
937 * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
938 * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
939 *
940 * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
941 * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
942 * end of any scanline are undefined.
943 *
944 * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
945 * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
946 * Bytes in the gap between the AND and the XOR mask are undefined.
947 * XOR mask scanlines have no gap between them and size of XOR mask is:
948 * cXor = width * 4 * height.
949 ****
950 *
951 * Preallocate 4 bytes for accessing actual data as p->au8Data.
952 */
953 uint8_t au8Data[4];
954
955} VBVAMOUSEPOINTERSHAPE;
956
957#pragma pack()
958
959#endif /* VBOX_WITH_HGSMI */
960
961#endif
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