VirtualBox

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

Last change on this file since 24938 was 24925, checked in by vboxsync, 15 years ago

2d video: fix VM reset issues

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