1 | /** @file
|
---|
2 | * VirtualBox Video interface
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006 innotek GmbH
|
---|
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 |
|
---|
26 | #ifndef ___VBox_VBoxVideo_h
|
---|
27 | #define ___VBox_VBoxVideo_h
|
---|
28 |
|
---|
29 | #include <iprt/cdefs.h>
|
---|
30 | #include <iprt/types.h>
|
---|
31 |
|
---|
32 | /*
|
---|
33 | * The last 4096 bytes of the guest VRAM contains the generic info for all
|
---|
34 | * DualView chunks: sizes and offsets of chunks. This is filled by miniport.
|
---|
35 | *
|
---|
36 | * Last 4096 bytes of each chunk contain chunk specific data: framebuffer info,
|
---|
37 | * etc. This is used exclusively by the corresponding instance of a display driver.
|
---|
38 | *
|
---|
39 | * The VRAM layout:
|
---|
40 | * Last 4096 bytes - Adapter information area.
|
---|
41 | * 4096 bytes aligned miniport heap (value specified in the config rouded up).
|
---|
42 | * Slack - what left after dividing the VRAM.
|
---|
43 | * 4096 bytes aligned framebuffers:
|
---|
44 | * last 4096 bytes of each framebuffer is the display information area.
|
---|
45 | *
|
---|
46 | * The Virtual Graphics Adapter information in the guest VRAM is stored by the
|
---|
47 | * guest video driver using structures prepended by VBOXVIDEOINFOHDR.
|
---|
48 | *
|
---|
49 | * When the guest driver writes dword 0 to the VBE_DISPI_INDEX_VBOX_VIDEO
|
---|
50 | * the host starts to process the info. The first element at the start of
|
---|
51 | * the 4096 bytes region should be normally be a LINK that points to
|
---|
52 | * actual information chain. That way the guest driver can have some
|
---|
53 | * fixed layout of the information memory block and just rewrite
|
---|
54 | * the link to point to relevant memory chain.
|
---|
55 | *
|
---|
56 | * The processing stops at the END element.
|
---|
57 | *
|
---|
58 | * The host can access the memory only when the port IO is processed.
|
---|
59 | * All data that will be needed later must be copied from these 4096 bytes.
|
---|
60 | * But other VRAM can be used by host until the mode is disabled.
|
---|
61 | *
|
---|
62 | * The guest driver writes dword 0xffffffff to the VBE_DISPI_INDEX_VBOX_VIDEO
|
---|
63 | * to disable the mode.
|
---|
64 | *
|
---|
65 | * VBE_DISPI_INDEX_VBOX_VIDEO is used to read the configuration information
|
---|
66 | * from the host and issue commands to the host.
|
---|
67 | *
|
---|
68 | * The guest writes the VBE_DISPI_INDEX_VBOX_VIDEO index register, the the
|
---|
69 | * following operations with the VBE data register can be performed:
|
---|
70 | *
|
---|
71 | * Operation Result
|
---|
72 | * write 16 bit value NOP
|
---|
73 | * read 16 bit value count of monitors
|
---|
74 | * write 32 bit value sets the vbox command value and the command processed by the host
|
---|
75 | * read 32 bit value result of the last vbox command is returned
|
---|
76 | */
|
---|
77 |
|
---|
78 | #define VBOX_VIDEO_PRIMARY_SCREEN 0
|
---|
79 | #define VBOX_VIDEO_NO_SCREEN ~0
|
---|
80 |
|
---|
81 | #define VBOX_VIDEO_MAX_SCREENS 64
|
---|
82 |
|
---|
83 | /* The size of the information. */
|
---|
84 | #define VBOX_VIDEO_ADAPTER_INFORMATION_SIZE 4096
|
---|
85 | #define VBOX_VIDEO_DISPLAY_INFORMATION_SIZE 4096
|
---|
86 |
|
---|
87 |
|
---|
88 | /* The value for port IO to let the adapter to interpret the adapter memory. */
|
---|
89 | #define VBOX_VIDEO_DISABLE_ADAPTER_MEMORY 0xFFFFFFFF
|
---|
90 |
|
---|
91 | /* The value for port IO to let the adapter to interpret the adapter memory. */
|
---|
92 | #define VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY 0x00000000
|
---|
93 |
|
---|
94 | /* The value for port IO to let the adapter to interpret the display memory.
|
---|
95 | * The display number is encoded in low 16 bits.
|
---|
96 | */
|
---|
97 | #define VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE 0x00010000
|
---|
98 |
|
---|
99 |
|
---|
100 | /* The end of the information. */
|
---|
101 | #define VBOX_VIDEO_INFO_TYPE_END 0
|
---|
102 | /* Instructs the host to fetch the next VBOXVIDEOINFOHDR at the given offset of VRAM. */
|
---|
103 | #define VBOX_VIDEO_INFO_TYPE_LINK 1
|
---|
104 | /* Information about a display memory position. */
|
---|
105 | #define VBOX_VIDEO_INFO_TYPE_DISPLAY 2
|
---|
106 | /* Information about a screen. */
|
---|
107 | #define VBOX_VIDEO_INFO_TYPE_SCREEN 3
|
---|
108 | /* Information about host notifications for the driver. */
|
---|
109 | #define VBOX_VIDEO_INFO_TYPE_HOST_EVENTS 4
|
---|
110 | /* Information about non-volatile guest VRAM heap. */
|
---|
111 | #define VBOX_VIDEO_INFO_TYPE_NV_HEAP 5
|
---|
112 | /* VBVA enable/disable. */
|
---|
113 | #define VBOX_VIDEO_INFO_TYPE_VBVA_STATUS 6
|
---|
114 | /* VBVA flush. */
|
---|
115 | #define VBOX_VIDEO_INFO_TYPE_VBVA_FLUSH 7
|
---|
116 | /* Query configuration value. */
|
---|
117 | #define VBOX_VIDEO_INFO_TYPE_QUERY_CONF32 8
|
---|
118 |
|
---|
119 |
|
---|
120 | #pragma pack(1)
|
---|
121 | typedef struct _VBOXVIDEOINFOHDR
|
---|
122 | {
|
---|
123 | uint8_t u8Type;
|
---|
124 | uint8_t u8Reserved;
|
---|
125 | uint16_t u16Length;
|
---|
126 | } VBOXVIDEOINFOHDR;
|
---|
127 |
|
---|
128 |
|
---|
129 | typedef struct _VBOXVIDEOINFOLINK
|
---|
130 | {
|
---|
131 | /* Relative offset in VRAM */
|
---|
132 | int32_t i32Offset;
|
---|
133 | } VBOXVIDEOINFOLINK;
|
---|
134 |
|
---|
135 |
|
---|
136 | /* Resides in adapter info memory. Describes a display VRAM chunk. */
|
---|
137 | typedef struct _VBOXVIDEOINFODISPLAY
|
---|
138 | {
|
---|
139 | /* Index of the framebuffer assigned by guest. */
|
---|
140 | uint32_t u32Index;
|
---|
141 |
|
---|
142 | /* Absolute offset in VRAM of the framebuffer to be displayed on the monitor. */
|
---|
143 | uint32_t u32Offset;
|
---|
144 |
|
---|
145 | /* The size of the memory that can be used for the screen. */
|
---|
146 | uint32_t u32FramebufferSize;
|
---|
147 |
|
---|
148 | /* The size of the memory that is used for the Display information.
|
---|
149 | * The information is at u32Offset + u32FramebufferSize
|
---|
150 | */
|
---|
151 | uint32_t u32InformationSize;
|
---|
152 |
|
---|
153 | } VBOXVIDEOINFODISPLAY;
|
---|
154 |
|
---|
155 |
|
---|
156 | /* Resides in display info area, describes the current video mode. */
|
---|
157 | #define VBOX_VIDEO_INFO_SCREEN_F_NONE 0x00
|
---|
158 | #define VBOX_VIDEO_INFO_SCREEN_F_ACTIVE 0x01
|
---|
159 |
|
---|
160 | typedef struct _VBOXVIDEOINFOSCREEN
|
---|
161 | {
|
---|
162 | /* Physical X origin relative to the primary screen. */
|
---|
163 | int32_t xOrigin;
|
---|
164 |
|
---|
165 | /* Physical Y origin relative to the primary screen. */
|
---|
166 | int32_t yOrigin;
|
---|
167 |
|
---|
168 | /* The scan line size in bytes. */
|
---|
169 | uint32_t u32LineSize;
|
---|
170 |
|
---|
171 | /* Width of the screen. */
|
---|
172 | uint16_t u16Width;
|
---|
173 |
|
---|
174 | /* Height of the screen. */
|
---|
175 | uint16_t u16Height;
|
---|
176 |
|
---|
177 | /* Color depth. */
|
---|
178 | uint8_t bitsPerPixel;
|
---|
179 |
|
---|
180 | /* VBOX_VIDEO_INFO_SCREEN_F_* */
|
---|
181 | uint8_t u8Flags;
|
---|
182 | } VBOXVIDEOINFOSCREEN;
|
---|
183 |
|
---|
184 | /* The guest initializes the structure to 0. The positions of the structure in the
|
---|
185 | * display info area must not be changed, host will update the structure. Guest checks
|
---|
186 | * the events and modifies the structure as a response to host.
|
---|
187 | */
|
---|
188 | #define VBOX_VIDEO_INFO_HOST_EVENTS_F_NONE 0x00000000
|
---|
189 | #define VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET 0x00000080
|
---|
190 |
|
---|
191 | typedef struct _VBOXVIDEOINFOHOSTEVENTS
|
---|
192 | {
|
---|
193 | /* Host events. */
|
---|
194 | uint32_t fu32Events;
|
---|
195 | } VBOXVIDEOINFOHOSTEVENTS;
|
---|
196 |
|
---|
197 | /* Resides in adapter info memory. Describes the non-volatile VRAM heap. */
|
---|
198 | typedef struct _VBOXVIDEOINFONVHEAP
|
---|
199 | {
|
---|
200 | /* Absolute offset in VRAM of the start of the heap. */
|
---|
201 | uint32_t u32HeapOffset;
|
---|
202 |
|
---|
203 | /* The size of the heap. */
|
---|
204 | uint32_t u32HeapSize;
|
---|
205 |
|
---|
206 | } VBOXVIDEOINFONVHEAP;
|
---|
207 |
|
---|
208 | /* Display information area. */
|
---|
209 | typedef struct _VBOXVIDEOINFOVBVASTATUS
|
---|
210 | {
|
---|
211 | /* Absolute offset in VRAM of the start of the VBVA QUEUE. 0 to disable VBVA. */
|
---|
212 | uint32_t u32QueueOffset;
|
---|
213 |
|
---|
214 | /* The size of the VBVA QUEUE. 0 to disable VBVA. */
|
---|
215 | uint32_t u32QueueSize;
|
---|
216 |
|
---|
217 | } VBOXVIDEOINFOVBVASTATUS;
|
---|
218 |
|
---|
219 | typedef struct _VBOXVIDEOINFOVBVAFLUSH
|
---|
220 | {
|
---|
221 | uint32_t u32DataStart;
|
---|
222 |
|
---|
223 | uint32_t u32DataEnd;
|
---|
224 |
|
---|
225 | } VBOXVIDEOINFOVBVAFLUSH;
|
---|
226 |
|
---|
227 | #define VBOX_VIDEO_QCI32_MONITOR_COUNT 0
|
---|
228 | #define VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE 1
|
---|
229 |
|
---|
230 | typedef struct _VBOXVIDEOINFOQUERYCONF32
|
---|
231 | {
|
---|
232 | uint32_t u32Index;
|
---|
233 |
|
---|
234 | uint32_t u32Value;
|
---|
235 |
|
---|
236 | } VBOXVIDEOINFOQUERYCONF32;
|
---|
237 | #pragma pack()
|
---|
238 |
|
---|
239 | #endif
|
---|