1 | /* $Id: VBoxVideo.h 85121 2020-07-08 19:33:26Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Video interface.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2020 Oracle Corporation
|
---|
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 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
315 | #pragma pack(1)
|
---|
316 |
|
---|
317 | #define VBOXVHWA_VERSION_MAJ 0
|
---|
318 | #define VBOXVHWA_VERSION_MIN 0
|
---|
319 | #define VBOXVHWA_VERSION_BLD 6
|
---|
320 | #define VBOXVHWA_VERSION_RSV 0
|
---|
321 |
|
---|
322 | typedef enum
|
---|
323 | {
|
---|
324 | VBOXVHWACMD_TYPE_SURF_CANCREATE = 1,
|
---|
325 | VBOXVHWACMD_TYPE_SURF_CREATE,
|
---|
326 | VBOXVHWACMD_TYPE_SURF_DESTROY,
|
---|
327 | VBOXVHWACMD_TYPE_SURF_LOCK,
|
---|
328 | VBOXVHWACMD_TYPE_SURF_UNLOCK,
|
---|
329 | VBOXVHWACMD_TYPE_SURF_BLT,
|
---|
330 | VBOXVHWACMD_TYPE_SURF_FLIP,
|
---|
331 | VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE,
|
---|
332 | VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION,
|
---|
333 | VBOXVHWACMD_TYPE_SURF_COLORKEY_SET,
|
---|
334 | VBOXVHWACMD_TYPE_QUERY_INFO1,
|
---|
335 | VBOXVHWACMD_TYPE_QUERY_INFO2,
|
---|
336 | VBOXVHWACMD_TYPE_ENABLE,
|
---|
337 | VBOXVHWACMD_TYPE_DISABLE,
|
---|
338 | VBOXVHWACMD_TYPE_HH_CONSTRUCT,
|
---|
339 | VBOXVHWACMD_TYPE_HH_RESET
|
---|
340 | #ifdef VBOX_WITH_WDDM
|
---|
341 | , VBOXVHWACMD_TYPE_SURF_GETINFO
|
---|
342 | , VBOXVHWACMD_TYPE_SURF_COLORFILL
|
---|
343 | #endif
|
---|
344 | , VBOXVHWACMD_TYPE_HH_DISABLE
|
---|
345 | , VBOXVHWACMD_TYPE_HH_ENABLE
|
---|
346 | , VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEBEGIN
|
---|
347 | , VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEEND
|
---|
348 | , VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEPERFORM
|
---|
349 | , VBOXVHWACMD_TYPE_HH_SAVESTATE_LOADPERFORM
|
---|
350 | } VBOXVHWACMD_TYPE;
|
---|
351 |
|
---|
352 | /** The command processing was asynch, set by the host to indicate asynch
|
---|
353 | * command completion. Must not be cleared once set, the command completion is
|
---|
354 | * performed by issuing a host->guest completion command while keeping this
|
---|
355 | * flag unchanged */
|
---|
356 | #define VBOXVHWACMD_FLAG_HG_ASYNCH UINT32_C(0x00010000)
|
---|
357 | /** asynch completion is performed by issuing the event */
|
---|
358 | #define VBOXVHWACMD_FLAG_GH_ASYNCH_EVENT UINT32_C(0x00000001)
|
---|
359 | /** issue interrupt on asynch completion */
|
---|
360 | #define VBOXVHWACMD_FLAG_GH_ASYNCH_IRQ UINT32_C(0x00000002)
|
---|
361 | /** Guest does not do any op on completion of this command, the host may copy
|
---|
362 | * the command and indicate that it does not need the command anymore
|
---|
363 | * by setting the VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED flag */
|
---|
364 | #define VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION UINT32_C(0x00000004)
|
---|
365 | /** the host has copied the VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION command and returned it to the guest */
|
---|
366 | #define VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED UINT32_C(0x00020000)
|
---|
367 | /** this is the host->host cmd, i.e. a configuration command posted by the host to the framebuffer */
|
---|
368 | #define VBOXVHWACMD_FLAG_HH_CMD UINT32_C(0x10000000)
|
---|
369 |
|
---|
370 | typedef struct VBOXVHWACMD
|
---|
371 | {
|
---|
372 | VBOXVHWACMD_TYPE enmCmd; /**< command type */
|
---|
373 | volatile int32_t rc; /**< command result */
|
---|
374 | int32_t iDisplay; /**< display index */
|
---|
375 | volatile int32_t Flags; /**< ORed VBOXVHWACMD_FLAG_xxx values */
|
---|
376 | uint64_t GuestVBVAReserved1; /**< field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
|
---|
377 | uint64_t GuestVBVAReserved2; /**< field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
|
---|
378 | volatile uint32_t cRefs;
|
---|
379 | int32_t Reserved;
|
---|
380 | union
|
---|
381 | {
|
---|
382 | struct VBOXVHWACMD *pNext;
|
---|
383 | uint32_t offNext;
|
---|
384 | uint64_t Data; /**< the body is 64-bit aligned */
|
---|
385 | } u;
|
---|
386 | char body[1];
|
---|
387 | } VBOXVHWACMD;
|
---|
388 |
|
---|
389 | #define VBOXVHWACMD_HEADSIZE() (RT_OFFSETOF(VBOXVHWACMD, body))
|
---|
390 | #define VBOXVHWACMD_SIZE_FROMBODYSIZE(a_cbBody) (VBOXVHWACMD_HEADSIZE() + (a_cbBody))
|
---|
391 | #define VBOXVHWACMD_SIZE(a_tTypeCmd) (VBOXVHWACMD_SIZE_FROMBODYSIZE(sizeof(a_tTypeCmd)))
|
---|
392 | typedef unsigned int VBOXVHWACMD_LENGTH;
|
---|
393 | typedef uint64_t VBOXVHWA_SURFHANDLE;
|
---|
394 | #define VBOXVHWA_SURFHANDLE_INVALID UINT64_C(0)
|
---|
395 | #define VBOXVHWACMD_BODY(a_pHdr, a_TypeBody) ( (a_TypeBody RT_UNTRUSTED_VOLATILE_HSTGST *)&(a_pHdr)->body[0] )
|
---|
396 | #if !defined(IN_GUEST) && defined(IN_RING3)
|
---|
397 | # define VBOXVHWACMD_BODY_HOST_HEAP(a_pHdr, a_TypeBody) ( (a_TypeBody *)&(a_pHdr)->body[0] )
|
---|
398 | #endif
|
---|
399 | #define VBOXVHWACMD_HEAD(a_pBody)\
|
---|
400 | ( (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HSTGST *)((uint8_t *)(a_pBody) - RT_OFFSETOF(VBOXVHWACMD, body)))
|
---|
401 |
|
---|
402 | typedef struct VBOXVHWA_RECTL
|
---|
403 | {
|
---|
404 | int32_t left;
|
---|
405 | int32_t top;
|
---|
406 | int32_t right;
|
---|
407 | int32_t bottom;
|
---|
408 | } VBOXVHWA_RECTL;
|
---|
409 |
|
---|
410 | typedef struct VBOXVHWA_COLORKEY
|
---|
411 | {
|
---|
412 | uint32_t low;
|
---|
413 | uint32_t high;
|
---|
414 | } VBOXVHWA_COLORKEY;
|
---|
415 |
|
---|
416 | typedef struct VBOXVHWA_PIXELFORMAT
|
---|
417 | {
|
---|
418 | uint32_t flags;
|
---|
419 | uint32_t fourCC;
|
---|
420 | union
|
---|
421 | {
|
---|
422 | uint32_t rgbBitCount;
|
---|
423 | uint32_t yuvBitCount;
|
---|
424 | } c;
|
---|
425 |
|
---|
426 | union
|
---|
427 | {
|
---|
428 | uint32_t rgbRBitMask;
|
---|
429 | uint32_t yuvYBitMask;
|
---|
430 | } m1;
|
---|
431 |
|
---|
432 | union
|
---|
433 | {
|
---|
434 | uint32_t rgbGBitMask;
|
---|
435 | uint32_t yuvUBitMask;
|
---|
436 | } m2;
|
---|
437 |
|
---|
438 | union
|
---|
439 | {
|
---|
440 | uint32_t rgbBBitMask;
|
---|
441 | uint32_t yuvVBitMask;
|
---|
442 | } m3;
|
---|
443 |
|
---|
444 | union
|
---|
445 | {
|
---|
446 | uint32_t rgbABitMask;
|
---|
447 | } m4;
|
---|
448 |
|
---|
449 | uint32_t Reserved;
|
---|
450 | } VBOXVHWA_PIXELFORMAT;
|
---|
451 |
|
---|
452 | typedef struct VBOXVHWA_SURFACEDESC
|
---|
453 | {
|
---|
454 | uint32_t flags;
|
---|
455 | uint32_t height;
|
---|
456 | uint32_t width;
|
---|
457 | uint32_t pitch;
|
---|
458 | uint32_t sizeX;
|
---|
459 | uint32_t sizeY;
|
---|
460 | uint32_t cBackBuffers;
|
---|
461 | uint32_t Reserved;
|
---|
462 | VBOXVHWA_COLORKEY DstOverlayCK;
|
---|
463 | VBOXVHWA_COLORKEY DstBltCK;
|
---|
464 | VBOXVHWA_COLORKEY SrcOverlayCK;
|
---|
465 | VBOXVHWA_COLORKEY SrcBltCK;
|
---|
466 | VBOXVHWA_PIXELFORMAT PixelFormat;
|
---|
467 | uint32_t surfCaps;
|
---|
468 | uint32_t Reserved2;
|
---|
469 | VBOXVHWA_SURFHANDLE hSurf;
|
---|
470 | uint64_t offSurface;
|
---|
471 | } VBOXVHWA_SURFACEDESC;
|
---|
472 |
|
---|
473 | typedef struct VBOXVHWA_BLTFX
|
---|
474 | {
|
---|
475 | uint32_t flags;
|
---|
476 | uint32_t rop;
|
---|
477 | uint32_t rotationOp;
|
---|
478 | uint32_t rotation;
|
---|
479 | uint32_t fillColor;
|
---|
480 | uint32_t Reserved;
|
---|
481 | VBOXVHWA_COLORKEY DstCK;
|
---|
482 | VBOXVHWA_COLORKEY SrcCK;
|
---|
483 | } VBOXVHWA_BLTFX;
|
---|
484 |
|
---|
485 | typedef struct VBOXVHWA_OVERLAYFX
|
---|
486 | {
|
---|
487 | uint32_t flags;
|
---|
488 | uint32_t Reserved1;
|
---|
489 | uint32_t fxFlags;
|
---|
490 | uint32_t Reserved2;
|
---|
491 | VBOXVHWA_COLORKEY DstCK;
|
---|
492 | VBOXVHWA_COLORKEY SrcCK;
|
---|
493 | } VBOXVHWA_OVERLAYFX;
|
---|
494 |
|
---|
495 | #define VBOXVHWA_CAPS_BLT 0x00000040
|
---|
496 | #define VBOXVHWA_CAPS_BLTCOLORFILL 0x04000000
|
---|
497 | #define VBOXVHWA_CAPS_BLTFOURCC 0x00000100
|
---|
498 | #define VBOXVHWA_CAPS_BLTSTRETCH 0x00000200
|
---|
499 | #define VBOXVHWA_CAPS_BLTQUEUE 0x00000080
|
---|
500 |
|
---|
501 | #define VBOXVHWA_CAPS_OVERLAY 0x00000800
|
---|
502 | #define VBOXVHWA_CAPS_OVERLAYFOURCC 0x00002000
|
---|
503 | #define VBOXVHWA_CAPS_OVERLAYSTRETCH 0x00004000
|
---|
504 | #define VBOXVHWA_CAPS_OVERLAYCANTCLIP 0x00001000
|
---|
505 |
|
---|
506 | #define VBOXVHWA_CAPS_COLORKEY 0x00400000
|
---|
507 | #define VBOXVHWA_CAPS_COLORKEYHWASSIST 0x01000000
|
---|
508 |
|
---|
509 | #define VBOXVHWA_SCAPS_BACKBUFFER 0x00000004
|
---|
510 | #define VBOXVHWA_SCAPS_COMPLEX 0x00000008
|
---|
511 | #define VBOXVHWA_SCAPS_FLIP 0x00000010
|
---|
512 | #define VBOXVHWA_SCAPS_FRONTBUFFER 0x00000020
|
---|
513 | #define VBOXVHWA_SCAPS_OFFSCREENPLAIN 0x00000040
|
---|
514 | #define VBOXVHWA_SCAPS_OVERLAY 0x00000080
|
---|
515 | #define VBOXVHWA_SCAPS_PRIMARYSURFACE 0x00000200
|
---|
516 | #define VBOXVHWA_SCAPS_SYSTEMMEMORY 0x00000800
|
---|
517 | #define VBOXVHWA_SCAPS_VIDEOMEMORY 0x00004000
|
---|
518 | #define VBOXVHWA_SCAPS_VISIBLE 0x00008000
|
---|
519 | #define VBOXVHWA_SCAPS_LOCALVIDMEM 0x10000000
|
---|
520 |
|
---|
521 | #define VBOXVHWA_PF_PALETTEINDEXED8 0x00000020
|
---|
522 | #define VBOXVHWA_PF_RGB 0x00000040
|
---|
523 | #define VBOXVHWA_PF_RGBTOYUV 0x00000100
|
---|
524 | #define VBOXVHWA_PF_YUV 0x00000200
|
---|
525 | #define VBOXVHWA_PF_FOURCC 0x00000004
|
---|
526 |
|
---|
527 | #define VBOXVHWA_LOCK_DISCARDCONTENTS 0x00002000
|
---|
528 |
|
---|
529 | #define VBOXVHWA_CFG_ENABLED 0x00000001
|
---|
530 |
|
---|
531 | #define VBOXVHWA_SD_BACKBUFFERCOUNT 0x00000020
|
---|
532 | #define VBOXVHWA_SD_CAPS 0x00000001
|
---|
533 | #define VBOXVHWA_SD_CKDESTBLT 0x00004000
|
---|
534 | #define VBOXVHWA_SD_CKDESTOVERLAY 0x00002000
|
---|
535 | #define VBOXVHWA_SD_CKSRCBLT 0x00010000
|
---|
536 | #define VBOXVHWA_SD_CKSRCOVERLAY 0x00008000
|
---|
537 | #define VBOXVHWA_SD_HEIGHT 0x00000002
|
---|
538 | #define VBOXVHWA_SD_PITCH 0x00000008
|
---|
539 | #define VBOXVHWA_SD_PIXELFORMAT 0x00001000
|
---|
540 | /*#define VBOXVHWA_SD_REFRESHRATE 0x00040000*/
|
---|
541 | #define VBOXVHWA_SD_WIDTH 0x00000004
|
---|
542 |
|
---|
543 | #define VBOXVHWA_CKEYCAPS_DESTBLT 0x00000001
|
---|
544 | #define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACE 0x00000002
|
---|
545 | #define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004
|
---|
546 | #define VBOXVHWA_CKEYCAPS_DESTBLTYUV 0x00000008
|
---|
547 | #define VBOXVHWA_CKEYCAPS_DESTOVERLAY 0x00000010
|
---|
548 | #define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020
|
---|
549 | #define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040
|
---|
550 | #define VBOXVHWA_CKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080
|
---|
551 | #define VBOXVHWA_CKEYCAPS_DESTOVERLAYYUV 0x00000100
|
---|
552 | #define VBOXVHWA_CKEYCAPS_SRCBLT 0x00000200
|
---|
553 | #define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACE 0x00000400
|
---|
554 | #define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800
|
---|
555 | #define VBOXVHWA_CKEYCAPS_SRCBLTYUV 0x00001000
|
---|
556 | #define VBOXVHWA_CKEYCAPS_SRCOVERLAY 0x00002000
|
---|
557 | #define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000
|
---|
558 | #define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000
|
---|
559 | #define VBOXVHWA_CKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000
|
---|
560 | #define VBOXVHWA_CKEYCAPS_SRCOVERLAYYUV 0x00020000
|
---|
561 | #define VBOXVHWA_CKEYCAPS_NOCOSTOVERLAY 0x00040000
|
---|
562 |
|
---|
563 | #define VBOXVHWA_BLT_COLORFILL 0x00000400
|
---|
564 | #define VBOXVHWA_BLT_DDFX 0x00000800
|
---|
565 | #define VBOXVHWA_BLT_EXTENDED_FLAGS 0x40000000
|
---|
566 | #define VBOXVHWA_BLT_EXTENDED_LINEAR_CONTENT 0x00000004
|
---|
567 | #define VBOXVHWA_BLT_EXTENDED_PRESENTATION_STRETCHFACTOR 0x00000010
|
---|
568 | #define VBOXVHWA_BLT_KEYDESTOVERRIDE 0x00004000
|
---|
569 | #define VBOXVHWA_BLT_KEYSRCOVERRIDE 0x00010000
|
---|
570 | #define VBOXVHWA_BLT_LAST_PRESENTATION 0x20000000
|
---|
571 | #define VBOXVHWA_BLT_PRESENTATION 0x10000000
|
---|
572 | #define VBOXVHWA_BLT_ROP 0x00020000
|
---|
573 |
|
---|
574 |
|
---|
575 | #define VBOXVHWA_OVER_DDFX 0x00080000
|
---|
576 | #define VBOXVHWA_OVER_HIDE 0x00000200
|
---|
577 | #define VBOXVHWA_OVER_KEYDEST 0x00000400
|
---|
578 | #define VBOXVHWA_OVER_KEYDESTOVERRIDE 0x00000800
|
---|
579 | #define VBOXVHWA_OVER_KEYSRC 0x00001000
|
---|
580 | #define VBOXVHWA_OVER_KEYSRCOVERRIDE 0x00002000
|
---|
581 | #define VBOXVHWA_OVER_SHOW 0x00004000
|
---|
582 |
|
---|
583 | #define VBOXVHWA_CKEY_COLORSPACE 0x00000001
|
---|
584 | #define VBOXVHWA_CKEY_DESTBLT 0x00000002
|
---|
585 | #define VBOXVHWA_CKEY_DESTOVERLAY 0x00000004
|
---|
586 | #define VBOXVHWA_CKEY_SRCBLT 0x00000008
|
---|
587 | #define VBOXVHWA_CKEY_SRCOVERLAY 0x00000010
|
---|
588 |
|
---|
589 | #define VBOXVHWA_BLT_ARITHSTRETCHY 0x00000001
|
---|
590 | #define VBOXVHWA_BLT_MIRRORLEFTRIGHT 0x00000002
|
---|
591 | #define VBOXVHWA_BLT_MIRRORUPDOWN 0x00000004
|
---|
592 |
|
---|
593 | #define VBOXVHWA_OVERFX_ARITHSTRETCHY 0x00000001
|
---|
594 | #define VBOXVHWA_OVERFX_MIRRORLEFTRIGHT 0x00000002
|
---|
595 | #define VBOXVHWA_OVERFX_MIRRORUPDOWN 0x00000004
|
---|
596 |
|
---|
597 | #define VBOXVHWA_CAPS2_CANRENDERWINDOWED 0x00080000
|
---|
598 | #define VBOXVHWA_CAPS2_WIDESURFACES 0x00001000
|
---|
599 | #define VBOXVHWA_CAPS2_COPYFOURCC 0x00008000
|
---|
600 | /*#define VBOXVHWA_CAPS2_FLIPINTERVAL 0x00200000*/
|
---|
601 | /*#define VBOXVHWA_CAPS2_FLIPNOVSYNC 0x00400000*/
|
---|
602 |
|
---|
603 |
|
---|
604 | #define VBOXVHWA_OFFSET64_VOID (UINT64_MAX)
|
---|
605 |
|
---|
606 | typedef struct VBOXVHWA_VERSION
|
---|
607 | {
|
---|
608 | uint32_t maj;
|
---|
609 | uint32_t min;
|
---|
610 | uint32_t bld;
|
---|
611 | uint32_t reserved;
|
---|
612 | } VBOXVHWA_VERSION;
|
---|
613 |
|
---|
614 | #define VBOXVHWA_VERSION_INIT(_pv) do { \
|
---|
615 | (_pv)->maj = VBOXVHWA_VERSION_MAJ; \
|
---|
616 | (_pv)->min = VBOXVHWA_VERSION_MIN; \
|
---|
617 | (_pv)->bld = VBOXVHWA_VERSION_BLD; \
|
---|
618 | (_pv)->reserved = VBOXVHWA_VERSION_RSV; \
|
---|
619 | } while(0)
|
---|
620 |
|
---|
621 | typedef struct VBOXVHWACMD_QUERYINFO1
|
---|
622 | {
|
---|
623 | union
|
---|
624 | {
|
---|
625 | struct
|
---|
626 | {
|
---|
627 | VBOXVHWA_VERSION guestVersion;
|
---|
628 | } in;
|
---|
629 |
|
---|
630 | struct
|
---|
631 | {
|
---|
632 | uint32_t cfgFlags;
|
---|
633 | uint32_t caps;
|
---|
634 |
|
---|
635 | uint32_t caps2;
|
---|
636 | uint32_t colorKeyCaps;
|
---|
637 |
|
---|
638 | uint32_t stretchCaps;
|
---|
639 | uint32_t surfaceCaps;
|
---|
640 |
|
---|
641 | uint32_t numOverlays;
|
---|
642 | uint32_t curOverlays;
|
---|
643 |
|
---|
644 | uint32_t numFourCC;
|
---|
645 | uint32_t reserved;
|
---|
646 | } out;
|
---|
647 | } u;
|
---|
648 | } VBOXVHWACMD_QUERYINFO1;
|
---|
649 |
|
---|
650 | typedef struct VBOXVHWACMD_QUERYINFO2
|
---|
651 | {
|
---|
652 | uint32_t numFourCC;
|
---|
653 | uint32_t FourCC[1];
|
---|
654 | } VBOXVHWACMD_QUERYINFO2;
|
---|
655 |
|
---|
656 | #define VBOXVHWAINFO2_SIZE(_cFourCC) RT_UOFFSETOF_DYN(VBOXVHWACMD_QUERYINFO2, FourCC[_cFourCC])
|
---|
657 |
|
---|
658 | typedef struct VBOXVHWACMD_SURF_CANCREATE
|
---|
659 | {
|
---|
660 | VBOXVHWA_SURFACEDESC SurfInfo;
|
---|
661 | union
|
---|
662 | {
|
---|
663 | struct
|
---|
664 | {
|
---|
665 | uint32_t bIsDifferentPixelFormat;
|
---|
666 | uint32_t Reserved;
|
---|
667 | } in;
|
---|
668 |
|
---|
669 | struct
|
---|
670 | {
|
---|
671 | int32_t ErrInfo;
|
---|
672 | } out;
|
---|
673 | } u;
|
---|
674 | } VBOXVHWACMD_SURF_CANCREATE;
|
---|
675 |
|
---|
676 | typedef struct VBOXVHWACMD_SURF_CREATE
|
---|
677 | {
|
---|
678 | VBOXVHWA_SURFACEDESC SurfInfo;
|
---|
679 | } VBOXVHWACMD_SURF_CREATE;
|
---|
680 |
|
---|
681 | #ifdef VBOX_WITH_WDDM
|
---|
682 | typedef struct VBOXVHWACMD_SURF_GETINFO
|
---|
683 | {
|
---|
684 | VBOXVHWA_SURFACEDESC SurfInfo;
|
---|
685 | } VBOXVHWACMD_SURF_GETINFO;
|
---|
686 | #endif
|
---|
687 |
|
---|
688 | typedef struct VBOXVHWACMD_SURF_DESTROY
|
---|
689 | {
|
---|
690 | union
|
---|
691 | {
|
---|
692 | struct
|
---|
693 | {
|
---|
694 | VBOXVHWA_SURFHANDLE hSurf;
|
---|
695 | } in;
|
---|
696 | } u;
|
---|
697 | } VBOXVHWACMD_SURF_DESTROY;
|
---|
698 |
|
---|
699 | typedef struct VBOXVHWACMD_SURF_LOCK
|
---|
700 | {
|
---|
701 | union
|
---|
702 | {
|
---|
703 | struct
|
---|
704 | {
|
---|
705 | VBOXVHWA_SURFHANDLE hSurf;
|
---|
706 | uint64_t offSurface;
|
---|
707 | uint32_t flags;
|
---|
708 | uint32_t rectValid;
|
---|
709 | VBOXVHWA_RECTL rect;
|
---|
710 | } in;
|
---|
711 | } u;
|
---|
712 | } VBOXVHWACMD_SURF_LOCK;
|
---|
713 |
|
---|
714 | typedef struct VBOXVHWACMD_SURF_UNLOCK
|
---|
715 | {
|
---|
716 | union
|
---|
717 | {
|
---|
718 | struct
|
---|
719 | {
|
---|
720 | VBOXVHWA_SURFHANDLE hSurf;
|
---|
721 | uint32_t xUpdatedMemValid;
|
---|
722 | uint32_t reserved;
|
---|
723 | VBOXVHWA_RECTL xUpdatedMemRect;
|
---|
724 | } in;
|
---|
725 | } u;
|
---|
726 | } VBOXVHWACMD_SURF_UNLOCK;
|
---|
727 |
|
---|
728 | typedef struct VBOXVHWACMD_SURF_BLT
|
---|
729 | {
|
---|
730 | uint64_t DstGuestSurfInfo;
|
---|
731 | uint64_t SrcGuestSurfInfo;
|
---|
732 | union
|
---|
733 | {
|
---|
734 | struct
|
---|
735 | {
|
---|
736 | VBOXVHWA_SURFHANDLE hDstSurf;
|
---|
737 | uint64_t offDstSurface;
|
---|
738 | VBOXVHWA_RECTL dstRect;
|
---|
739 | VBOXVHWA_SURFHANDLE hSrcSurf;
|
---|
740 | uint64_t offSrcSurface;
|
---|
741 | VBOXVHWA_RECTL srcRect;
|
---|
742 | uint32_t flags;
|
---|
743 | uint32_t xUpdatedSrcMemValid;
|
---|
744 | VBOXVHWA_BLTFX desc;
|
---|
745 | VBOXVHWA_RECTL xUpdatedSrcMemRect;
|
---|
746 | } in;
|
---|
747 | } u;
|
---|
748 | } VBOXVHWACMD_SURF_BLT;
|
---|
749 |
|
---|
750 | #ifdef VBOX_WITH_WDDM
|
---|
751 | typedef struct VBOXVHWACMD_SURF_COLORFILL
|
---|
752 | {
|
---|
753 | union
|
---|
754 | {
|
---|
755 | struct
|
---|
756 | {
|
---|
757 | VBOXVHWA_SURFHANDLE hSurf;
|
---|
758 | uint64_t offSurface;
|
---|
759 | uint32_t u32Reserved;
|
---|
760 | uint32_t cRects;
|
---|
761 | VBOXVHWA_RECTL aRects[1];
|
---|
762 | } in;
|
---|
763 | } u;
|
---|
764 | } VBOXVHWACMD_SURF_COLORFILL;
|
---|
765 | #endif
|
---|
766 |
|
---|
767 | typedef struct VBOXVHWACMD_SURF_FLIP
|
---|
768 | {
|
---|
769 | uint64_t TargGuestSurfInfo;
|
---|
770 | uint64_t CurrGuestSurfInfo;
|
---|
771 | union
|
---|
772 | {
|
---|
773 | struct
|
---|
774 | {
|
---|
775 | VBOXVHWA_SURFHANDLE hTargSurf;
|
---|
776 | uint64_t offTargSurface;
|
---|
777 | VBOXVHWA_SURFHANDLE hCurrSurf;
|
---|
778 | uint64_t offCurrSurface;
|
---|
779 | uint32_t flags;
|
---|
780 | uint32_t xUpdatedTargMemValid;
|
---|
781 | VBOXVHWA_RECTL xUpdatedTargMemRect;
|
---|
782 | } in;
|
---|
783 | } u;
|
---|
784 | } VBOXVHWACMD_SURF_FLIP;
|
---|
785 |
|
---|
786 | typedef struct VBOXVHWACMD_SURF_COLORKEY_SET
|
---|
787 | {
|
---|
788 | union
|
---|
789 | {
|
---|
790 | struct
|
---|
791 | {
|
---|
792 | VBOXVHWA_SURFHANDLE hSurf;
|
---|
793 | uint64_t offSurface;
|
---|
794 | VBOXVHWA_COLORKEY CKey;
|
---|
795 | uint32_t flags;
|
---|
796 | uint32_t reserved;
|
---|
797 | } in;
|
---|
798 | } u;
|
---|
799 | } VBOXVHWACMD_SURF_COLORKEY_SET;
|
---|
800 |
|
---|
801 | #define VBOXVHWACMD_SURF_OVERLAY_UPDATE_F_SRCMEMRECT 0x00000001
|
---|
802 | #define VBOXVHWACMD_SURF_OVERLAY_UPDATE_F_DSTMEMRECT 0x00000002
|
---|
803 |
|
---|
804 | typedef struct VBOXVHWACMD_SURF_OVERLAY_UPDATE
|
---|
805 | {
|
---|
806 | union
|
---|
807 | {
|
---|
808 | struct
|
---|
809 | {
|
---|
810 | VBOXVHWA_SURFHANDLE hDstSurf;
|
---|
811 | uint64_t offDstSurface;
|
---|
812 | VBOXVHWA_RECTL dstRect;
|
---|
813 | VBOXVHWA_SURFHANDLE hSrcSurf;
|
---|
814 | uint64_t offSrcSurface;
|
---|
815 | VBOXVHWA_RECTL srcRect;
|
---|
816 | uint32_t flags;
|
---|
817 | uint32_t xFlags;
|
---|
818 | VBOXVHWA_OVERLAYFX desc;
|
---|
819 | VBOXVHWA_RECTL xUpdatedSrcMemRect;
|
---|
820 | VBOXVHWA_RECTL xUpdatedDstMemRect;
|
---|
821 | } in;
|
---|
822 | } u;
|
---|
823 | }VBOXVHWACMD_SURF_OVERLAY_UPDATE;
|
---|
824 |
|
---|
825 | typedef struct VBOXVHWACMD_SURF_OVERLAY_SETPOSITION
|
---|
826 | {
|
---|
827 | union
|
---|
828 | {
|
---|
829 | struct
|
---|
830 | {
|
---|
831 | VBOXVHWA_SURFHANDLE hDstSurf;
|
---|
832 | uint64_t offDstSurface;
|
---|
833 | VBOXVHWA_SURFHANDLE hSrcSurf;
|
---|
834 | uint64_t offSrcSurface;
|
---|
835 | uint32_t xPos;
|
---|
836 | uint32_t yPos;
|
---|
837 | uint32_t flags;
|
---|
838 | uint32_t reserved;
|
---|
839 | } in;
|
---|
840 | } u;
|
---|
841 | } VBOXVHWACMD_SURF_OVERLAY_SETPOSITION;
|
---|
842 |
|
---|
843 | typedef struct VBOXVHWACMD_HH_CONSTRUCT
|
---|
844 | {
|
---|
845 | void *pVM;
|
---|
846 | /* VRAM info for the backend to be able to properly translate VRAM offsets */
|
---|
847 | void *pvVRAM;
|
---|
848 | uint32_t cbVRAM;
|
---|
849 | } VBOXVHWACMD_HH_CONSTRUCT;
|
---|
850 |
|
---|
851 | typedef struct VBOXVHWACMD_HH_SAVESTATE_SAVEPERFORM
|
---|
852 | {
|
---|
853 | struct SSMHANDLE * pSSM;
|
---|
854 | } VBOXVHWACMD_HH_SAVESTATE_SAVEPERFORM;
|
---|
855 |
|
---|
856 | typedef struct VBOXVHWACMD_HH_SAVESTATE_LOADPERFORM
|
---|
857 | {
|
---|
858 | struct SSMHANDLE * pSSM;
|
---|
859 | } VBOXVHWACMD_HH_SAVESTATE_LOADPERFORM;
|
---|
860 |
|
---|
861 | typedef DECLCALLBACKTYPE(void, FNVBOXVHWA_HH_CALLBACK,(void *));
|
---|
862 | typedef FNVBOXVHWA_HH_CALLBACK *PFNVBOXVHWA_HH_CALLBACK;
|
---|
863 |
|
---|
864 | #define VBOXVHWA_HH_CALLBACK_SET(_pCmd, _pfn, _parg) \
|
---|
865 | do { \
|
---|
866 | (_pCmd)->GuestVBVAReserved1 = (uint64_t)(uintptr_t)(_pfn); \
|
---|
867 | (_pCmd)->GuestVBVAReserved2 = (uint64_t)(uintptr_t)(_parg); \
|
---|
868 | }while(0)
|
---|
869 |
|
---|
870 | #define VBOXVHWA_HH_CALLBACK_GET(_pCmd) ((PFNVBOXVHWA_HH_CALLBACK)(_pCmd)->GuestVBVAReserved1)
|
---|
871 | #define VBOXVHWA_HH_CALLBACK_GET_ARG(_pCmd) ((void*)(_pCmd)->GuestVBVAReserved2)
|
---|
872 |
|
---|
873 | #pragma pack()
|
---|
874 | #endif /* #ifdef VBOX_WITH_VIDEOHWACCEL */
|
---|
875 |
|
---|
876 | /* All structures are without alignment. */
|
---|
877 | #pragma pack(1)
|
---|
878 |
|
---|
879 | typedef struct VBVAHOSTFLAGS
|
---|
880 | {
|
---|
881 | uint32_t u32HostEvents;
|
---|
882 | uint32_t u32SupportedOrders;
|
---|
883 | } VBVAHOSTFLAGS;
|
---|
884 |
|
---|
885 | typedef struct VBVABUFFER
|
---|
886 | {
|
---|
887 | VBVAHOSTFLAGS hostFlags;
|
---|
888 |
|
---|
889 | /* The offset where the data start in the buffer. */
|
---|
890 | uint32_t off32Data;
|
---|
891 | /* The offset where next data must be placed in the buffer. */
|
---|
892 | uint32_t off32Free;
|
---|
893 |
|
---|
894 | /* The queue of record descriptions. */
|
---|
895 | VBVARECORD aRecords[VBVA_MAX_RECORDS];
|
---|
896 | uint32_t indexRecordFirst;
|
---|
897 | uint32_t indexRecordFree;
|
---|
898 |
|
---|
899 | /* Space to leave free in the buffer when large partial records are transferred. */
|
---|
900 | uint32_t cbPartialWriteThreshold;
|
---|
901 |
|
---|
902 | uint32_t cbData;
|
---|
903 | uint8_t au8Data[1]; /* variable size for the rest of the VBVABUFFER area in VRAM. */
|
---|
904 | } VBVABUFFER;
|
---|
905 |
|
---|
906 | #define VBVA_MAX_RECORD_SIZE (128*_1M)
|
---|
907 |
|
---|
908 | /* guest->host commands */
|
---|
909 | #define VBVA_QUERY_CONF32 1
|
---|
910 | #define VBVA_SET_CONF32 2
|
---|
911 | #define VBVA_INFO_VIEW 3
|
---|
912 | #define VBVA_INFO_HEAP 4
|
---|
913 | #define VBVA_FLUSH 5
|
---|
914 | #define VBVA_INFO_SCREEN 6
|
---|
915 | /** Enables or disables VBVA. Enabling VBVA without disabling it before
|
---|
916 | * causes a complete screen update. */
|
---|
917 | #define VBVA_ENABLE 7
|
---|
918 | #define VBVA_MOUSE_POINTER_SHAPE 8
|
---|
919 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
920 | # define VBVA_VHWA_CMD 9
|
---|
921 | #endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
|
---|
922 | #ifdef VBOX_WITH_VDMA
|
---|
923 | # define VBVA_VDMA_CTL 10 /* setup G<->H DMA channel info */
|
---|
924 | # define VBVA_VDMA_CMD 11 /* G->H DMA command */
|
---|
925 | #endif
|
---|
926 | #define VBVA_INFO_CAPS 12 /* informs host about HGSMI caps. see VBVACAPS below */
|
---|
927 | #define VBVA_SCANLINE_CFG 13 /* configures scanline, see VBVASCANLINECFG below */
|
---|
928 | #define VBVA_SCANLINE_INFO 14 /* requests scanline info, see VBVASCANLINEINFO below */
|
---|
929 | #define VBVA_CMDVBVA_SUBMIT 16 /* inform host about VBVA Command submission */
|
---|
930 | #define VBVA_CMDVBVA_FLUSH 17 /* inform host about VBVA Command submission */
|
---|
931 | #define VBVA_CMDVBVA_CTL 18 /* G->H DMA command */
|
---|
932 | #define VBVA_QUERY_MODE_HINTS 19 /* Query most recent mode hints sent. */
|
---|
933 | /** Report the guest virtual desktop position and size for mapping host and
|
---|
934 | * guest pointer positions. */
|
---|
935 | #define VBVA_REPORT_INPUT_MAPPING 20
|
---|
936 | /** Report the guest cursor position and query the host position. */
|
---|
937 | #define VBVA_CURSOR_POSITION 21
|
---|
938 |
|
---|
939 | /* host->guest commands */
|
---|
940 | #define VBVAHG_EVENT 1
|
---|
941 | #define VBVAHG_DISPLAY_CUSTOM 2
|
---|
942 | #ifdef VBOX_WITH_VDMA
|
---|
943 | #define VBVAHG_SHGSMI_COMPLETION 3
|
---|
944 | #endif
|
---|
945 |
|
---|
946 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
947 | #define VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE 1
|
---|
948 | #pragma pack(1)
|
---|
949 | typedef struct VBVAHOSTCMDVHWACMDCOMPLETE
|
---|
950 | {
|
---|
951 | uint32_t offCmd;
|
---|
952 | }VBVAHOSTCMDVHWACMDCOMPLETE;
|
---|
953 | #pragma pack()
|
---|
954 | #endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
|
---|
955 |
|
---|
956 | #pragma pack(1)
|
---|
957 | typedef enum
|
---|
958 | {
|
---|
959 | VBVAHOSTCMD_OP_EVENT = 1,
|
---|
960 | VBVAHOSTCMD_OP_CUSTOM
|
---|
961 | }VBVAHOSTCMD_OP_TYPE;
|
---|
962 |
|
---|
963 | typedef struct VBVAHOSTCMDEVENT
|
---|
964 | {
|
---|
965 | uint64_t pEvent;
|
---|
966 | }VBVAHOSTCMDEVENT;
|
---|
967 |
|
---|
968 |
|
---|
969 | typedef struct VBVAHOSTCMD
|
---|
970 | {
|
---|
971 | /* destination ID if >=0 specifies display index, otherwize the command is directed to the miniport */
|
---|
972 | int32_t iDstID;
|
---|
973 | int32_t customOpCode;
|
---|
974 | union
|
---|
975 | {
|
---|
976 | struct VBVAHOSTCMD *pNext;
|
---|
977 | uint32_t offNext;
|
---|
978 | uint64_t Data; /* the body is 64-bit aligned */
|
---|
979 | } u;
|
---|
980 | char body[1];
|
---|
981 | } VBVAHOSTCMD;
|
---|
982 |
|
---|
983 | #define VBVAHOSTCMD_SIZE(a_cb) (sizeof(VBVAHOSTCMD) + (a_cb))
|
---|
984 | #define VBVAHOSTCMD_BODY(a_pCmd, a_TypeBody) ((a_TypeBody RT_UNTRUSTED_VOLATILE_HSTGST *)&(a_pCmd)->body[0])
|
---|
985 | #define VBVAHOSTCMD_HDR(a_pBody) \
|
---|
986 | ( (VBVAHOSTCMD RT_UNTRUSTED_VOLATILE_HSTGST *)( (uint8_t *)(a_pBody) - RT_OFFSETOF(VBVAHOSTCMD, body)) )
|
---|
987 | #define VBVAHOSTCMD_HDRSIZE (RT_OFFSETOF(VBVAHOSTCMD, body))
|
---|
988 |
|
---|
989 | #pragma pack()
|
---|
990 |
|
---|
991 | /* VBVACONF32::u32Index */
|
---|
992 | #define VBOX_VBVA_CONF32_MONITOR_COUNT 0
|
---|
993 | #define VBOX_VBVA_CONF32_HOST_HEAP_SIZE 1
|
---|
994 | /** Returns VINF_SUCCESS if the host can report mode hints via VBVA.
|
---|
995 | * Set value to VERR_NOT_SUPPORTED before calling. */
|
---|
996 | #define VBOX_VBVA_CONF32_MODE_HINT_REPORTING 2
|
---|
997 | /** Returns VINF_SUCCESS if the host can report guest cursor enabled status via
|
---|
998 | * VBVA. Set value to VERR_NOT_SUPPORTED before calling. */
|
---|
999 | #define VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING 3
|
---|
1000 | /** Returns the currently available host cursor capabilities. Available if
|
---|
1001 | * VBVACONF32::VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING returns success.
|
---|
1002 | * @see VMMDevReqMouseStatus::mouseFeatures. */
|
---|
1003 | #define VBOX_VBVA_CONF32_CURSOR_CAPABILITIES 4
|
---|
1004 | /** Returns the supported flags in VBVAINFOSCREEN::u8Flags. */
|
---|
1005 | #define VBOX_VBVA_CONF32_SCREEN_FLAGS 5
|
---|
1006 | /** Returns the max size of VBVA record. */
|
---|
1007 | #define VBOX_VBVA_CONF32_MAX_RECORD_SIZE 6
|
---|
1008 |
|
---|
1009 | typedef struct VBVACONF32
|
---|
1010 | {
|
---|
1011 | uint32_t u32Index;
|
---|
1012 | uint32_t u32Value;
|
---|
1013 | } VBVACONF32;
|
---|
1014 |
|
---|
1015 | /** Reserved for historical reasons. */
|
---|
1016 | #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED0 RT_BIT(0)
|
---|
1017 | /** Guest cursor capability: can the host show a hardware cursor at the host
|
---|
1018 | * pointer location? */
|
---|
1019 | #define VBOX_VBVA_CURSOR_CAPABILITY_HARDWARE RT_BIT(1)
|
---|
1020 | /** Reserved for historical reasons. */
|
---|
1021 | #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED2 RT_BIT(2)
|
---|
1022 | /** Reserved for historical reasons. Must always be unset. */
|
---|
1023 | #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED3 RT_BIT(3)
|
---|
1024 | /** Reserved for historical reasons. */
|
---|
1025 | #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED4 RT_BIT(4)
|
---|
1026 | /** Reserved for historical reasons. */
|
---|
1027 | #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED5 RT_BIT(5)
|
---|
1028 |
|
---|
1029 | typedef struct VBVAINFOVIEW
|
---|
1030 | {
|
---|
1031 | /* Index of the screen, assigned by the guest. */
|
---|
1032 | uint32_t u32ViewIndex;
|
---|
1033 |
|
---|
1034 | /* The screen offset in VRAM, the framebuffer starts here. */
|
---|
1035 | uint32_t u32ViewOffset;
|
---|
1036 |
|
---|
1037 | /* The size of the VRAM memory that can be used for the view. */
|
---|
1038 | uint32_t u32ViewSize;
|
---|
1039 |
|
---|
1040 | /* The recommended maximum size of the VRAM memory for the screen. */
|
---|
1041 | uint32_t u32MaxScreenSize;
|
---|
1042 | } VBVAINFOVIEW;
|
---|
1043 |
|
---|
1044 | typedef struct VBVAINFOHEAP
|
---|
1045 | {
|
---|
1046 | /* Absolute offset in VRAM of the start of the heap. */
|
---|
1047 | uint32_t u32HeapOffset;
|
---|
1048 |
|
---|
1049 | /* The size of the heap. */
|
---|
1050 | uint32_t u32HeapSize;
|
---|
1051 |
|
---|
1052 | } VBVAINFOHEAP;
|
---|
1053 |
|
---|
1054 | typedef struct VBVAFLUSH
|
---|
1055 | {
|
---|
1056 | uint32_t u32Reserved;
|
---|
1057 |
|
---|
1058 | } VBVAFLUSH;
|
---|
1059 |
|
---|
1060 | typedef struct VBVACMDVBVASUBMIT
|
---|
1061 | {
|
---|
1062 | uint32_t u32Reserved;
|
---|
1063 | } VBVACMDVBVASUBMIT;
|
---|
1064 |
|
---|
1065 | /* flush is requested because due to guest command buffer overflow */
|
---|
1066 | #define VBVACMDVBVAFLUSH_F_GUEST_BUFFER_OVERFLOW 1
|
---|
1067 |
|
---|
1068 | typedef struct VBVACMDVBVAFLUSH
|
---|
1069 | {
|
---|
1070 | uint32_t u32Flags;
|
---|
1071 | } VBVACMDVBVAFLUSH;
|
---|
1072 |
|
---|
1073 |
|
---|
1074 | /* VBVAINFOSCREEN::u8Flags */
|
---|
1075 | #define VBVA_SCREEN_F_NONE 0x0000
|
---|
1076 | #define VBVA_SCREEN_F_ACTIVE 0x0001
|
---|
1077 | /** The virtual monitor has been disabled by the guest and should be removed
|
---|
1078 | * by the host and ignored for purposes of pointer position calculation. */
|
---|
1079 | #define VBVA_SCREEN_F_DISABLED 0x0002
|
---|
1080 | /** The virtual monitor has been blanked by the guest and should be blacked
|
---|
1081 | * out by the host using width, height, etc values from the VBVAINFOSCREEN request. */
|
---|
1082 | #define VBVA_SCREEN_F_BLANK 0x0004
|
---|
1083 | /** The virtual monitor has been blanked by the guest and should be blacked
|
---|
1084 | * out by the host using the previous mode values for width. height, etc. */
|
---|
1085 | #define VBVA_SCREEN_F_BLANK2 0x0008
|
---|
1086 |
|
---|
1087 | typedef struct VBVAINFOSCREEN
|
---|
1088 | {
|
---|
1089 | /* Which view contains the screen. */
|
---|
1090 | uint32_t u32ViewIndex;
|
---|
1091 |
|
---|
1092 | /* Physical X origin relative to the primary screen. */
|
---|
1093 | int32_t i32OriginX;
|
---|
1094 |
|
---|
1095 | /* Physical Y origin relative to the primary screen. */
|
---|
1096 | int32_t i32OriginY;
|
---|
1097 |
|
---|
1098 | /* Offset of visible framebuffer relative to the framebuffer start. */
|
---|
1099 | uint32_t u32StartOffset;
|
---|
1100 |
|
---|
1101 | /* The scan line size in bytes. */
|
---|
1102 | uint32_t u32LineSize;
|
---|
1103 |
|
---|
1104 | /* Width of the screen. */
|
---|
1105 | uint32_t u32Width;
|
---|
1106 |
|
---|
1107 | /* Height of the screen. */
|
---|
1108 | uint32_t u32Height;
|
---|
1109 |
|
---|
1110 | /* Color depth. */
|
---|
1111 | uint16_t u16BitsPerPixel;
|
---|
1112 |
|
---|
1113 | /* VBVA_SCREEN_F_* */
|
---|
1114 | uint16_t u16Flags;
|
---|
1115 | } VBVAINFOSCREEN;
|
---|
1116 |
|
---|
1117 |
|
---|
1118 | /* VBVAENABLE::u32Flags */
|
---|
1119 | #define VBVA_F_NONE 0x00000000
|
---|
1120 | #define VBVA_F_ENABLE 0x00000001
|
---|
1121 | #define VBVA_F_DISABLE 0x00000002
|
---|
1122 | /* extended VBVA to be used with WDDM */
|
---|
1123 | #define VBVA_F_EXTENDED 0x00000004
|
---|
1124 | /* vbva offset is absolute VRAM offset */
|
---|
1125 | #define VBVA_F_ABSOFFSET 0x00000008
|
---|
1126 |
|
---|
1127 | typedef struct VBVAENABLE
|
---|
1128 | {
|
---|
1129 | uint32_t u32Flags;
|
---|
1130 | uint32_t u32Offset;
|
---|
1131 | int32_t i32Result;
|
---|
1132 | } VBVAENABLE;
|
---|
1133 |
|
---|
1134 | typedef struct VBVAENABLE_EX
|
---|
1135 | {
|
---|
1136 | VBVAENABLE Base;
|
---|
1137 | uint32_t u32ScreenId;
|
---|
1138 | } VBVAENABLE_EX;
|
---|
1139 |
|
---|
1140 |
|
---|
1141 | typedef struct VBVAMOUSEPOINTERSHAPE
|
---|
1142 | {
|
---|
1143 | /* The host result. */
|
---|
1144 | int32_t i32Result;
|
---|
1145 |
|
---|
1146 | /* VBOX_MOUSE_POINTER_* bit flags. */
|
---|
1147 | uint32_t fu32Flags;
|
---|
1148 |
|
---|
1149 | /* X coordinate of the hot spot. */
|
---|
1150 | uint32_t u32HotX;
|
---|
1151 |
|
---|
1152 | /* Y coordinate of the hot spot. */
|
---|
1153 | uint32_t u32HotY;
|
---|
1154 |
|
---|
1155 | /* Width of the pointer in pixels. */
|
---|
1156 | uint32_t u32Width;
|
---|
1157 |
|
---|
1158 | /* Height of the pointer in scanlines. */
|
---|
1159 | uint32_t u32Height;
|
---|
1160 |
|
---|
1161 | /* Pointer data.
|
---|
1162 | *
|
---|
1163 | ****
|
---|
1164 | * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
|
---|
1165 | *
|
---|
1166 | * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
|
---|
1167 | * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
|
---|
1168 | *
|
---|
1169 | * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
|
---|
1170 | * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
|
---|
1171 | * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
|
---|
1172 | *
|
---|
1173 | * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
|
---|
1174 | * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
|
---|
1175 | * end of any scanline are undefined.
|
---|
1176 | *
|
---|
1177 | * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
|
---|
1178 | * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
|
---|
1179 | * Bytes in the gap between the AND and the XOR mask are undefined.
|
---|
1180 | * XOR mask scanlines have no gap between them and size of XOR mask is:
|
---|
1181 | * cXor = width * 4 * height.
|
---|
1182 | ****
|
---|
1183 | *
|
---|
1184 | * Preallocate 4 bytes for accessing actual data as p->au8Data.
|
---|
1185 | */
|
---|
1186 | uint8_t au8Data[4];
|
---|
1187 |
|
---|
1188 | } VBVAMOUSEPOINTERSHAPE;
|
---|
1189 |
|
---|
1190 | /** @name VBVAMOUSEPOINTERSHAPE::fu32Flags
|
---|
1191 | * @note The VBOX_MOUSE_POINTER_* flags are used in the guest video driver,
|
---|
1192 | * values must be <= 0x8000 and must not be changed. (try make more sense
|
---|
1193 | * of this, please).
|
---|
1194 | * @{
|
---|
1195 | */
|
---|
1196 | /** pointer is visible */
|
---|
1197 | #define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
|
---|
1198 | /** pointer has alpha channel */
|
---|
1199 | #define VBOX_MOUSE_POINTER_ALPHA (0x0002)
|
---|
1200 | /** pointerData contains new pointer shape */
|
---|
1201 | #define VBOX_MOUSE_POINTER_SHAPE (0x0004)
|
---|
1202 | /** @} */
|
---|
1203 |
|
---|
1204 | /* the guest driver can handle asynch guest cmd completion by reading the command offset from io port */
|
---|
1205 | #define VBVACAPS_COMPLETEGCMD_BY_IOREAD 0x00000001
|
---|
1206 | /* the guest driver can handle video adapter IRQs */
|
---|
1207 | #define VBVACAPS_IRQ 0x00000002
|
---|
1208 | /** The guest can read video mode hints sent via VBVA. */
|
---|
1209 | #define VBVACAPS_VIDEO_MODE_HINTS 0x00000004
|
---|
1210 | /** The guest can switch to a software cursor on demand. */
|
---|
1211 | #define VBVACAPS_DISABLE_CURSOR_INTEGRATION 0x00000008
|
---|
1212 | /** The guest does not depend on host handling the VBE registers. */
|
---|
1213 | #define VBVACAPS_USE_VBVA_ONLY 0x00000010
|
---|
1214 | typedef struct VBVACAPS
|
---|
1215 | {
|
---|
1216 | int32_t rc;
|
---|
1217 | uint32_t fCaps;
|
---|
1218 | } VBVACAPS;
|
---|
1219 |
|
---|
1220 | /* makes graphics device generate IRQ on VSYNC */
|
---|
1221 | #define VBVASCANLINECFG_ENABLE_VSYNC_IRQ 0x00000001
|
---|
1222 | /* guest driver may request the current scanline */
|
---|
1223 | #define VBVASCANLINECFG_ENABLE_SCANLINE_INFO 0x00000002
|
---|
1224 | /* request the current refresh period, returned in u32RefreshPeriodMs */
|
---|
1225 | #define VBVASCANLINECFG_QUERY_REFRESH_PERIOD 0x00000004
|
---|
1226 | /* set new refresh period specified in u32RefreshPeriodMs.
|
---|
1227 | * if used with VBVASCANLINECFG_QUERY_REFRESH_PERIOD,
|
---|
1228 | * u32RefreshPeriodMs is set to the previous refresh period on return */
|
---|
1229 | #define VBVASCANLINECFG_SET_REFRESH_PERIOD 0x00000008
|
---|
1230 |
|
---|
1231 | typedef struct VBVASCANLINECFG
|
---|
1232 | {
|
---|
1233 | int32_t rc;
|
---|
1234 | uint32_t fFlags;
|
---|
1235 | uint32_t u32RefreshPeriodMs;
|
---|
1236 | uint32_t u32Reserved;
|
---|
1237 | } VBVASCANLINECFG;
|
---|
1238 |
|
---|
1239 | typedef struct VBVASCANLINEINFO
|
---|
1240 | {
|
---|
1241 | int32_t rc;
|
---|
1242 | uint32_t u32ScreenId;
|
---|
1243 | uint32_t u32InVBlank;
|
---|
1244 | uint32_t u32ScanLine;
|
---|
1245 | } VBVASCANLINEINFO;
|
---|
1246 |
|
---|
1247 | /** Query the most recent mode hints received from the host. */
|
---|
1248 | typedef struct VBVAQUERYMODEHINTS
|
---|
1249 | {
|
---|
1250 | /** The maximum number of screens to return hints for. */
|
---|
1251 | uint16_t cHintsQueried;
|
---|
1252 | /** The size of the mode hint structures directly following this one. */
|
---|
1253 | uint16_t cbHintStructureGuest;
|
---|
1254 | /** The return code for the operation. Initialise to VERR_NOT_SUPPORTED. */
|
---|
1255 | int32_t rc;
|
---|
1256 | } VBVAQUERYMODEHINTS;
|
---|
1257 |
|
---|
1258 | /** Structure in which a mode hint is returned. The guest allocates an array
|
---|
1259 | * of these immediately after the VBVAQUERYMODEHINTS structure. To accomodate
|
---|
1260 | * future extensions, the VBVAQUERYMODEHINTS structure specifies the size of
|
---|
1261 | * the VBVAMODEHINT structures allocated by the guest, and the host only fills
|
---|
1262 | * out structure elements which fit into that size. The host should fill any
|
---|
1263 | * unused members (e.g. dx, dy) or structure space on the end with ~0. The
|
---|
1264 | * whole structure can legally be set to ~0 to skip a screen. */
|
---|
1265 | typedef struct VBVAMODEHINT
|
---|
1266 | {
|
---|
1267 | uint32_t magic;
|
---|
1268 | uint32_t cx;
|
---|
1269 | uint32_t cy;
|
---|
1270 | uint32_t cBPP; /* Which has never been used... */
|
---|
1271 | uint32_t cDisplay;
|
---|
1272 | uint32_t dx; /**< X offset into the virtual frame-buffer. */
|
---|
1273 | uint32_t dy; /**< Y offset into the virtual frame-buffer. */
|
---|
1274 | uint32_t fEnabled; /* Not fFlags. Add new members for new flags. */
|
---|
1275 | } VBVAMODEHINT;
|
---|
1276 |
|
---|
1277 | #define VBVAMODEHINT_MAGIC UINT32_C(0x0801add9)
|
---|
1278 |
|
---|
1279 | /** Report the rectangle relative to which absolute pointer events should be
|
---|
1280 | * expressed. This information remains valid until the next VBVA resize event
|
---|
1281 | * for any screen, at which time it is reset to the bounding rectangle of all
|
---|
1282 | * virtual screens and must be re-set.
|
---|
1283 | * @see VBVA_REPORT_INPUT_MAPPING. */
|
---|
1284 | typedef struct VBVAREPORTINPUTMAPPING
|
---|
1285 | {
|
---|
1286 | int32_t x; /**< Upper left X co-ordinate relative to the first screen. */
|
---|
1287 | int32_t y; /**< Upper left Y co-ordinate relative to the first screen. */
|
---|
1288 | uint32_t cx; /**< Rectangle width. */
|
---|
1289 | uint32_t cy; /**< Rectangle height. */
|
---|
1290 | } VBVAREPORTINPUTMAPPING;
|
---|
1291 |
|
---|
1292 | /** Report the guest cursor position and query the host one. The host may wish
|
---|
1293 | * to use the guest information to re-position its own cursor, particularly
|
---|
1294 | * when the cursor is captured and the guest does not support switching to a
|
---|
1295 | * software cursor. After every mode switch the guest must signal that it
|
---|
1296 | * supports sending position information by sending an event with
|
---|
1297 | * @a fReportPosition set to false.
|
---|
1298 | * @see VBVA_CURSOR_POSITION */
|
---|
1299 | typedef struct VBVACURSORPOSITION
|
---|
1300 | {
|
---|
1301 | uint32_t fReportPosition; /**< Are we reporting a position? */
|
---|
1302 | uint32_t x; /**< Guest cursor X position */
|
---|
1303 | uint32_t y; /**< Guest cursor Y position */
|
---|
1304 | } VBVACURSORPOSITION;
|
---|
1305 |
|
---|
1306 | #pragma pack()
|
---|
1307 |
|
---|
1308 | typedef uint64_t VBOXVIDEOOFFSET;
|
---|
1309 |
|
---|
1310 | #define VBOXVIDEOOFFSET_VOID ((VBOXVIDEOOFFSET)~0)
|
---|
1311 |
|
---|
1312 | #pragma pack(1)
|
---|
1313 |
|
---|
1314 | /*
|
---|
1315 | * VBOXSHGSMI made on top HGSMI and allows receiving notifications
|
---|
1316 | * about G->H command completion
|
---|
1317 | */
|
---|
1318 | /* SHGSMI command header */
|
---|
1319 | typedef struct VBOXSHGSMIHEADER
|
---|
1320 | {
|
---|
1321 | uint64_t pvNext; /*<- completion processing queue */
|
---|
1322 | uint32_t fFlags; /*<- see VBOXSHGSMI_FLAG_XXX Flags */
|
---|
1323 | uint32_t cRefs; /*<- command referece count */
|
---|
1324 | uint64_t u64Info1; /*<- contents depends on the fFlags value */
|
---|
1325 | uint64_t u64Info2; /*<- contents depends on the fFlags value */
|
---|
1326 | } VBOXSHGSMIHEADER, *PVBOXSHGSMIHEADER;
|
---|
1327 |
|
---|
1328 | typedef enum
|
---|
1329 | {
|
---|
1330 | VBOXVDMACMD_TYPE_UNDEFINED = 0,
|
---|
1331 | VBOXVDMACMD_TYPE_DMA_PRESENT_BLT = 1,
|
---|
1332 | VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER,
|
---|
1333 | VBOXVDMACMD_TYPE_DMA_BPB_FILL,
|
---|
1334 | VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY,
|
---|
1335 | VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL,
|
---|
1336 | VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP,
|
---|
1337 | VBOXVDMACMD_TYPE_DMA_NOP,
|
---|
1338 | VBOXVDMACMD_TYPE_CHROMIUM_CMD, /* chromium cmd */
|
---|
1339 | VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER_VRAMSYS,
|
---|
1340 | VBOXVDMACMD_TYPE_CHILD_STATUS_IRQ /* make the device notify child (monitor) state change IRQ */
|
---|
1341 | } VBOXVDMACMD_TYPE;
|
---|
1342 |
|
---|
1343 | #pragma pack()
|
---|
1344 |
|
---|
1345 | /* the command processing was asynch, set by the host to indicate asynch command completion
|
---|
1346 | * must not be cleared once set, the command completion is performed by issuing a host->guest completion command
|
---|
1347 | * while keeping this flag unchanged */
|
---|
1348 | #define VBOXSHGSMI_FLAG_HG_ASYNCH 0x00010000
|
---|
1349 | #if 0
|
---|
1350 | /* if set - asynch completion is performed by issuing the event,
|
---|
1351 | * if cleared - asynch completion is performed by calling a callback */
|
---|
1352 | #define VBOXSHGSMI_FLAG_GH_ASYNCH_EVENT 0x00000001
|
---|
1353 | #endif
|
---|
1354 | /* issue interrupt on asynch completion, used for critical G->H commands,
|
---|
1355 | * i.e. for completion of which guest is waiting. */
|
---|
1356 | #define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ 0x00000002
|
---|
1357 | /* guest does not do any op on completion of this command,
|
---|
1358 | * the host may copy the command and indicate that it does not need the command anymore
|
---|
1359 | * by not setting VBOXSHGSMI_FLAG_HG_ASYNCH */
|
---|
1360 | #define VBOXSHGSMI_FLAG_GH_ASYNCH_NOCOMPLETION 0x00000004
|
---|
1361 | /* guest requires the command to be processed asynchronously,
|
---|
1362 | * not setting VBOXSHGSMI_FLAG_HG_ASYNCH by the host in this case is treated as command failure */
|
---|
1363 | #define VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE 0x00000008
|
---|
1364 | /* force IRQ on cmd completion */
|
---|
1365 | #define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ_FORCE 0x00000010
|
---|
1366 | /* an IRQ-level callback is associated with the command */
|
---|
1367 | #define VBOXSHGSMI_FLAG_GH_ASYNCH_CALLBACK_IRQ 0x00000020
|
---|
1368 | /* guest expects this command to be completed synchronously */
|
---|
1369 | #define VBOXSHGSMI_FLAG_GH_SYNCH 0x00000040
|
---|
1370 |
|
---|
1371 |
|
---|
1372 | DECLINLINE(uint8_t RT_UNTRUSTED_VOLATILE_GUEST *)
|
---|
1373 | VBoxSHGSMIBufferData(const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHeader)
|
---|
1374 | {
|
---|
1375 | return (uint8_t RT_UNTRUSTED_VOLATILE_GUEST *)pHeader + sizeof(VBOXSHGSMIHEADER);
|
---|
1376 | }
|
---|
1377 |
|
---|
1378 | #define VBoxSHGSMIBufferHeaderSize() (sizeof(VBOXSHGSMIHEADER))
|
---|
1379 |
|
---|
1380 | DECLINLINE(VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *) VBoxSHGSMIBufferHeader(const void RT_UNTRUSTED_VOLATILE_GUEST *pvData)
|
---|
1381 | {
|
---|
1382 | return (VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *)((uintptr_t)pvData - sizeof(VBOXSHGSMIHEADER));
|
---|
1383 | }
|
---|
1384 |
|
---|
1385 | #ifdef VBOX_WITH_VDMA
|
---|
1386 | # pragma pack(1)
|
---|
1387 |
|
---|
1388 | /* VDMA - Video DMA */
|
---|
1389 |
|
---|
1390 | /* VDMA Control API */
|
---|
1391 | /* VBOXVDMA_CTL::u32Flags */
|
---|
1392 | typedef enum
|
---|
1393 | {
|
---|
1394 | VBOXVDMA_CTL_TYPE_NONE = 0,
|
---|
1395 | VBOXVDMA_CTL_TYPE_ENABLE,
|
---|
1396 | VBOXVDMA_CTL_TYPE_DISABLE,
|
---|
1397 | VBOXVDMA_CTL_TYPE_FLUSH,
|
---|
1398 | VBOXVDMA_CTL_TYPE_WATCHDOG,
|
---|
1399 | VBOXVDMA_CTL_TYPE_END
|
---|
1400 | } VBOXVDMA_CTL_TYPE;
|
---|
1401 |
|
---|
1402 | typedef struct VBOXVDMA_CTL
|
---|
1403 | {
|
---|
1404 | VBOXVDMA_CTL_TYPE enmCtl;
|
---|
1405 | uint32_t u32Offset;
|
---|
1406 | int32_t i32Result;
|
---|
1407 | } VBOXVDMA_CTL;
|
---|
1408 |
|
---|
1409 | /* VBOXVDMACBUF_DR::phBuf specifies offset in VRAM */
|
---|
1410 | #define VBOXVDMACBUF_FLAG_BUF_VRAM_OFFSET 0x00000001
|
---|
1411 | /* command buffer follows the VBOXVDMACBUF_DR in VRAM, VBOXVDMACBUF_DR::phBuf is ignored */
|
---|
1412 | #define VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR 0x00000002
|
---|
1413 |
|
---|
1414 | /**
|
---|
1415 | * We can not submit the DMA command via VRAM since we do not have control over
|
---|
1416 | * DMA command buffer [de]allocation, i.e. we only control the buffer contents.
|
---|
1417 | * In other words the system may call one of our callbacks to fill a command buffer
|
---|
1418 | * with the necessary commands and then discard the buffer w/o any notification.
|
---|
1419 | *
|
---|
1420 | * We have only DMA command buffer physical address at submission time.
|
---|
1421 | *
|
---|
1422 | * so the only way is to */
|
---|
1423 | typedef struct VBOXVDMACBUF_DR
|
---|
1424 | {
|
---|
1425 | uint16_t fFlags;
|
---|
1426 | uint16_t cbBuf;
|
---|
1427 | /* RT_SUCCESS() - on success
|
---|
1428 | * VERR_INTERRUPTED - on preemption
|
---|
1429 | * VERR_xxx - on error */
|
---|
1430 | int32_t rc;
|
---|
1431 | union
|
---|
1432 | {
|
---|
1433 | uint64_t phBuf;
|
---|
1434 | VBOXVIDEOOFFSET offVramBuf;
|
---|
1435 | } Location;
|
---|
1436 | uint64_t aGuestData[7];
|
---|
1437 | } VBOXVDMACBUF_DR, *PVBOXVDMACBUF_DR;
|
---|
1438 |
|
---|
1439 | #define VBOXVDMACBUF_DR_TAIL(a_pCmd, a_TailType) \
|
---|
1440 | ( (a_TailType RT_UNTRUSTED_VOLATILE_HSTGST *)( ((uint8_t*)(a_pCmd)) + sizeof(VBOXVDMACBUF_DR)) )
|
---|
1441 | #define VBOXVDMACBUF_DR_FROM_TAIL(a_pCmd) \
|
---|
1442 | ( (VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HSTGST *)( ((uint8_t*)(a_pCmd)) - sizeof(VBOXVDMACBUF_DR)) )
|
---|
1443 |
|
---|
1444 | typedef struct VBOXVDMACMD
|
---|
1445 | {
|
---|
1446 | VBOXVDMACMD_TYPE enmType;
|
---|
1447 | uint32_t u32CmdSpecific;
|
---|
1448 | } VBOXVDMACMD;
|
---|
1449 |
|
---|
1450 | #define VBOXVDMACMD_HEADER_SIZE() sizeof(VBOXVDMACMD)
|
---|
1451 | #define VBOXVDMACMD_SIZE_FROMBODYSIZE(_s) ((uint32_t)(VBOXVDMACMD_HEADER_SIZE() + (_s)))
|
---|
1452 | #define VBOXVDMACMD_SIZE(_t) (VBOXVDMACMD_SIZE_FROMBODYSIZE(sizeof(_t)))
|
---|
1453 | #define VBOXVDMACMD_BODY(a_pCmd, a_TypeBody) \
|
---|
1454 | ( (a_TypeBody RT_UNTRUSTED_VOLATILE_HSTGST *)( ((uint8_t *)(a_pCmd)) + VBOXVDMACMD_HEADER_SIZE()) )
|
---|
1455 | #define VBOXVDMACMD_BODY_SIZE(_s) ( (_s) - VBOXVDMACMD_HEADER_SIZE() )
|
---|
1456 | #define VBOXVDMACMD_FROM_BODY(a_pBody) \
|
---|
1457 | ( (VBOXVDMACMD RT_UNTRUSTED_VOLATILE_HSTGST *)( ((uint8_t *)(a_pBody)) - VBOXVDMACMD_HEADER_SIZE()) )
|
---|
1458 | #define VBOXVDMACMD_BODY_FIELD_OFFSET(_ot, _t, _f) ( (_ot)(uintptr_t)( VBOXVDMACMD_BODY(0, uint8_t) + RT_UOFFSETOF_DYN(_t, _f) ) )
|
---|
1459 |
|
---|
1460 | # pragma pack()
|
---|
1461 | #endif /* #ifdef VBOX_WITH_VDMA */
|
---|
1462 |
|
---|
1463 |
|
---|
1464 | #define VBOXVDMA_CHILD_STATUS_F_CONNECTED 0x01
|
---|
1465 | #define VBOXVDMA_CHILD_STATUS_F_DISCONNECTED 0x02
|
---|
1466 | #define VBOXVDMA_CHILD_STATUS_F_ROTATED 0x04
|
---|
1467 |
|
---|
1468 | typedef struct VBOXVDMA_CHILD_STATUS
|
---|
1469 | {
|
---|
1470 | uint32_t iChild;
|
---|
1471 | uint8_t fFlags;
|
---|
1472 | uint8_t u8RotationAngle;
|
---|
1473 | uint16_t u16Reserved;
|
---|
1474 | } VBOXVDMA_CHILD_STATUS, *PVBOXVDMA_CHILD_STATUS;
|
---|
1475 |
|
---|
1476 | /* apply the aInfos are applied to all targets, the iTarget is ignored */
|
---|
1477 | #define VBOXVDMACMD_CHILD_STATUS_IRQ_F_APPLY_TO_ALL 0x00000001
|
---|
1478 |
|
---|
1479 | typedef struct VBOXVDMACMD_CHILD_STATUS_IRQ
|
---|
1480 | {
|
---|
1481 | uint32_t cInfos;
|
---|
1482 | uint32_t fFlags;
|
---|
1483 | VBOXVDMA_CHILD_STATUS aInfos[1];
|
---|
1484 | } VBOXVDMACMD_CHILD_STATUS_IRQ, *PVBOXVDMACMD_CHILD_STATUS_IRQ;
|
---|
1485 |
|
---|
1486 | #define VBOXCMDVBVA_SCREENMAP_SIZE(_elType) ((VBOX_VIDEO_MAX_SCREENS + sizeof (_elType) - 1) / sizeof (_elType))
|
---|
1487 | #define VBOXCMDVBVA_SCREENMAP_DECL(_elType, _name) _elType _name[VBOXCMDVBVA_SCREENMAP_SIZE(_elType)]
|
---|
1488 |
|
---|
1489 | #endif /* !VBOX_INCLUDED_Graphics_VBoxVideo_h */
|
---|
1490 |
|
---|