1 | /* $Id: VBoxVideo.h 108641 2025-03-20 12:48:42Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Video interface.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * Permission is hereby granted, free of charge, to any person
|
---|
10 | * obtaining a copy of this software and associated documentation
|
---|
11 | * files (the "Software"), to deal in the Software without
|
---|
12 | * restriction, including without limitation the rights to use,
|
---|
13 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
14 | * copies of the Software, and to permit persons to whom the
|
---|
15 | * Software is furnished to do so, subject to the following
|
---|
16 | * conditions:
|
---|
17 | *
|
---|
18 | * The above copyright notice and this permission notice shall be
|
---|
19 | * included in all copies or substantial portions of the Software.
|
---|
20 | *
|
---|
21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
22 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
---|
23 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
24 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
---|
25 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
26 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
27 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
28 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
29 | */
|
---|
30 |
|
---|
31 | #ifndef VBOX_INCLUDED_Graphics_VBoxVideo_h
|
---|
32 | #define VBOX_INCLUDED_Graphics_VBoxVideo_h
|
---|
33 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
34 | # pragma once
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | #include "VBoxVideoIPRT.h"
|
---|
38 |
|
---|
39 | /* this should be in sync with monitorCount <xsd:maxInclusive value="64"/> in src/VBox/Main/xml/VirtualBox-settings-common.xsd */
|
---|
40 | #define VBOX_VIDEO_MAX_SCREENS 64
|
---|
41 |
|
---|
42 | /*
|
---|
43 | * The last 4096 bytes of the guest VRAM contains the generic info for all
|
---|
44 | * DualView chunks: sizes and offsets of chunks. This is filled by miniport.
|
---|
45 | *
|
---|
46 | * Last 4096 bytes of each chunk contain chunk specific data: framebuffer info,
|
---|
47 | * etc. This is used exclusively by the corresponding instance of a display driver.
|
---|
48 | *
|
---|
49 | * The VRAM layout:
|
---|
50 | * Last 4096 bytes - Adapter information area.
|
---|
51 | * 4096 bytes aligned miniport heap (value specified in the config rouded up).
|
---|
52 | * Slack - what left after dividing the VRAM.
|
---|
53 | * 4096 bytes aligned framebuffers:
|
---|
54 | * last 4096 bytes of each framebuffer is the display information area.
|
---|
55 | *
|
---|
56 | * The Virtual Graphics Adapter information in the guest VRAM is stored by the
|
---|
57 | * guest video driver using structures prepended by VBOXVIDEOINFOHDR.
|
---|
58 | *
|
---|
59 | * When the guest driver writes dword 0 to the VBE_DISPI_INDEX_VBOX_VIDEO
|
---|
60 | * the host starts to process the info. The first element at the start of
|
---|
61 | * the 4096 bytes region should be normally be a LINK that points to
|
---|
62 | * actual information chain. That way the guest driver can have some
|
---|
63 | * fixed layout of the information memory block and just rewrite
|
---|
64 | * the link to point to relevant memory chain.
|
---|
65 | *
|
---|
66 | * The processing stops at the END element.
|
---|
67 | *
|
---|
68 | * The host can access the memory only when the port IO is processed.
|
---|
69 | * All data that will be needed later must be copied from these 4096 bytes.
|
---|
70 | * But other VRAM can be used by host until the mode is disabled.
|
---|
71 | *
|
---|
72 | * The guest driver writes dword 0xffffffff to the VBE_DISPI_INDEX_VBOX_VIDEO
|
---|
73 | * to disable the mode.
|
---|
74 | *
|
---|
75 | * VBE_DISPI_INDEX_VBOX_VIDEO is used to read the configuration information
|
---|
76 | * from the host and issue commands to the host.
|
---|
77 | *
|
---|
78 | * The guest writes the VBE_DISPI_INDEX_VBOX_VIDEO index register, the the
|
---|
79 | * following operations with the VBE data register can be performed:
|
---|
80 | *
|
---|
81 | * Operation Result
|
---|
82 | * write 16 bit value NOP
|
---|
83 | * read 16 bit value count of monitors
|
---|
84 | * write 32 bit value sets the vbox command value and the command processed by the host
|
---|
85 | * read 32 bit value result of the last vbox command is returned
|
---|
86 | */
|
---|
87 |
|
---|
88 | #define VBOX_VIDEO_PRIMARY_SCREEN 0
|
---|
89 | #define VBOX_VIDEO_NO_SCREEN ~0
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * VBVA command header.
|
---|
93 | *
|
---|
94 | * @todo Where does this fit in?
|
---|
95 | */
|
---|
96 | typedef struct VBVACMDHDR
|
---|
97 | {
|
---|
98 | /** Coordinates of affected rectangle. */
|
---|
99 | int16_t x;
|
---|
100 | int16_t y;
|
---|
101 | uint16_t w;
|
---|
102 | uint16_t h;
|
---|
103 | } VBVACMDHDR;
|
---|
104 | AssertCompileSize(VBVACMDHDR, 8);
|
---|
105 |
|
---|
106 | /** @name VBVA ring defines.
|
---|
107 | *
|
---|
108 | * The VBVA ring buffer is suitable for transferring large (< 2GB) amount of
|
---|
109 | * data. For example big bitmaps which do not fit to the buffer.
|
---|
110 | *
|
---|
111 | * Guest starts writing to the buffer by initializing a record entry in the
|
---|
112 | * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
|
---|
113 | * written. As data is written to the ring buffer, the guest increases off32End
|
---|
114 | * for the record.
|
---|
115 | *
|
---|
116 | * The host reads the aRecords on flushes and processes all completed records.
|
---|
117 | * When host encounters situation when only a partial record presents and
|
---|
118 | * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE -
|
---|
119 | * VBVA_RING_BUFFER_THRESHOLD, the host fetched all record data and updates
|
---|
120 | * off32Head. After that on each flush the host continues fetching the data
|
---|
121 | * until the record is completed.
|
---|
122 | *
|
---|
123 | */
|
---|
124 | #define VBVA_RING_BUFFER_SIZE (_4M - _1K)
|
---|
125 | #define VBVA_RING_BUFFER_THRESHOLD (4 * _1K)
|
---|
126 |
|
---|
127 | #define VBVA_MAX_RECORDS (64)
|
---|
128 |
|
---|
129 | #define VBVA_F_MODE_ENABLED UINT32_C(0x00000001)
|
---|
130 | #define VBVA_F_MODE_VRDP UINT32_C(0x00000002)
|
---|
131 | #define VBVA_F_MODE_VRDP_RESET UINT32_C(0x00000004)
|
---|
132 | #define VBVA_F_MODE_VRDP_ORDER_MASK UINT32_C(0x00000008)
|
---|
133 |
|
---|
134 | #define VBVA_F_STATE_PROCESSING UINT32_C(0x00010000)
|
---|
135 |
|
---|
136 | #define VBVA_F_RECORD_PARTIAL UINT32_C(0x80000000)
|
---|
137 |
|
---|
138 | /**
|
---|
139 | * VBVA record.
|
---|
140 | */
|
---|
141 | typedef struct VBVARECORD
|
---|
142 | {
|
---|
143 | /** The length of the record. Changed by guest. */
|
---|
144 | uint32_t cbRecord;
|
---|
145 | } VBVARECORD;
|
---|
146 | AssertCompileSize(VBVARECORD, 4);
|
---|
147 |
|
---|
148 | /* The size of the information. */
|
---|
149 | /*
|
---|
150 | * The minimum HGSMI heap size is PAGE_SIZE (4096 bytes) and is a restriction of the
|
---|
151 | * runtime heapsimple API. Use minimum 2 pages here, because the info area also may
|
---|
152 | * contain other data (for example HGSMIHOSTFLAGS structure).
|
---|
153 | */
|
---|
154 | #ifndef VBOX_XPDM_MINIPORT
|
---|
155 | # define VBVA_ADAPTER_INFORMATION_SIZE (64*_1K)
|
---|
156 | #else
|
---|
157 | #define VBVA_ADAPTER_INFORMATION_SIZE (16*_1K)
|
---|
158 | #define VBVA_DISPLAY_INFORMATION_SIZE (64*_1K)
|
---|
159 | #endif
|
---|
160 | #define VBVA_MIN_BUFFER_SIZE (64*_1K)
|
---|
161 |
|
---|
162 |
|
---|
163 | /* The value for port IO to let the adapter to interpret the adapter memory. */
|
---|
164 | #define VBOX_VIDEO_DISABLE_ADAPTER_MEMORY 0xFFFFFFFF
|
---|
165 |
|
---|
166 | /* The value for port IO to let the adapter to interpret the adapter memory. */
|
---|
167 | #define VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY 0x00000000
|
---|
168 |
|
---|
169 | /* The value for port IO to let the adapter to interpret the display memory.
|
---|
170 | * The display number is encoded in low 16 bits.
|
---|
171 | */
|
---|
172 | #define VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE 0x00010000
|
---|
173 |
|
---|
174 |
|
---|
175 | /* The end of the information. */
|
---|
176 | #define VBOX_VIDEO_INFO_TYPE_END 0
|
---|
177 | /* Instructs the host to fetch the next VBOXVIDEOINFOHDR at the given offset of VRAM. */
|
---|
178 | #define VBOX_VIDEO_INFO_TYPE_LINK 1
|
---|
179 | /* Information about a display memory position. */
|
---|
180 | #define VBOX_VIDEO_INFO_TYPE_DISPLAY 2
|
---|
181 | /* Information about a screen. */
|
---|
182 | #define VBOX_VIDEO_INFO_TYPE_SCREEN 3
|
---|
183 | /* Information about host notifications for the driver. */
|
---|
184 | #define VBOX_VIDEO_INFO_TYPE_HOST_EVENTS 4
|
---|
185 | /* Information about non-volatile guest VRAM heap. */
|
---|
186 | #define VBOX_VIDEO_INFO_TYPE_NV_HEAP 5
|
---|
187 | /* VBVA enable/disable. */
|
---|
188 | #define VBOX_VIDEO_INFO_TYPE_VBVA_STATUS 6
|
---|
189 | /* VBVA flush. */
|
---|
190 | #define VBOX_VIDEO_INFO_TYPE_VBVA_FLUSH 7
|
---|
191 | /* Query configuration value. */
|
---|
192 | #define VBOX_VIDEO_INFO_TYPE_QUERY_CONF32 8
|
---|
193 |
|
---|
194 |
|
---|
195 | #pragma pack(1)
|
---|
196 | typedef struct VBOXVIDEOINFOHDR
|
---|
197 | {
|
---|
198 | uint8_t u8Type;
|
---|
199 | uint8_t u8Reserved;
|
---|
200 | uint16_t u16Length;
|
---|
201 | } VBOXVIDEOINFOHDR;
|
---|
202 |
|
---|
203 |
|
---|
204 | typedef struct VBOXVIDEOINFOLINK
|
---|
205 | {
|
---|
206 | /* Relative offset in VRAM */
|
---|
207 | int32_t i32Offset;
|
---|
208 | } VBOXVIDEOINFOLINK;
|
---|
209 |
|
---|
210 |
|
---|
211 | /* Resides in adapter info memory. Describes a display VRAM chunk. */
|
---|
212 | typedef struct VBOXVIDEOINFODISPLAY
|
---|
213 | {
|
---|
214 | /* Index of the framebuffer assigned by guest. */
|
---|
215 | uint32_t u32Index;
|
---|
216 |
|
---|
217 | /* Absolute offset in VRAM of the framebuffer to be displayed on the monitor. */
|
---|
218 | uint32_t u32Offset;
|
---|
219 |
|
---|
220 | /* The size of the memory that can be used for the screen. */
|
---|
221 | uint32_t u32FramebufferSize;
|
---|
222 |
|
---|
223 | /* The size of the memory that is used for the Display information.
|
---|
224 | * The information is at u32Offset + u32FramebufferSize
|
---|
225 | */
|
---|
226 | uint32_t u32InformationSize;
|
---|
227 |
|
---|
228 | } VBOXVIDEOINFODISPLAY;
|
---|
229 |
|
---|
230 |
|
---|
231 | /* Resides in display info area, describes the current video mode. */
|
---|
232 | #define VBOX_VIDEO_INFO_SCREEN_F_NONE 0x00
|
---|
233 | #define VBOX_VIDEO_INFO_SCREEN_F_ACTIVE 0x01
|
---|
234 |
|
---|
235 | typedef struct VBOXVIDEOINFOSCREEN
|
---|
236 | {
|
---|
237 | /* Physical X origin relative to the primary screen. */
|
---|
238 | int32_t xOrigin;
|
---|
239 |
|
---|
240 | /* Physical Y origin relative to the primary screen. */
|
---|
241 | int32_t yOrigin;
|
---|
242 |
|
---|
243 | /* The scan line size in bytes. */
|
---|
244 | uint32_t u32LineSize;
|
---|
245 |
|
---|
246 | /* Width of the screen. */
|
---|
247 | uint16_t u16Width;
|
---|
248 |
|
---|
249 | /* Height of the screen. */
|
---|
250 | uint16_t u16Height;
|
---|
251 |
|
---|
252 | /* Color depth. */
|
---|
253 | uint8_t bitsPerPixel;
|
---|
254 |
|
---|
255 | /* VBOX_VIDEO_INFO_SCREEN_F_* */
|
---|
256 | uint8_t u8Flags;
|
---|
257 | } VBOXVIDEOINFOSCREEN;
|
---|
258 |
|
---|
259 | /* The guest initializes the structure to 0. The positions of the structure in the
|
---|
260 | * display info area must not be changed, host will update the structure. Guest checks
|
---|
261 | * the events and modifies the structure as a response to host.
|
---|
262 | */
|
---|
263 | #define VBOX_VIDEO_INFO_HOST_EVENTS_F_NONE 0x00000000
|
---|
264 | #define VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET 0x00000080
|
---|
265 |
|
---|
266 | typedef struct VBOXVIDEOINFOHOSTEVENTS
|
---|
267 | {
|
---|
268 | /* Host events. */
|
---|
269 | uint32_t fu32Events;
|
---|
270 | } VBOXVIDEOINFOHOSTEVENTS;
|
---|
271 |
|
---|
272 | /* Resides in adapter info memory. Describes the non-volatile VRAM heap. */
|
---|
273 | typedef struct VBOXVIDEOINFONVHEAP
|
---|
274 | {
|
---|
275 | /* Absolute offset in VRAM of the start of the heap. */
|
---|
276 | uint32_t u32HeapOffset;
|
---|
277 |
|
---|
278 | /* The size of the heap. */
|
---|
279 | uint32_t u32HeapSize;
|
---|
280 |
|
---|
281 | } VBOXVIDEOINFONVHEAP;
|
---|
282 |
|
---|
283 | /* Display information area. */
|
---|
284 | typedef struct VBOXVIDEOINFOVBVASTATUS
|
---|
285 | {
|
---|
286 | /* Absolute offset in VRAM of the start of the VBVA QUEUE. 0 to disable VBVA. */
|
---|
287 | uint32_t u32QueueOffset;
|
---|
288 |
|
---|
289 | /* The size of the VBVA QUEUE. 0 to disable VBVA. */
|
---|
290 | uint32_t u32QueueSize;
|
---|
291 |
|
---|
292 | } VBOXVIDEOINFOVBVASTATUS;
|
---|
293 |
|
---|
294 | typedef struct VBOXVIDEOINFOVBVAFLUSH
|
---|
295 | {
|
---|
296 | uint32_t u32DataStart;
|
---|
297 |
|
---|
298 | uint32_t u32DataEnd;
|
---|
299 |
|
---|
300 | } VBOXVIDEOINFOVBVAFLUSH;
|
---|
301 |
|
---|
302 | #define VBOX_VIDEO_QCI32_MONITOR_COUNT 0
|
---|
303 | #define VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE 1
|
---|
304 |
|
---|
305 | typedef struct VBOXVIDEOINFOQUERYCONF32
|
---|
306 | {
|
---|
307 | uint32_t u32Index;
|
---|
308 |
|
---|
309 | uint32_t u32Value;
|
---|
310 |
|
---|
311 | } VBOXVIDEOINFOQUERYCONF32;
|
---|
312 | #pragma pack()
|
---|
313 |
|
---|
314 | /* All structures are without alignment. */
|
---|
315 | #pragma pack(1)
|
---|
316 |
|
---|
317 | typedef struct VBVAHOSTFLAGS
|
---|
318 | {
|
---|
319 | uint32_t u32HostEvents;
|
---|
320 | uint32_t u32SupportedOrders;
|
---|
321 | } VBVAHOSTFLAGS;
|
---|
322 |
|
---|
323 | typedef struct VBVABUFFER
|
---|
324 | {
|
---|
325 | VBVAHOSTFLAGS hostFlags;
|
---|
326 |
|
---|
327 | /* The offset where the data start in the buffer. */
|
---|
328 | uint32_t off32Data;
|
---|
329 | /* The offset where next data must be placed in the buffer. */
|
---|
330 | uint32_t off32Free;
|
---|
331 |
|
---|
332 | /* The queue of record descriptions. */
|
---|
333 | VBVARECORD aRecords[VBVA_MAX_RECORDS];
|
---|
334 | uint32_t indexRecordFirst;
|
---|
335 | uint32_t indexRecordFree;
|
---|
336 |
|
---|
337 | /* Space to leave free in the buffer when large partial records are transferred. */
|
---|
338 | uint32_t cbPartialWriteThreshold;
|
---|
339 |
|
---|
340 | uint32_t cbData;
|
---|
341 | uint8_t au8Data[1]; /* variable size for the rest of the VBVABUFFER area in VRAM. */
|
---|
342 | } VBVABUFFER;
|
---|
343 |
|
---|
344 | #define VBVA_MAX_RECORD_SIZE (128*_1M)
|
---|
345 |
|
---|
346 | /* guest->host commands */
|
---|
347 | #define VBVA_QUERY_CONF32 1
|
---|
348 | #define VBVA_SET_CONF32 2
|
---|
349 | #define VBVA_INFO_VIEW 3
|
---|
350 | #define VBVA_INFO_HEAP 4
|
---|
351 | #define VBVA_FLUSH 5
|
---|
352 | #define VBVA_INFO_SCREEN 6
|
---|
353 | /** Enables or disables VBVA. Enabling VBVA without disabling it before
|
---|
354 | * causes a complete screen update. */
|
---|
355 | #define VBVA_ENABLE 7
|
---|
356 | #define VBVA_MOUSE_POINTER_SHAPE 8
|
---|
357 | #ifdef VBOX_WITH_VDMA
|
---|
358 | # define VBVA_VDMA_CTL 10 /* setup G<->H DMA channel info */
|
---|
359 | # define VBVA_VDMA_CMD 11 /* G->H DMA command */
|
---|
360 | #endif
|
---|
361 | #define VBVA_INFO_CAPS 12 /* informs host about HGSMI caps. see VBVACAPS below */
|
---|
362 | #define VBVA_SCANLINE_CFG 13 /* configures scanline, see VBVASCANLINECFG below */
|
---|
363 | #define VBVA_SCANLINE_INFO 14 /* requests scanline info, see VBVASCANLINEINFO below */
|
---|
364 | #define VBVA_CMDVBVA_SUBMIT 16 /* inform host about VBVA Command submission */
|
---|
365 | #define VBVA_CMDVBVA_FLUSH 17 /* inform host about VBVA Command submission */
|
---|
366 | #define VBVA_CMDVBVA_CTL 18 /* G->H DMA command */
|
---|
367 | #define VBVA_QUERY_MODE_HINTS 19 /* Query most recent mode hints sent. */
|
---|
368 | /** Report the guest virtual desktop position and size for mapping host and
|
---|
369 | * guest pointer positions. */
|
---|
370 | #define VBVA_REPORT_INPUT_MAPPING 20
|
---|
371 | /** Report the guest cursor position and query the host position. */
|
---|
372 | #define VBVA_CURSOR_POSITION 21
|
---|
373 |
|
---|
374 | /* host->guest commands */
|
---|
375 | #define VBVAHG_EVENT 1
|
---|
376 | #define VBVAHG_DISPLAY_CUSTOM 2
|
---|
377 | #ifdef VBOX_WITH_VDMA
|
---|
378 | #define VBVAHG_SHGSMI_COMPLETION 3
|
---|
379 | #endif
|
---|
380 |
|
---|
381 | #pragma pack(1)
|
---|
382 | typedef enum
|
---|
383 | {
|
---|
384 | VBVAHOSTCMD_OP_EVENT = 1,
|
---|
385 | VBVAHOSTCMD_OP_CUSTOM
|
---|
386 | }VBVAHOSTCMD_OP_TYPE;
|
---|
387 |
|
---|
388 | typedef struct VBVAHOSTCMDEVENT
|
---|
389 | {
|
---|
390 | uint64_t pEvent;
|
---|
391 | }VBVAHOSTCMDEVENT;
|
---|
392 |
|
---|
393 |
|
---|
394 | typedef struct VBVAHOSTCMD
|
---|
395 | {
|
---|
396 | /* destination ID if >=0 specifies display index, otherwize the command is directed to the miniport */
|
---|
397 | int32_t iDstID;
|
---|
398 | int32_t customOpCode;
|
---|
399 | union
|
---|
400 | {
|
---|
401 | struct VBVAHOSTCMD *pNext;
|
---|
402 | uint32_t offNext;
|
---|
403 | uint64_t Data; /* the body is 64-bit aligned */
|
---|
404 | } u;
|
---|
405 | char body[1];
|
---|
406 | } VBVAHOSTCMD;
|
---|
407 |
|
---|
408 | #define VBVAHOSTCMD_SIZE(a_cb) (sizeof(VBVAHOSTCMD) + (a_cb))
|
---|
409 | #define VBVAHOSTCMD_BODY(a_pCmd, a_TypeBody) ((a_TypeBody RT_UNTRUSTED_VOLATILE_HSTGST *)&(a_pCmd)->body[0])
|
---|
410 | #define VBVAHOSTCMD_HDR(a_pBody) \
|
---|
411 | ( (VBVAHOSTCMD RT_UNTRUSTED_VOLATILE_HSTGST *)( (uint8_t *)(a_pBody) - RT_OFFSETOF(VBVAHOSTCMD, body)) )
|
---|
412 | #define VBVAHOSTCMD_HDRSIZE (RT_OFFSETOF(VBVAHOSTCMD, body))
|
---|
413 |
|
---|
414 | #pragma pack()
|
---|
415 |
|
---|
416 | /* VBVACONF32::u32Index */
|
---|
417 | #define VBOX_VBVA_CONF32_MONITOR_COUNT 0
|
---|
418 | #define VBOX_VBVA_CONF32_HOST_HEAP_SIZE 1
|
---|
419 | /** Returns VINF_SUCCESS if the host can report mode hints via VBVA.
|
---|
420 | * Set value to VERR_NOT_SUPPORTED before calling. */
|
---|
421 | #define VBOX_VBVA_CONF32_MODE_HINT_REPORTING 2
|
---|
422 | /** Returns VINF_SUCCESS if the host can report guest cursor enabled status via
|
---|
423 | * VBVA. Set value to VERR_NOT_SUPPORTED before calling. */
|
---|
424 | #define VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING 3
|
---|
425 | /** Returns the currently available host cursor capabilities. Available if
|
---|
426 | * VBVACONF32::VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING returns success.
|
---|
427 | * @see VMMDevReqMouseStatus::mouseFeatures. */
|
---|
428 | #define VBOX_VBVA_CONF32_CURSOR_CAPABILITIES 4
|
---|
429 | /** Returns the supported flags in VBVAINFOSCREEN::u8Flags. */
|
---|
430 | #define VBOX_VBVA_CONF32_SCREEN_FLAGS 5
|
---|
431 | /** Returns the max size of VBVA record. */
|
---|
432 | #define VBOX_VBVA_CONF32_MAX_RECORD_SIZE 6
|
---|
433 |
|
---|
434 | typedef struct VBVACONF32
|
---|
435 | {
|
---|
436 | uint32_t u32Index;
|
---|
437 | uint32_t u32Value;
|
---|
438 | } VBVACONF32;
|
---|
439 |
|
---|
440 | /** Reserved for historical reasons. */
|
---|
441 | #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED0 RT_BIT(0)
|
---|
442 | /** Guest cursor capability: can the host show a hardware cursor at the host
|
---|
443 | * pointer location? */
|
---|
444 | #define VBOX_VBVA_CURSOR_CAPABILITY_HARDWARE RT_BIT(1)
|
---|
445 | /** Reserved for historical reasons. */
|
---|
446 | #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED2 RT_BIT(2)
|
---|
447 | /** Reserved for historical reasons. Must always be unset. */
|
---|
448 | #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED3 RT_BIT(3)
|
---|
449 | /** Reserved for historical reasons. */
|
---|
450 | #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED4 RT_BIT(4)
|
---|
451 | /** Reserved for historical reasons. */
|
---|
452 | #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED5 RT_BIT(5)
|
---|
453 |
|
---|
454 | typedef struct VBVAINFOVIEW
|
---|
455 | {
|
---|
456 | /* Index of the screen, assigned by the guest. */
|
---|
457 | uint32_t u32ViewIndex;
|
---|
458 |
|
---|
459 | /* The screen offset in VRAM, the framebuffer starts here. */
|
---|
460 | uint32_t u32ViewOffset;
|
---|
461 |
|
---|
462 | /* The size of the VRAM memory that can be used for the view. */
|
---|
463 | uint32_t u32ViewSize;
|
---|
464 |
|
---|
465 | /* The recommended maximum size of the VRAM memory for the screen. */
|
---|
466 | uint32_t u32MaxScreenSize;
|
---|
467 | } VBVAINFOVIEW;
|
---|
468 |
|
---|
469 | typedef struct VBVAINFOHEAP
|
---|
470 | {
|
---|
471 | /* Absolute offset in VRAM of the start of the heap. */
|
---|
472 | uint32_t u32HeapOffset;
|
---|
473 |
|
---|
474 | /* The size of the heap. */
|
---|
475 | uint32_t u32HeapSize;
|
---|
476 |
|
---|
477 | } VBVAINFOHEAP;
|
---|
478 |
|
---|
479 | typedef struct VBVAFLUSH
|
---|
480 | {
|
---|
481 | uint32_t u32Reserved;
|
---|
482 |
|
---|
483 | } VBVAFLUSH;
|
---|
484 |
|
---|
485 | typedef struct VBVACMDVBVASUBMIT
|
---|
486 | {
|
---|
487 | uint32_t u32Reserved;
|
---|
488 | } VBVACMDVBVASUBMIT;
|
---|
489 |
|
---|
490 | /* flush is requested because due to guest command buffer overflow */
|
---|
491 | #define VBVACMDVBVAFLUSH_F_GUEST_BUFFER_OVERFLOW 1
|
---|
492 |
|
---|
493 | typedef struct VBVACMDVBVAFLUSH
|
---|
494 | {
|
---|
495 | uint32_t u32Flags;
|
---|
496 | } VBVACMDVBVAFLUSH;
|
---|
497 |
|
---|
498 |
|
---|
499 | /* VBVAINFOSCREEN::u8Flags */
|
---|
500 | #define VBVA_SCREEN_F_NONE 0x0000
|
---|
501 | #define VBVA_SCREEN_F_ACTIVE 0x0001
|
---|
502 | /** The virtual monitor has been disabled by the guest and should be removed
|
---|
503 | * by the host and ignored for purposes of pointer position calculation. */
|
---|
504 | #define VBVA_SCREEN_F_DISABLED 0x0002
|
---|
505 | /** The virtual monitor has been blanked by the guest and should be blacked
|
---|
506 | * out by the host using width, height, etc values from the VBVAINFOSCREEN request. */
|
---|
507 | #define VBVA_SCREEN_F_BLANK 0x0004
|
---|
508 | /** The virtual monitor has been blanked by the guest and should be blacked
|
---|
509 | * out by the host using the previous mode values for width. height, etc. */
|
---|
510 | #define VBVA_SCREEN_F_BLANK2 0x0008
|
---|
511 |
|
---|
512 | typedef struct VBVAINFOSCREEN
|
---|
513 | {
|
---|
514 | /* Which view contains the screen. */
|
---|
515 | uint32_t u32ViewIndex;
|
---|
516 |
|
---|
517 | /* Physical X origin relative to the primary screen. */
|
---|
518 | int32_t i32OriginX;
|
---|
519 |
|
---|
520 | /* Physical Y origin relative to the primary screen. */
|
---|
521 | int32_t i32OriginY;
|
---|
522 |
|
---|
523 | /* Offset of visible framebuffer relative to the framebuffer start. */
|
---|
524 | uint32_t u32StartOffset;
|
---|
525 |
|
---|
526 | /* The scan line size in bytes. */
|
---|
527 | uint32_t u32LineSize;
|
---|
528 |
|
---|
529 | /* Width of the screen. */
|
---|
530 | uint32_t u32Width;
|
---|
531 |
|
---|
532 | /* Height of the screen. */
|
---|
533 | uint32_t u32Height;
|
---|
534 |
|
---|
535 | /* Color depth. */
|
---|
536 | uint16_t u16BitsPerPixel;
|
---|
537 |
|
---|
538 | /* VBVA_SCREEN_F_* */
|
---|
539 | uint16_t u16Flags;
|
---|
540 | } VBVAINFOSCREEN;
|
---|
541 |
|
---|
542 |
|
---|
543 | /* VBVAENABLE::u32Flags */
|
---|
544 | #define VBVA_F_NONE 0x00000000
|
---|
545 | #define VBVA_F_ENABLE 0x00000001
|
---|
546 | #define VBVA_F_DISABLE 0x00000002
|
---|
547 | /* extended VBVA to be used with WDDM */
|
---|
548 | #define VBVA_F_EXTENDED 0x00000004
|
---|
549 | /* vbva offset is absolute VRAM offset */
|
---|
550 | #define VBVA_F_ABSOFFSET 0x00000008
|
---|
551 |
|
---|
552 | typedef struct VBVAENABLE
|
---|
553 | {
|
---|
554 | uint32_t u32Flags;
|
---|
555 | uint32_t u32Offset;
|
---|
556 | int32_t i32Result;
|
---|
557 | } VBVAENABLE;
|
---|
558 |
|
---|
559 | typedef struct VBVAENABLE_EX
|
---|
560 | {
|
---|
561 | VBVAENABLE Base;
|
---|
562 | uint32_t u32ScreenId;
|
---|
563 | } VBVAENABLE_EX;
|
---|
564 |
|
---|
565 |
|
---|
566 | typedef struct VBVAMOUSEPOINTERSHAPE
|
---|
567 | {
|
---|
568 | /* The host result. */
|
---|
569 | int32_t i32Result;
|
---|
570 |
|
---|
571 | /* VBOX_MOUSE_POINTER_* bit flags. */
|
---|
572 | uint32_t fu32Flags;
|
---|
573 |
|
---|
574 | /* X coordinate of the hot spot. */
|
---|
575 | uint32_t u32HotX;
|
---|
576 |
|
---|
577 | /* Y coordinate of the hot spot. */
|
---|
578 | uint32_t u32HotY;
|
---|
579 |
|
---|
580 | /* Width of the pointer in pixels. */
|
---|
581 | uint32_t u32Width;
|
---|
582 |
|
---|
583 | /* Height of the pointer in scanlines. */
|
---|
584 | uint32_t u32Height;
|
---|
585 |
|
---|
586 | /* Pointer data.
|
---|
587 | *
|
---|
588 | ****
|
---|
589 | * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
|
---|
590 | *
|
---|
591 | * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
|
---|
592 | * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
|
---|
593 | *
|
---|
594 | * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
|
---|
595 | * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
|
---|
596 | * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
|
---|
597 | *
|
---|
598 | * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
|
---|
599 | * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
|
---|
600 | * end of any scanline are undefined.
|
---|
601 | *
|
---|
602 | * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
|
---|
603 | * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
|
---|
604 | * Bytes in the gap between the AND and the XOR mask are undefined.
|
---|
605 | * XOR mask scanlines have no gap between them and size of XOR mask is:
|
---|
606 | * cXor = width * 4 * height.
|
---|
607 | ****
|
---|
608 | *
|
---|
609 | * Preallocate 4 bytes for accessing actual data as p->au8Data.
|
---|
610 | */
|
---|
611 | uint8_t au8Data[4];
|
---|
612 |
|
---|
613 | } VBVAMOUSEPOINTERSHAPE;
|
---|
614 |
|
---|
615 | /** @name VBVAMOUSEPOINTERSHAPE::fu32Flags
|
---|
616 | * @note The VBOX_MOUSE_POINTER_* flags are used in the guest video driver,
|
---|
617 | * values must be <= 0x8000 and must not be changed. (try make more sense
|
---|
618 | * of this, please).
|
---|
619 | * @{
|
---|
620 | */
|
---|
621 | /** pointer is visible */
|
---|
622 | #define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
|
---|
623 | /** pointer has alpha channel */
|
---|
624 | #define VBOX_MOUSE_POINTER_ALPHA (0x0002)
|
---|
625 | /** pointerData contains new pointer shape */
|
---|
626 | #define VBOX_MOUSE_POINTER_SHAPE (0x0004)
|
---|
627 | /** @} */
|
---|
628 |
|
---|
629 | /* the guest driver can handle asynch guest cmd completion by reading the command offset from io port */
|
---|
630 | #define VBVACAPS_COMPLETEGCMD_BY_IOREAD 0x00000001
|
---|
631 | /* the guest driver can handle video adapter IRQs */
|
---|
632 | #define VBVACAPS_IRQ 0x00000002
|
---|
633 | /** The guest can read video mode hints sent via VBVA. */
|
---|
634 | #define VBVACAPS_VIDEO_MODE_HINTS 0x00000004
|
---|
635 | /** The guest can switch to a software cursor on demand. */
|
---|
636 | #define VBVACAPS_DISABLE_CURSOR_INTEGRATION 0x00000008
|
---|
637 | /** The guest does not depend on host handling the VBE registers. */
|
---|
638 | #define VBVACAPS_USE_VBVA_ONLY 0x00000010
|
---|
639 | typedef struct VBVACAPS
|
---|
640 | {
|
---|
641 | int32_t rc;
|
---|
642 | uint32_t fCaps;
|
---|
643 | } VBVACAPS;
|
---|
644 |
|
---|
645 | /* makes graphics device generate IRQ on VSYNC */
|
---|
646 | #define VBVASCANLINECFG_ENABLE_VSYNC_IRQ 0x00000001
|
---|
647 | /* guest driver may request the current scanline */
|
---|
648 | #define VBVASCANLINECFG_ENABLE_SCANLINE_INFO 0x00000002
|
---|
649 | /* request the current refresh period, returned in u32RefreshPeriodMs */
|
---|
650 | #define VBVASCANLINECFG_QUERY_REFRESH_PERIOD 0x00000004
|
---|
651 | /* set new refresh period specified in u32RefreshPeriodMs.
|
---|
652 | * if used with VBVASCANLINECFG_QUERY_REFRESH_PERIOD,
|
---|
653 | * u32RefreshPeriodMs is set to the previous refresh period on return */
|
---|
654 | #define VBVASCANLINECFG_SET_REFRESH_PERIOD 0x00000008
|
---|
655 |
|
---|
656 | typedef struct VBVASCANLINECFG
|
---|
657 | {
|
---|
658 | int32_t rc;
|
---|
659 | uint32_t fFlags;
|
---|
660 | uint32_t u32RefreshPeriodMs;
|
---|
661 | uint32_t u32Reserved;
|
---|
662 | } VBVASCANLINECFG;
|
---|
663 |
|
---|
664 | typedef struct VBVASCANLINEINFO
|
---|
665 | {
|
---|
666 | int32_t rc;
|
---|
667 | uint32_t u32ScreenId;
|
---|
668 | uint32_t u32InVBlank;
|
---|
669 | uint32_t u32ScanLine;
|
---|
670 | } VBVASCANLINEINFO;
|
---|
671 |
|
---|
672 | /** Query the most recent mode hints received from the host. */
|
---|
673 | typedef struct VBVAQUERYMODEHINTS
|
---|
674 | {
|
---|
675 | /** The maximum number of screens to return hints for. */
|
---|
676 | uint16_t cHintsQueried;
|
---|
677 | /** The size of the mode hint structures directly following this one. */
|
---|
678 | uint16_t cbHintStructureGuest;
|
---|
679 | /** The return code for the operation. Initialise to VERR_NOT_SUPPORTED. */
|
---|
680 | int32_t rc;
|
---|
681 | } VBVAQUERYMODEHINTS;
|
---|
682 |
|
---|
683 | /** Structure in which a mode hint is returned. The guest allocates an array
|
---|
684 | * of these immediately after the VBVAQUERYMODEHINTS structure. To accomodate
|
---|
685 | * future extensions, the VBVAQUERYMODEHINTS structure specifies the size of
|
---|
686 | * the VBVAMODEHINT structures allocated by the guest, and the host only fills
|
---|
687 | * out structure elements which fit into that size. The host should fill any
|
---|
688 | * unused members (e.g. dx, dy) or structure space on the end with ~0. The
|
---|
689 | * whole structure can legally be set to ~0 to skip a screen. */
|
---|
690 | typedef struct VBVAMODEHINT
|
---|
691 | {
|
---|
692 | uint32_t magic;
|
---|
693 | uint32_t cx;
|
---|
694 | uint32_t cy;
|
---|
695 | uint32_t cBPP; /* Which has never been used... */
|
---|
696 | uint32_t cDisplay;
|
---|
697 | uint32_t dx; /**< X offset into the virtual frame-buffer. */
|
---|
698 | uint32_t dy; /**< Y offset into the virtual frame-buffer. */
|
---|
699 | uint32_t fEnabled; /* Not fFlags. Add new members for new flags. */
|
---|
700 | } VBVAMODEHINT;
|
---|
701 |
|
---|
702 | #define VBVAMODEHINT_MAGIC UINT32_C(0x0801add9)
|
---|
703 |
|
---|
704 | /** Report the rectangle relative to which absolute pointer events should be
|
---|
705 | * expressed. This information remains valid until the next VBVA resize event
|
---|
706 | * for any screen, at which time it is reset to the bounding rectangle of all
|
---|
707 | * virtual screens and must be re-set.
|
---|
708 | * @see VBVA_REPORT_INPUT_MAPPING. */
|
---|
709 | typedef struct VBVAREPORTINPUTMAPPING
|
---|
710 | {
|
---|
711 | int32_t x; /**< Upper left X co-ordinate relative to the first screen. */
|
---|
712 | int32_t y; /**< Upper left Y co-ordinate relative to the first screen. */
|
---|
713 | uint32_t cx; /**< Rectangle width. */
|
---|
714 | uint32_t cy; /**< Rectangle height. */
|
---|
715 | } VBVAREPORTINPUTMAPPING;
|
---|
716 |
|
---|
717 | /** Report the guest cursor position and query the host one. The host may wish
|
---|
718 | * to use the guest information to re-position its own cursor, particularly
|
---|
719 | * when the cursor is captured and the guest does not support switching to a
|
---|
720 | * software cursor. After every mode switch the guest must signal that it
|
---|
721 | * supports sending position information by sending an event with
|
---|
722 | * @a fReportPosition set to false.
|
---|
723 | * @see VBVA_CURSOR_POSITION */
|
---|
724 | typedef struct VBVACURSORPOSITION
|
---|
725 | {
|
---|
726 | uint32_t fReportPosition; /**< Are we reporting a position? */
|
---|
727 | uint32_t x; /**< Guest cursor X position */
|
---|
728 | uint32_t y; /**< Guest cursor Y position */
|
---|
729 | } VBVACURSORPOSITION;
|
---|
730 |
|
---|
731 | #pragma pack()
|
---|
732 |
|
---|
733 | typedef uint64_t VBOXVIDEOOFFSET;
|
---|
734 |
|
---|
735 | #define VBOXVIDEOOFFSET_VOID ((VBOXVIDEOOFFSET)~0)
|
---|
736 |
|
---|
737 | #pragma pack(1)
|
---|
738 |
|
---|
739 | /*
|
---|
740 | * VBOXSHGSMI made on top HGSMI and allows receiving notifications
|
---|
741 | * about G->H command completion
|
---|
742 | */
|
---|
743 | /* SHGSMI command header */
|
---|
744 | typedef struct VBOXSHGSMIHEADER
|
---|
745 | {
|
---|
746 | uint64_t pvNext; /*<- completion processing queue */
|
---|
747 | uint32_t fFlags; /*<- see VBOXSHGSMI_FLAG_XXX Flags */
|
---|
748 | uint32_t cRefs; /*<- command referece count */
|
---|
749 | uint64_t u64Info1; /*<- contents depends on the fFlags value */
|
---|
750 | uint64_t u64Info2; /*<- contents depends on the fFlags value */
|
---|
751 | } VBOXSHGSMIHEADER, *PVBOXSHGSMIHEADER;
|
---|
752 |
|
---|
753 | typedef enum
|
---|
754 | {
|
---|
755 | VBOXVDMACMD_TYPE_UNDEFINED = 0,
|
---|
756 | VBOXVDMACMD_TYPE_DMA_PRESENT_BLT = 1,
|
---|
757 | VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER,
|
---|
758 | VBOXVDMACMD_TYPE_DMA_BPB_FILL,
|
---|
759 | VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY,
|
---|
760 | VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL,
|
---|
761 | VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP,
|
---|
762 | VBOXVDMACMD_TYPE_DMA_NOP,
|
---|
763 | VBOXVDMACMD_TYPE_CHROMIUM_CMD, /* chromium cmd */
|
---|
764 | VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER_VRAMSYS,
|
---|
765 | VBOXVDMACMD_TYPE_CHILD_STATUS_IRQ /* make the device notify child (monitor) state change IRQ */
|
---|
766 | } VBOXVDMACMD_TYPE;
|
---|
767 |
|
---|
768 | #pragma pack()
|
---|
769 |
|
---|
770 | /* the command processing was asynch, set by the host to indicate asynch command completion
|
---|
771 | * must not be cleared once set, the command completion is performed by issuing a host->guest completion command
|
---|
772 | * while keeping this flag unchanged */
|
---|
773 | #define VBOXSHGSMI_FLAG_HG_ASYNCH 0x00010000
|
---|
774 | #if 0
|
---|
775 | /* if set - asynch completion is performed by issuing the event,
|
---|
776 | * if cleared - asynch completion is performed by calling a callback */
|
---|
777 | #define VBOXSHGSMI_FLAG_GH_ASYNCH_EVENT 0x00000001
|
---|
778 | #endif
|
---|
779 | /* issue interrupt on asynch completion, used for critical G->H commands,
|
---|
780 | * i.e. for completion of which guest is waiting. */
|
---|
781 | #define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ 0x00000002
|
---|
782 | /* guest does not do any op on completion of this command,
|
---|
783 | * the host may copy the command and indicate that it does not need the command anymore
|
---|
784 | * by not setting VBOXSHGSMI_FLAG_HG_ASYNCH */
|
---|
785 | #define VBOXSHGSMI_FLAG_GH_ASYNCH_NOCOMPLETION 0x00000004
|
---|
786 | /* guest requires the command to be processed asynchronously,
|
---|
787 | * not setting VBOXSHGSMI_FLAG_HG_ASYNCH by the host in this case is treated as command failure */
|
---|
788 | #define VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE 0x00000008
|
---|
789 | /* force IRQ on cmd completion */
|
---|
790 | #define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ_FORCE 0x00000010
|
---|
791 | /* an IRQ-level callback is associated with the command */
|
---|
792 | #define VBOXSHGSMI_FLAG_GH_ASYNCH_CALLBACK_IRQ 0x00000020
|
---|
793 | /* guest expects this command to be completed synchronously */
|
---|
794 | #define VBOXSHGSMI_FLAG_GH_SYNCH 0x00000040
|
---|
795 |
|
---|
796 |
|
---|
797 | DECLINLINE(uint8_t RT_UNTRUSTED_VOLATILE_GUEST *)
|
---|
798 | VBoxSHGSMIBufferData(const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHeader)
|
---|
799 | {
|
---|
800 | return (uint8_t RT_UNTRUSTED_VOLATILE_GUEST *)pHeader + sizeof(VBOXSHGSMIHEADER);
|
---|
801 | }
|
---|
802 |
|
---|
803 | #define VBoxSHGSMIBufferHeaderSize() (sizeof(VBOXSHGSMIHEADER))
|
---|
804 |
|
---|
805 | DECLINLINE(VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *) VBoxSHGSMIBufferHeader(const void RT_UNTRUSTED_VOLATILE_GUEST *pvData)
|
---|
806 | {
|
---|
807 | return (VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *)((uintptr_t)pvData - sizeof(VBOXSHGSMIHEADER));
|
---|
808 | }
|
---|
809 |
|
---|
810 | #ifdef VBOX_WITH_VDMA
|
---|
811 | # pragma pack(1)
|
---|
812 |
|
---|
813 | /* VDMA - Video DMA */
|
---|
814 |
|
---|
815 | /* VDMA Control API */
|
---|
816 | /* VBOXVDMA_CTL::u32Flags */
|
---|
817 | typedef enum
|
---|
818 | {
|
---|
819 | VBOXVDMA_CTL_TYPE_NONE = 0,
|
---|
820 | VBOXVDMA_CTL_TYPE_ENABLE,
|
---|
821 | VBOXVDMA_CTL_TYPE_DISABLE,
|
---|
822 | VBOXVDMA_CTL_TYPE_FLUSH,
|
---|
823 | VBOXVDMA_CTL_TYPE_WATCHDOG,
|
---|
824 | VBOXVDMA_CTL_TYPE_END
|
---|
825 | } VBOXVDMA_CTL_TYPE;
|
---|
826 |
|
---|
827 | typedef struct VBOXVDMA_CTL
|
---|
828 | {
|
---|
829 | VBOXVDMA_CTL_TYPE enmCtl;
|
---|
830 | uint32_t u32Offset;
|
---|
831 | int32_t i32Result;
|
---|
832 | } VBOXVDMA_CTL;
|
---|
833 |
|
---|
834 | /* VBOXVDMACBUF_DR::phBuf specifies offset in VRAM */
|
---|
835 | #define VBOXVDMACBUF_FLAG_BUF_VRAM_OFFSET 0x00000001
|
---|
836 | /* command buffer follows the VBOXVDMACBUF_DR in VRAM, VBOXVDMACBUF_DR::phBuf is ignored */
|
---|
837 | #define VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR 0x00000002
|
---|
838 |
|
---|
839 | /**
|
---|
840 | * We can not submit the DMA command via VRAM since we do not have control over
|
---|
841 | * DMA command buffer [de]allocation, i.e. we only control the buffer contents.
|
---|
842 | * In other words the system may call one of our callbacks to fill a command buffer
|
---|
843 | * with the necessary commands and then discard the buffer w/o any notification.
|
---|
844 | *
|
---|
845 | * We have only DMA command buffer physical address at submission time.
|
---|
846 | *
|
---|
847 | * so the only way is to */
|
---|
848 | typedef struct VBOXVDMACBUF_DR
|
---|
849 | {
|
---|
850 | uint16_t fFlags;
|
---|
851 | uint16_t cbBuf;
|
---|
852 | /* RT_SUCCESS() - on success
|
---|
853 | * VERR_INTERRUPTED - on preemption
|
---|
854 | * VERR_xxx - on error */
|
---|
855 | int32_t rc;
|
---|
856 | union
|
---|
857 | {
|
---|
858 | uint64_t phBuf;
|
---|
859 | VBOXVIDEOOFFSET offVramBuf;
|
---|
860 | } Location;
|
---|
861 | uint64_t aGuestData[7];
|
---|
862 | } VBOXVDMACBUF_DR, *PVBOXVDMACBUF_DR;
|
---|
863 |
|
---|
864 | #define VBOXVDMACBUF_DR_TAIL(a_pCmd, a_TailType) \
|
---|
865 | ( (a_TailType RT_UNTRUSTED_VOLATILE_HSTGST *)( ((uint8_t*)(a_pCmd)) + sizeof(VBOXVDMACBUF_DR)) )
|
---|
866 | #define VBOXVDMACBUF_DR_FROM_TAIL(a_pCmd) \
|
---|
867 | ( (VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HSTGST *)( ((uint8_t*)(a_pCmd)) - sizeof(VBOXVDMACBUF_DR)) )
|
---|
868 |
|
---|
869 | typedef struct VBOXVDMACMD
|
---|
870 | {
|
---|
871 | VBOXVDMACMD_TYPE enmType;
|
---|
872 | uint32_t u32CmdSpecific;
|
---|
873 | } VBOXVDMACMD;
|
---|
874 |
|
---|
875 | #define VBOXVDMACMD_HEADER_SIZE() sizeof(VBOXVDMACMD)
|
---|
876 | #define VBOXVDMACMD_SIZE_FROMBODYSIZE(_s) ((uint32_t)(VBOXVDMACMD_HEADER_SIZE() + (_s)))
|
---|
877 | #define VBOXVDMACMD_SIZE(_t) (VBOXVDMACMD_SIZE_FROMBODYSIZE(sizeof(_t)))
|
---|
878 | #define VBOXVDMACMD_BODY(a_pCmd, a_TypeBody) \
|
---|
879 | ( (a_TypeBody RT_UNTRUSTED_VOLATILE_HSTGST *)( ((uint8_t *)(a_pCmd)) + VBOXVDMACMD_HEADER_SIZE()) )
|
---|
880 | #define VBOXVDMACMD_BODY_SIZE(_s) ( (_s) - VBOXVDMACMD_HEADER_SIZE() )
|
---|
881 | #define VBOXVDMACMD_FROM_BODY(a_pBody) \
|
---|
882 | ( (VBOXVDMACMD RT_UNTRUSTED_VOLATILE_HSTGST *)( ((uint8_t *)(a_pBody)) - VBOXVDMACMD_HEADER_SIZE()) )
|
---|
883 | #define VBOXVDMACMD_BODY_FIELD_OFFSET(_ot, _t, _f) ( (_ot)(uintptr_t)( VBOXVDMACMD_BODY(0, uint8_t) + RT_UOFFSETOF_DYN(_t, _f) ) )
|
---|
884 |
|
---|
885 | # pragma pack()
|
---|
886 | #endif /* #ifdef VBOX_WITH_VDMA */
|
---|
887 |
|
---|
888 |
|
---|
889 | #define VBOXVDMA_CHILD_STATUS_F_CONNECTED 0x01
|
---|
890 | #define VBOXVDMA_CHILD_STATUS_F_DISCONNECTED 0x02
|
---|
891 | #define VBOXVDMA_CHILD_STATUS_F_ROTATED 0x04
|
---|
892 |
|
---|
893 | typedef struct VBOXVDMA_CHILD_STATUS
|
---|
894 | {
|
---|
895 | uint32_t iChild;
|
---|
896 | uint8_t fFlags;
|
---|
897 | uint8_t u8RotationAngle;
|
---|
898 | uint16_t u16Reserved;
|
---|
899 | } VBOXVDMA_CHILD_STATUS, *PVBOXVDMA_CHILD_STATUS;
|
---|
900 |
|
---|
901 | /* apply the aInfos are applied to all targets, the iTarget is ignored */
|
---|
902 | #define VBOXVDMACMD_CHILD_STATUS_IRQ_F_APPLY_TO_ALL 0x00000001
|
---|
903 |
|
---|
904 | typedef struct VBOXVDMACMD_CHILD_STATUS_IRQ
|
---|
905 | {
|
---|
906 | uint32_t cInfos;
|
---|
907 | uint32_t fFlags;
|
---|
908 | VBOXVDMA_CHILD_STATUS aInfos[1];
|
---|
909 | } VBOXVDMACMD_CHILD_STATUS_IRQ, *PVBOXVDMACMD_CHILD_STATUS_IRQ;
|
---|
910 |
|
---|
911 | #define VBOXCMDVBVA_SCREENMAP_SIZE(_elType) ((VBOX_VIDEO_MAX_SCREENS + sizeof (_elType) - 1) / sizeof (_elType))
|
---|
912 | #define VBOXCMDVBVA_SCREENMAP_DECL(_elType, _name) _elType _name[VBOXCMDVBVA_SCREENMAP_SIZE(_elType)]
|
---|
913 |
|
---|
914 | #endif /* !VBOX_INCLUDED_Graphics_VBoxVideo_h */
|
---|
915 |
|
---|