VirtualBox

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

Last change on this file since 24642 was 24164, checked in by vboxsync, 15 years ago

burn fix

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 28.1 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#ifdef VBOX_WITH_HGSMI
37#include <VBox/VMMDev.h>
38#endif /* VBOX_WITH_HGSMI */
39
40/*
41 * The last 4096 bytes of the guest VRAM contains the generic info for all
42 * DualView chunks: sizes and offsets of chunks. This is filled by miniport.
43 *
44 * Last 4096 bytes of each chunk contain chunk specific data: framebuffer info,
45 * etc. This is used exclusively by the corresponding instance of a display driver.
46 *
47 * The VRAM layout:
48 * Last 4096 bytes - Adapter information area.
49 * 4096 bytes aligned miniport heap (value specified in the config rouded up).
50 * Slack - what left after dividing the VRAM.
51 * 4096 bytes aligned framebuffers:
52 * last 4096 bytes of each framebuffer is the display information area.
53 *
54 * The Virtual Graphics Adapter information in the guest VRAM is stored by the
55 * guest video driver using structures prepended by VBOXVIDEOINFOHDR.
56 *
57 * When the guest driver writes dword 0 to the VBE_DISPI_INDEX_VBOX_VIDEO
58 * the host starts to process the info. The first element at the start of
59 * the 4096 bytes region should be normally be a LINK that points to
60 * actual information chain. That way the guest driver can have some
61 * fixed layout of the information memory block and just rewrite
62 * the link to point to relevant memory chain.
63 *
64 * The processing stops at the END element.
65 *
66 * The host can access the memory only when the port IO is processed.
67 * All data that will be needed later must be copied from these 4096 bytes.
68 * But other VRAM can be used by host until the mode is disabled.
69 *
70 * The guest driver writes dword 0xffffffff to the VBE_DISPI_INDEX_VBOX_VIDEO
71 * to disable the mode.
72 *
73 * VBE_DISPI_INDEX_VBOX_VIDEO is used to read the configuration information
74 * from the host and issue commands to the host.
75 *
76 * The guest writes the VBE_DISPI_INDEX_VBOX_VIDEO index register, the the
77 * following operations with the VBE data register can be performed:
78 *
79 * Operation Result
80 * write 16 bit value NOP
81 * read 16 bit value count of monitors
82 * write 32 bit value sets the vbox command value and the command processed by the host
83 * read 32 bit value result of the last vbox command is returned
84 */
85
86#define VBOX_VIDEO_PRIMARY_SCREEN 0
87#define VBOX_VIDEO_NO_SCREEN ~0
88
89#define VBOX_VIDEO_MAX_SCREENS 64
90
91/* The size of the information. */
92#ifndef VBOX_WITH_HGSMI
93#define VBOX_VIDEO_ADAPTER_INFORMATION_SIZE 4096
94#define VBOX_VIDEO_DISPLAY_INFORMATION_SIZE 4096
95#else
96/*
97 * The minimum HGSMI heap size is PAGE_SIZE (4096 bytes) and is a restriction of the
98 * runtime heapsimple API. Use minimum 2 pages here, because the info area also may
99 * contain other data (for example HGSMIHOSTFLAGS structure).
100 */
101#define VBVA_ADAPTER_INFORMATION_SIZE (8*_1K)
102#define VBVA_DISPLAY_INFORMATION_SIZE (8*_1K)
103#define VBVA_MIN_BUFFER_SIZE (64*_1K)
104#endif /* VBOX_WITH_HGSMI */
105
106
107/* The value for port IO to let the adapter to interpret the adapter memory. */
108#define VBOX_VIDEO_DISABLE_ADAPTER_MEMORY 0xFFFFFFFF
109
110/* The value for port IO to let the adapter to interpret the adapter memory. */
111#define VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY 0x00000000
112
113/* The value for port IO to let the adapter to interpret the display memory.
114 * The display number is encoded in low 16 bits.
115 */
116#define VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE 0x00010000
117
118
119/* The end of the information. */
120#define VBOX_VIDEO_INFO_TYPE_END 0
121/* Instructs the host to fetch the next VBOXVIDEOINFOHDR at the given offset of VRAM. */
122#define VBOX_VIDEO_INFO_TYPE_LINK 1
123/* Information about a display memory position. */
124#define VBOX_VIDEO_INFO_TYPE_DISPLAY 2
125/* Information about a screen. */
126#define VBOX_VIDEO_INFO_TYPE_SCREEN 3
127/* Information about host notifications for the driver. */
128#define VBOX_VIDEO_INFO_TYPE_HOST_EVENTS 4
129/* Information about non-volatile guest VRAM heap. */
130#define VBOX_VIDEO_INFO_TYPE_NV_HEAP 5
131/* VBVA enable/disable. */
132#define VBOX_VIDEO_INFO_TYPE_VBVA_STATUS 6
133/* VBVA flush. */
134#define VBOX_VIDEO_INFO_TYPE_VBVA_FLUSH 7
135/* Query configuration value. */
136#define VBOX_VIDEO_INFO_TYPE_QUERY_CONF32 8
137
138
139#pragma pack(1)
140typedef struct _VBOXVIDEOINFOHDR
141{
142 uint8_t u8Type;
143 uint8_t u8Reserved;
144 uint16_t u16Length;
145} VBOXVIDEOINFOHDR;
146
147
148typedef struct _VBOXVIDEOINFOLINK
149{
150 /* Relative offset in VRAM */
151 int32_t i32Offset;
152} VBOXVIDEOINFOLINK;
153
154
155/* Resides in adapter info memory. Describes a display VRAM chunk. */
156typedef struct _VBOXVIDEOINFODISPLAY
157{
158 /* Index of the framebuffer assigned by guest. */
159 uint32_t u32Index;
160
161 /* Absolute offset in VRAM of the framebuffer to be displayed on the monitor. */
162 uint32_t u32Offset;
163
164 /* The size of the memory that can be used for the screen. */
165 uint32_t u32FramebufferSize;
166
167 /* The size of the memory that is used for the Display information.
168 * The information is at u32Offset + u32FramebufferSize
169 */
170 uint32_t u32InformationSize;
171
172} VBOXVIDEOINFODISPLAY;
173
174
175/* Resides in display info area, describes the current video mode. */
176#define VBOX_VIDEO_INFO_SCREEN_F_NONE 0x00
177#define VBOX_VIDEO_INFO_SCREEN_F_ACTIVE 0x01
178
179typedef struct _VBOXVIDEOINFOSCREEN
180{
181 /* Physical X origin relative to the primary screen. */
182 int32_t xOrigin;
183
184 /* Physical Y origin relative to the primary screen. */
185 int32_t yOrigin;
186
187 /* The scan line size in bytes. */
188 uint32_t u32LineSize;
189
190 /* Width of the screen. */
191 uint16_t u16Width;
192
193 /* Height of the screen. */
194 uint16_t u16Height;
195
196 /* Color depth. */
197 uint8_t bitsPerPixel;
198
199 /* VBOX_VIDEO_INFO_SCREEN_F_* */
200 uint8_t u8Flags;
201} VBOXVIDEOINFOSCREEN;
202
203/* The guest initializes the structure to 0. The positions of the structure in the
204 * display info area must not be changed, host will update the structure. Guest checks
205 * the events and modifies the structure as a response to host.
206 */
207#define VBOX_VIDEO_INFO_HOST_EVENTS_F_NONE 0x00000000
208#define VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET 0x00000080
209
210typedef struct _VBOXVIDEOINFOHOSTEVENTS
211{
212 /* Host events. */
213 uint32_t fu32Events;
214} VBOXVIDEOINFOHOSTEVENTS;
215
216/* Resides in adapter info memory. Describes the non-volatile VRAM heap. */
217typedef struct _VBOXVIDEOINFONVHEAP
218{
219 /* Absolute offset in VRAM of the start of the heap. */
220 uint32_t u32HeapOffset;
221
222 /* The size of the heap. */
223 uint32_t u32HeapSize;
224
225} VBOXVIDEOINFONVHEAP;
226
227/* Display information area. */
228typedef struct _VBOXVIDEOINFOVBVASTATUS
229{
230 /* Absolute offset in VRAM of the start of the VBVA QUEUE. 0 to disable VBVA. */
231 uint32_t u32QueueOffset;
232
233 /* The size of the VBVA QUEUE. 0 to disable VBVA. */
234 uint32_t u32QueueSize;
235
236} VBOXVIDEOINFOVBVASTATUS;
237
238typedef struct _VBOXVIDEOINFOVBVAFLUSH
239{
240 uint32_t u32DataStart;
241
242 uint32_t u32DataEnd;
243
244} VBOXVIDEOINFOVBVAFLUSH;
245
246#define VBOX_VIDEO_QCI32_MONITOR_COUNT 0
247#define VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE 1
248
249typedef struct _VBOXVIDEOINFOQUERYCONF32
250{
251 uint32_t u32Index;
252
253 uint32_t u32Value;
254
255} VBOXVIDEOINFOQUERYCONF32;
256#pragma pack()
257
258# ifdef VBOX_WITH_VIDEOHWACCEL
259#pragma pack(1)
260
261#define VBOXVHWA_VERSION_MAJ 0
262#define VBOXVHWA_VERSION_MIN 0
263#define VBOXVHWA_VERSION_BLD 3
264#define VBOXVHWA_VERSION_RSV 0
265
266typedef enum
267{
268 VBOXVHWACMD_TYPE_SURF_CANCREATE = 1,
269 VBOXVHWACMD_TYPE_SURF_CREATE,
270 VBOXVHWACMD_TYPE_SURF_DESTROY,
271 VBOXVHWACMD_TYPE_SURF_LOCK,
272 VBOXVHWACMD_TYPE_SURF_UNLOCK,
273 VBOXVHWACMD_TYPE_SURF_BLT,
274 VBOXVHWACMD_TYPE_SURF_FLIP,
275 VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE,
276 VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION,
277 VBOXVHWACMD_TYPE_SURF_COLORKEY_SET,
278 VBOXVHWACMD_TYPE_QUERY_INFO1,
279 VBOXVHWACMD_TYPE_QUERY_INFO2,
280 VBOXVHWACMD_TYPE_ENABLE,
281 VBOXVHWACMD_TYPE_DISABLE,
282 VBOXVHWACMD_TYPE_HH_CONSTRUCT,
283 VBOXVHWACMD_TYPE_HH_RESET
284} VBOXVHWACMD_TYPE;
285
286/* the command processing was asynch, set by the host to indicate asynch command completion
287 * must not be cleared once set, the command completion is performed by issuing a host->guest completion command
288 * while keeping this flag unchanged */
289#define VBOXVHWACMD_FLAG_HG_ASYNCH 0x00010000
290/* asynch completion is performed by issuing the event */
291#define VBOXVHWACMD_FLAG_GH_ASYNCH_EVENT 0x00000001
292/* issue interrupt on asynch completion */
293#define VBOXVHWACMD_FLAG_GH_ASYNCH_IRQ 0x00000002
294/* 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
295 * by setting the VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED flag */
296#define VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION 0x00000004
297/* the host has copied the VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION command and returned it to the guest */
298#define VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED 0x00020000
299/* this is the host->host cmd, i.e. a configuration command posted by the host to the framebuffer */
300#define VBOXVHWACMD_FLAG_HH_CMD 0x10000000
301
302typedef struct _VBOXVHWACMD
303{
304 VBOXVHWACMD_TYPE enmCmd; /* command type */
305 volatile int32_t rc; /* command result */
306 int32_t iDisplay; /* display index */
307 volatile int32_t Flags; /* ored VBOXVHWACMD_FLAG_xxx values */
308 uint64_t GuestVBVAReserved1; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
309 uint64_t GuestVBVAReserved2; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
310 volatile uint32_t cRefs;
311 int32_t Reserved;
312 union
313 {
314 struct _VBOXVHWACMD *pNext;
315 uint32_t offNext;
316 uint64_t Data; /* the body is 64-bit aligned */
317 } u;
318 char body[1];
319} VBOXVHWACMD;
320
321#define VBOXVHWACMD_HEADSIZE() (RT_OFFSETOF(VBOXVHWACMD, body))
322#define VBOXVHWACMD_SIZE(_tCmd) (VBOXVHWACMD_HEADSIZE() + sizeof(_tCmd))
323typedef unsigned int VBOXVHWACMD_LENGTH;
324typedef uint64_t VBOXVHWA_SURFHANDLE;
325#define VBOXVHWA_SURFHANDLE_INVALID 0
326#define VBOXVHWACMD_BODY(_p, _t) ((_t*)(_p)->body)
327#define VBOXVHWACMD_HEAD(_pb) ((VBOXVHWACMD*)((uint8_t *)(_pb) - RT_OFFSETOF(VBOXVHWACMD, body)))
328
329typedef struct _VBOXVHWA_RECTL
330{
331 int32_t left;
332 int32_t top;
333 int32_t right;
334 int32_t bottom;
335} VBOXVHWA_RECTL;
336
337typedef struct _VBOXVHWA_COLORKEY
338{
339 uint32_t low;
340 uint32_t high;
341} VBOXVHWA_COLORKEY;
342
343typedef struct _VBOXVHWA_PIXELFORMAT
344{
345 uint32_t flags;
346 uint32_t fourCC;
347 union
348 {
349 uint32_t rgbBitCount;
350 uint32_t yuvBitCount;
351 } c;
352
353 union
354 {
355 uint32_t rgbRBitMask;
356 uint32_t yuvYBitMask;
357 } m1;
358
359 union
360 {
361 uint32_t rgbGBitMask;
362 uint32_t yuvUBitMask;
363 } m2;
364
365 union
366 {
367 uint32_t rgbBBitMask;
368 uint32_t yuvVBitMask;
369 } m3;
370
371 union
372 {
373 uint32_t rgbABitMask;
374 } m4;
375} VBOXVHWA_PIXELFORMAT;
376
377typedef struct _VBOXVHWA_SURFACEDESC
378{
379 uint32_t flags;
380 uint32_t height;
381 uint32_t width;
382 uint32_t pitch;
383 uint32_t sizeX;
384 uint32_t sizeY;
385 uint32_t cBackBuffers;
386 uint32_t Reserved;
387 VBOXVHWA_COLORKEY DstOverlayCK;
388 VBOXVHWA_COLORKEY DstBltCK;
389 VBOXVHWA_COLORKEY SrcOverlayCK;
390 VBOXVHWA_COLORKEY SrcBltCK;
391 VBOXVHWA_PIXELFORMAT PixelFormat;
392 uint32_t surfCaps;
393 uint32_t Reserved2;
394 VBOXVHWA_SURFHANDLE hSurf;
395 uint64_t offSurface;
396} VBOXVHWA_SURFACEDESC;
397
398typedef struct _VBOXVHWA_BLTFX
399{
400 uint32_t flags;
401 uint32_t rop;
402 uint32_t rotationOp;
403 uint32_t rotation;
404 uint32_t fillColor;
405 uint32_t Reserved;
406 VBOXVHWA_COLORKEY DstCK;
407 VBOXVHWA_COLORKEY SrcCK;
408} VBOXVHWA_BLTFX;
409
410typedef struct _VBOXVHWA_OVERLAYFX
411{
412 uint32_t flags;
413 uint32_t Reserved1;
414 uint32_t fxFlags;
415 uint32_t Reserved2;
416 VBOXVHWA_COLORKEY DstCK;
417 VBOXVHWA_COLORKEY SrcCK;
418} VBOXVHWA_OVERLAYFX;
419
420#define VBOXVHWA_CAPS_BLT 0x00000001
421#define VBOXVHWA_CAPS_BLTCOLORFILL 0x00000002
422#define VBOXVHWA_CAPS_BLTFOURCC 0x00000004
423#define VBOXVHWA_CAPS_BLTSTRETCH 0x00000008
424#define VBOXVHWA_CAPS_BLTQUEUE 0x00000010
425
426#define VBOXVHWA_CAPS_OVERLAY 0x00000100
427#define VBOXVHWA_CAPS_OVERLAYFOURCC 0x00000200
428#define VBOXVHWA_CAPS_OVERLAYSTRETCH 0x00000400
429#define VBOXVHWA_CAPS_OVERLAYCANTCLIP 0x00000800
430
431#define VBOXVHWA_CAPS_COLORKEY 0x00010000
432#define VBOXVHWA_CAPS_COLORKEYHWASSIST 0x00020000
433
434
435#define VBOXVHWA_SCAPS_FLIP 0x00000001
436#define VBOXVHWA_SCAPS_PRIMARYSURFACE 0x00000002
437#define VBOXVHWA_SCAPS_OFFSCREENPLAIN 0x00000004
438#define VBOXVHWA_SCAPS_OVERLAY 0x00000008
439#define VBOXVHWA_SCAPS_VISIBLE 0x00000010
440#define VBOXVHWA_SCAPS_VIDEOMEMORY 0x00000020
441#define VBOXVHWA_SCAPS_LOCALVIDMEM 0x00000040
442#define VBOXVHWA_SCAPS_COMPLEX 0x00000080
443
444
445#define VBOXVHWA_PF_RGB 0x00000001
446#define VBOXVHWA_PF_RGBTOYUV 0x00000002
447#define VBOXVHWA_PF_YUV 0x00000008
448#define VBOXVHWA_PF_FOURCC 0x00000010
449
450#define VBOXVHWA_LOCK_DISCARDCONTENTS 0x00000001
451
452#define VBOXVHWA_CFG_ENABLED 0x00000001
453
454#define VBOXVHWA_SD_BACKBUFFERCOUNT 0x00000001
455#define VBOXVHWA_SD_CAPS 0x00000002
456#define VBOXVHWA_SD_CKDESTBLT 0x00000004
457#define VBOXVHWA_SD_CKDESTOVERLAY 0x00000008
458#define VBOXVHWA_SD_CKSRCBLT 0x00000010
459#define VBOXVHWA_SD_CKSRCOVERLAY 0x00000020
460#define VBOXVHWA_SD_HEIGHT 0x00000040
461#define VBOXVHWA_SD_PITCH 0x00000080
462#define VBOXVHWA_SD_PIXELFORMAT 0x00000100
463//#define VBOXVHWA_SD_REFRESHRATE 0x00000200
464#define VBOXVHWA_SD_WIDTH 0x00000400
465
466#define VBOXVHWA_CKEYCAPS_DESTBLT 0x00000001
467#define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACE 0x00000002
468#define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004
469#define VBOXVHWA_CKEYCAPS_DESTBLTYUV 0x00000008
470#define VBOXVHWA_CKEYCAPS_DESTOVERLAY 0x00000010
471#define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020
472#define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040
473#define VBOXVHWA_CKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080
474#define VBOXVHWA_CKEYCAPS_DESTOVERLAYYUV 0x00000100
475#define VBOXVHWA_CKEYCAPS_NOCOSTOVERLAY 0x00000200
476#define VBOXVHWA_CKEYCAPS_SRCBLT 0x00000400
477#define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACE 0x00000800
478#define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACEYUV 0x00001000
479#define VBOXVHWA_CKEYCAPS_SRCBLTYUV 0x00002000
480#define VBOXVHWA_CKEYCAPS_SRCOVERLAY 0x00004000
481#define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACE 0x00008000
482#define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00010000
483#define VBOXVHWA_CKEYCAPS_SRCOVERLAYONEACTIVE 0x00020000
484#define VBOXVHWA_CKEYCAPS_SRCOVERLAYYUV 0x00040000
485
486
487#define VBOXVHWA_BLT_COLORFILL 0x00000400
488#define VBOXVHWA_BLT_DDFX 0x00000800
489#define VBOXVHWA_BLT_EXTENDED_FLAGS 0x40000000
490#define VBOXVHWA_BLT_EXTENDED_LINEAR_CONTENT 0x00000004
491#define VBOXVHWA_BLT_EXTENDED_PRESENTATION_STRETCHFACTOR 0x00000010
492#define VBOXVHWA_BLT_KEYDESTOVERRIDE 0x00004000
493#define VBOXVHWA_BLT_KEYSRCOVERRIDE 0x00010000
494#define VBOXVHWA_BLT_LAST_PRESENTATION 0x20000000
495#define VBOXVHWA_BLT_PRESENTATION 0x10000000
496#define VBOXVHWA_BLT_ROP 0x00020000
497
498
499#define VBOXVHWA_OVER_DDFX 0x00080000
500#define VBOXVHWA_OVER_HIDE 0x00000200
501#define VBOXVHWA_OVER_KEYDEST 0x00000400
502#define VBOXVHWA_OVER_KEYDESTOVERRIDE 0x00000800
503#define VBOXVHWA_OVER_KEYSRC 0x00001000
504#define VBOXVHWA_OVER_KEYSRCOVERRIDE 0x00002000
505#define VBOXVHWA_OVER_SHOW 0x00004000
506
507#define VBOXVHWA_CKEY_COLORSPACE 0x00000001
508#define VBOXVHWA_CKEY_DESTBLT 0x00000002
509#define VBOXVHWA_CKEY_DESTOVERLAY 0x00000004
510#define VBOXVHWA_CKEY_SRCBLT 0x00000008
511#define VBOXVHWA_CKEY_SRCOVERLAY 0x00000010
512
513#define VBOXVHWA_BLT_ARITHSTRETCHY 0x00000001
514#define VBOXVHWA_BLT_MIRRORLEFTRIGHT 0x00000002
515#define VBOXVHWA_BLT_MIRRORUPDOWN 0x00000004
516
517#define VBOXVHWA_OVERFX_ARITHSTRETCHY 0x00000001
518#define VBOXVHWA_OVERFX_MIRRORLEFTRIGHT 0x00000002
519#define VBOXVHWA_OVERFX_MIRRORUPDOWN 0x00000004
520
521#define VBOXVHWA_CAPS2_CANRENDERWINDOWED 0x00080000
522#define VBOXVHWA_CAPS2_WIDESURFACES 0x00001000
523#define VBOXVHWA_CAPS2_COPYFOURCC 0x00008000
524//#define VBOXVHWA_CAPS2_FLIPINTERVAL 0x00200000
525//#define VBOXVHWA_CAPS2_FLIPNOVSYNC 0x00400000
526
527
528#define VBOXVHWA_OFFSET64_VOID (UINT64_MAX)
529
530typedef struct _VBOXVHWA_VERSION
531{
532 uint32_t maj;
533 uint32_t min;
534 uint32_t bld;
535 uint32_t reserved;
536} VBOXVHWA_VERSION;
537
538typedef struct _VBOXVHWACMD_QUERYINFO1
539{
540 union
541 {
542 struct
543 {
544 VBOXVHWA_VERSION guestVersion;
545 } in;
546
547 struct
548 {
549 uint32_t cfgFlags;
550 uint32_t caps;
551
552 uint32_t caps2;
553 uint32_t colorKeyCaps;
554
555 uint32_t stretchCaps;
556 uint32_t surfaceCaps;
557
558 uint32_t numOverlays;
559 uint32_t curOverlays;
560
561 uint32_t numFourCC;
562 uint32_t reserved;
563 } out;
564 } u;
565} VBOXVHWACMD_QUERYINFO1;
566
567typedef struct _VBOXVHWACMD_QUERYINFO2
568{
569 uint32_t numFourCC;
570 uint32_t FourCC[1];
571} VBOXVHWACMD_QUERYINFO2;
572
573#define VBOXVHWAINFO2_SIZE(_cFourCC) RT_OFFSETOF(VBOXVHWACMD_QUERYINFO2, FourCC[_cFourCC])
574
575typedef struct _VBOXVHWACMD_SURF_CANCREATE
576{
577 VBOXVHWA_SURFACEDESC SurfInfo;
578 union
579 {
580 struct
581 {
582 uint32_t bIsDifferentPixelFormat;
583 uint32_t Reserved;
584 } in;
585
586 struct
587 {
588 int32_t ErrInfo;
589 } out;
590 } u;
591} VBOXVHWACMD_SURF_CANCREATE;
592
593typedef struct _VBOXVHWACMD_SURF_CREATE
594{
595 VBOXVHWA_SURFACEDESC SurfInfo;
596} VBOXVHWACMD_SURF_CREATE;
597
598typedef struct _VBOXVHWACMD_SURF_DESTROY
599{
600 union
601 {
602 struct
603 {
604 VBOXVHWA_SURFHANDLE hSurf;
605 } in;
606 } u;
607} VBOXVHWACMD_SURF_DESTROY;
608
609typedef struct _VBOXVHWACMD_SURF_LOCK
610{
611 union
612 {
613 struct
614 {
615 VBOXVHWA_SURFHANDLE hSurf;
616 uint64_t offSurface;
617 uint32_t flags;
618 uint32_t rectValid;
619 VBOXVHWA_RECTL rect;
620 } in;
621 } u;
622} VBOXVHWACMD_SURF_LOCK;
623
624typedef struct _VBOXVHWACMD_SURF_UNLOCK
625{
626 union
627 {
628 struct
629 {
630 VBOXVHWA_SURFHANDLE hSurf;
631 uint32_t xUpdatedMemValid;
632 uint32_t reserved;
633 VBOXVHWA_RECTL xUpdatedMemRect;
634 } in;
635 } u;
636} VBOXVHWACMD_SURF_UNLOCK;
637
638typedef struct _VBOXVHWACMD_SURF_BLT
639{
640 uint64_t DstGuestSurfInfo;
641 uint64_t SrcGuestSurfInfo;
642 union
643 {
644 struct
645 {
646 VBOXVHWA_SURFHANDLE hDstSurf;
647 uint64_t offDstSurface;
648 VBOXVHWA_RECTL dstRect;
649 VBOXVHWA_SURFHANDLE hSrcSurf;
650 uint64_t offSrcSurface;
651 VBOXVHWA_RECTL srcRect;
652 uint32_t flags;
653 uint32_t xUpdatedSrcMemValid;
654 VBOXVHWA_BLTFX desc;
655 VBOXVHWA_RECTL xUpdatedSrcMemRect;
656 } in;
657 } u;
658} VBOXVHWACMD_SURF_BLT;
659
660typedef struct _VBOXVHWACMD_SURF_FLIP
661{
662 uint64_t TargGuestSurfInfo;
663 uint64_t CurrGuestSurfInfo;
664 union
665 {
666 struct
667 {
668 VBOXVHWA_SURFHANDLE hTargSurf;
669 uint64_t offTargSurface;
670 VBOXVHWA_SURFHANDLE hCurrSurf;
671 uint64_t offCurrSurface;
672 uint32_t flags;
673 uint32_t xUpdatedTargMemValid;
674 VBOXVHWA_RECTL xUpdatedTargMemRect;
675 } in;
676 } u;
677} VBOXVHWACMD_SURF_FLIP;
678
679typedef struct _VBOXVHWACMD_SURF_COLORKEY_SET
680{
681 union
682 {
683 struct
684 {
685 VBOXVHWA_SURFHANDLE hSurf;
686 uint64_t offSurface;
687 VBOXVHWA_COLORKEY CKey;
688 uint32_t flags;
689 uint32_t reserved;
690 } in;
691 } u;
692} VBOXVHWACMD_SURF_COLORKEY_SET;
693
694typedef struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE
695{
696 union
697 {
698 struct
699 {
700 VBOXVHWA_SURFHANDLE hDstSurf;
701 uint64_t offDstSurface;
702 VBOXVHWA_RECTL dstRect;
703 VBOXVHWA_SURFHANDLE hSrcSurf;
704 uint64_t offSrcSurface;
705 VBOXVHWA_RECTL srcRect;
706 uint32_t flags;
707 uint32_t xUpdatedSrcMemValid;
708 VBOXVHWA_OVERLAYFX desc;
709 VBOXVHWA_RECTL xUpdatedSrcMemRect;
710 } in;
711 } u;
712}VBOXVHWACMD_SURF_OVERLAY_UPDATE;
713
714typedef struct _VBOXVHWACMD_SURF_OVERLAY_SETPOSITION
715{
716 union
717 {
718 struct
719 {
720 VBOXVHWA_SURFHANDLE hDstSurf;
721 uint64_t offDstSurface;
722 VBOXVHWA_SURFHANDLE hSrcSurf;
723 uint64_t offSrcSurface;
724 uint32_t xPos;
725 uint32_t yPos;
726 uint32_t flags;
727 uint32_t reserved;
728 } in;
729 } u;
730} VBOXVHWACMD_SURF_OVERLAY_SETPOSITION;
731
732typedef struct _VBOXVHWACMD_HH_CONSTRUCT
733{
734 void * pVM;
735} VBOXVHWACMD_HH_CONSTRUCT;
736
737#pragma pack()
738# endif /* #ifdef VBOX_WITH_VIDEOHWACCEL */
739
740#ifdef VBOX_WITH_HGSMI
741
742/* All structures are without alignment. */
743#pragma pack(1)
744
745typedef struct _VBVABUFFER
746{
747 uint32_t u32HostEvents;
748 uint32_t u32SupportedOrders;
749
750 /* The offset where the data start in the buffer. */
751 uint32_t off32Data;
752 /* The offset where next data must be placed in the buffer. */
753 uint32_t off32Free;
754
755 /* The queue of record descriptions. */
756 VBVARECORD aRecords[VBVA_MAX_RECORDS];
757 uint32_t indexRecordFirst;
758 uint32_t indexRecordFree;
759
760 /* Space to leave free in the buffer when large partial records are transferred. */
761 uint32_t cbPartialWriteThreshold;
762
763 uint32_t cbData;
764 uint8_t au8Data[1]; /* variable size for the rest of the VBVABUFFER area in VRAM. */
765} VBVABUFFER;
766
767/* guest->host commands */
768#define VBVA_QUERY_CONF32 1
769#define VBVA_SET_CONF32 2
770#define VBVA_INFO_VIEW 3
771#define VBVA_INFO_HEAP 4
772#define VBVA_FLUSH 5
773#define VBVA_INFO_SCREEN 6
774#define VBVA_ENABLE 7
775#define VBVA_MOUSE_POINTER_SHAPE 8
776#ifdef VBOX_WITH_VIDEOHWACCEL
777# define VBVA_VHWA_CMD 9
778#endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
779
780/* host->guest commands */
781# define VBVAHG_EVENT 1
782# define VBVAHG_DISPLAY_CUSTOM 2
783
784# ifdef VBOX_WITH_VIDEOHWACCEL
785#define VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE 1
786#pragma pack(1)
787typedef struct _VBVAHOSTCMDVHWACMDCOMPLETE
788{
789 uint32_t offCmd;
790}VBVAHOSTCMDVHWACMDCOMPLETE;
791#pragma pack()
792# endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
793
794#pragma pack(1)
795typedef enum
796{
797 VBVAHOSTCMD_OP_EVENT = 1,
798 VBVAHOSTCMD_OP_CUSTOM
799}VBVAHOSTCMD_OP_TYPE;
800
801typedef struct _VBVAHOSTCMDEVENT
802{
803 uint64_t pEvent;
804}VBVAHOSTCMDEVENT;
805
806
807typedef struct _VBVAHOSTCMD
808{
809 /* destination ID if >=0 specifies display index, otherwize the command is directed to the miniport */
810 int32_t iDstID;
811 int32_t customOpCode;
812 union
813 {
814 struct _VBVAHOSTCMD *pNext;
815 uint32_t offNext;
816 uint64_t Data; /* the body is 64-bit aligned */
817 } u;
818 char body[1];
819}VBVAHOSTCMD;
820
821#define VBVAHOSTCMD_SIZE(_size) (sizeof(VBVAHOSTCMD) + (_size))
822#define VBVAHOSTCMD_BODY(_pCmd, _tBody) ((_tBody*)(_pCmd)->body)
823#define VBVAHOSTCMD_HDR(_pBody) ((VBVAHOSTCMD*)(((uint8_t*)_pBody) - RT_OFFSETOF(VBVAHOSTCMD, body)))
824#define VBVAHOSTCMD_HDRSIZE (RT_OFFSETOF(VBVAHOSTCMD, body))
825
826#pragma pack()
827
828/* VBVACONF32::u32Index */
829#define VBOX_VBVA_CONF32_MONITOR_COUNT 0
830#define VBOX_VBVA_CONF32_HOST_HEAP_SIZE 1
831
832typedef struct _VBVACONF32
833{
834 uint32_t u32Index;
835 uint32_t u32Value;
836} VBVACONF32;
837
838typedef struct VBVAINFOVIEW
839{
840 /* Index of the screen, assigned by the guest. */
841 uint32_t u32ViewIndex;
842
843 /* The screen offset in VRAM, the framebuffer starts here. */
844 uint32_t u32ViewOffset;
845
846 /* The size of the VRAM memory that can be used for the view. */
847 uint32_t u32ViewSize;
848
849 /* The recommended maximum size of the VRAM memory for the screen. */
850 uint32_t u32MaxScreenSize;
851} VBVAINFOVIEW;
852
853typedef struct _VBVAINFOHEAP
854{
855 /* Absolute offset in VRAM of the start of the heap. */
856 uint32_t u32HeapOffset;
857
858 /* The size of the heap. */
859 uint32_t u32HeapSize;
860
861} VBVAINFOHEAP;
862
863typedef struct _VBVAFLUSH
864{
865 uint32_t u32Reserved;
866
867} VBVAFLUSH;
868
869/* VBVAINFOSCREEN::u8Flags */
870#define VBVA_SCREEN_F_NONE 0x0000
871#define VBVA_SCREEN_F_ACTIVE 0x0001
872
873typedef struct VBVAINFOSCREEN
874{
875 /* Which view contains the screen. */
876 uint32_t u32ViewIndex;
877
878 /* Physical X origin relative to the primary screen. */
879 int32_t i32OriginX;
880
881 /* Physical Y origin relative to the primary screen. */
882 int32_t i32OriginY;
883
884 /* Offset of visible framebuffer relative to the framebuffer start. */
885 uint32_t u32StartOffset;
886
887 /* The scan line size in bytes. */
888 uint32_t u32LineSize;
889
890 /* Width of the screen. */
891 uint32_t u32Width;
892
893 /* Height of the screen. */
894 uint32_t u32Height;
895
896 /* Color depth. */
897 uint16_t u16BitsPerPixel;
898
899 /* VBVA_SCREEN_F_* */
900 uint16_t u16Flags;
901} VBVAINFOSCREEN;
902
903
904/* VBVAENABLE::u32Flags */
905#define VBVA_F_NONE 0x00000000
906#define VBVA_F_ENABLE 0x00000001
907#define VBVA_F_DISABLE 0x00000002
908
909typedef struct _VBVAENABLE
910{
911 uint32_t u32Flags;
912 uint32_t u32Offset;
913 int32_t i32Result;
914
915} VBVAENABLE;
916
917typedef struct _VBVAMOUSEPOINTERSHAPE
918{
919 /* The host result. */
920 int32_t i32Result;
921
922 /* VBOX_MOUSE_POINTER_* bit flags. */
923 uint32_t fu32Flags;
924
925 /* X coordinate of the hot spot. */
926 uint32_t u32HotX;
927
928 /* Y coordinate of the hot spot. */
929 uint32_t u32HotY;
930
931 /* Width of the pointer in pixels. */
932 uint32_t u32Width;
933
934 /* Height of the pointer in scanlines. */
935 uint32_t u32Height;
936
937 /* Pointer data.
938 *
939 ****
940 * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
941 *
942 * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
943 * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
944 *
945 * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
946 * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
947 * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
948 *
949 * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
950 * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
951 * end of any scanline are undefined.
952 *
953 * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
954 * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
955 * Bytes in the gap between the AND and the XOR mask are undefined.
956 * XOR mask scanlines have no gap between them and size of XOR mask is:
957 * cXor = width * 4 * height.
958 ****
959 *
960 * Preallocate 4 bytes for accessing actual data as p->au8Data.
961 */
962 uint8_t au8Data[4];
963
964} VBVAMOUSEPOINTERSHAPE;
965
966#pragma pack()
967
968#endif /* VBOX_WITH_HGSMI */
969
970#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