VirtualBox

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

Last change on this file since 25149 was 25052, checked in by vboxsync, 15 years ago

HGSMI/VBVA: enable VRDP commands only if there are connected RDP clients.

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