VBoxVideo.h revision e07dc26b
1e07dc26bSmrg/** @file
2e07dc26bSmrg * VirtualBox Video interface.
3e07dc26bSmrg */
4e07dc26bSmrg
5e07dc26bSmrg/*
6e07dc26bSmrg * Copyright (C) 2006-2016 Oracle Corporation
7e07dc26bSmrg *
8e07dc26bSmrg * Permission is hereby granted, free of charge, to any person obtaining a
9e07dc26bSmrg * copy of this software and associated documentation files (the
10e07dc26bSmrg * "Software"), to deal in the Software without restriction, including
11e07dc26bSmrg * without limitation the rights to use, copy, modify, merge, publish,
12e07dc26bSmrg * distribute, sub license, and/or sell copies of the Software, and to
13e07dc26bSmrg * permit persons to whom the Software is furnished to do so, subject to
14e07dc26bSmrg * the following conditions:
15e07dc26bSmrg *
16e07dc26bSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17e07dc26bSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18e07dc26bSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19e07dc26bSmrg * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
20e07dc26bSmrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21e07dc26bSmrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22e07dc26bSmrg * USE OR OTHER DEALINGS IN THE SOFTWARE.
23e07dc26bSmrg *
24e07dc26bSmrg * The above copyright notice and this permission notice shall be included in
25e07dc26bSmrg * all copies or substantial portions of the Software.
26e07dc26bSmrg */
27e07dc26bSmrg
28e07dc26bSmrg#ifndef ___VBox_Graphics_VBoxVideo_h
29e07dc26bSmrg#define ___VBox_Graphics_VBoxVideo_h
30e07dc26bSmrg
31e07dc26bSmrg#include "VBoxVideoIPRT.h"
32e07dc26bSmrg
33e07dc26bSmrg/* this should be in sync with monitorCount <xsd:maxInclusive value="64"/> in src/VBox/Main/xml/VirtualBox-settings-common.xsd */
34e07dc26bSmrg#define VBOX_VIDEO_MAX_SCREENS 64
35e07dc26bSmrg
36e07dc26bSmrg/*
37e07dc26bSmrg * The last 4096 bytes of the guest VRAM contains the generic info for all
38e07dc26bSmrg * DualView chunks: sizes and offsets of chunks. This is filled by miniport.
39e07dc26bSmrg *
40e07dc26bSmrg * Last 4096 bytes of each chunk contain chunk specific data: framebuffer info,
41e07dc26bSmrg * etc. This is used exclusively by the corresponding instance of a display driver.
42e07dc26bSmrg *
43e07dc26bSmrg * The VRAM layout:
44e07dc26bSmrg *     Last 4096 bytes - Adapter information area.
45e07dc26bSmrg *     4096 bytes aligned miniport heap (value specified in the config rouded up).
46e07dc26bSmrg *     Slack - what left after dividing the VRAM.
47e07dc26bSmrg *     4096 bytes aligned framebuffers:
48e07dc26bSmrg *       last 4096 bytes of each framebuffer is the display information area.
49e07dc26bSmrg *
50e07dc26bSmrg * The Virtual Graphics Adapter information in the guest VRAM is stored by the
51e07dc26bSmrg * guest video driver using structures prepended by VBOXVIDEOINFOHDR.
52e07dc26bSmrg *
53e07dc26bSmrg * When the guest driver writes dword 0 to the VBE_DISPI_INDEX_VBOX_VIDEO
54e07dc26bSmrg * the host starts to process the info. The first element at the start of
55e07dc26bSmrg * the 4096 bytes region should be normally be a LINK that points to
56e07dc26bSmrg * actual information chain. That way the guest driver can have some
57e07dc26bSmrg * fixed layout of the information memory block and just rewrite
58e07dc26bSmrg * the link to point to relevant memory chain.
59e07dc26bSmrg *
60e07dc26bSmrg * The processing stops at the END element.
61e07dc26bSmrg *
62e07dc26bSmrg * The host can access the memory only when the port IO is processed.
63e07dc26bSmrg * All data that will be needed later must be copied from these 4096 bytes.
64e07dc26bSmrg * But other VRAM can be used by host until the mode is disabled.
65e07dc26bSmrg *
66e07dc26bSmrg * The guest driver writes dword 0xffffffff to the VBE_DISPI_INDEX_VBOX_VIDEO
67e07dc26bSmrg * to disable the mode.
68e07dc26bSmrg *
69e07dc26bSmrg * VBE_DISPI_INDEX_VBOX_VIDEO is used to read the configuration information
70e07dc26bSmrg * from the host and issue commands to the host.
71e07dc26bSmrg *
72e07dc26bSmrg * The guest writes the VBE_DISPI_INDEX_VBOX_VIDEO index register, the the
73e07dc26bSmrg * following operations with the VBE data register can be performed:
74e07dc26bSmrg *
75e07dc26bSmrg * Operation            Result
76e07dc26bSmrg * write 16 bit value   NOP
77e07dc26bSmrg * read 16 bit value    count of monitors
78e07dc26bSmrg * write 32 bit value   sets the vbox command value and the command processed by the host
79e07dc26bSmrg * read 32 bit value    result of the last vbox command is returned
80e07dc26bSmrg */
81e07dc26bSmrg
82e07dc26bSmrg#define VBOX_VIDEO_PRIMARY_SCREEN 0
83e07dc26bSmrg#define VBOX_VIDEO_NO_SCREEN ~0
84e07dc26bSmrg
85e07dc26bSmrg/**
86e07dc26bSmrg * VBVA command header.
87e07dc26bSmrg *
88e07dc26bSmrg * @todo Where does this fit in?
89e07dc26bSmrg */
90e07dc26bSmrgtypedef struct VBVACMDHDR
91e07dc26bSmrg{
92e07dc26bSmrg   /** Coordinates of affected rectangle. */
93e07dc26bSmrg   int16_t x;
94e07dc26bSmrg   int16_t y;
95e07dc26bSmrg   uint16_t w;
96e07dc26bSmrg   uint16_t h;
97e07dc26bSmrg} VBVACMDHDR;
98e07dc26bSmrgAssertCompileSize(VBVACMDHDR, 8);
99e07dc26bSmrg
100e07dc26bSmrg/** @name VBVA ring defines.
101e07dc26bSmrg *
102e07dc26bSmrg * The VBVA ring buffer is suitable for transferring large (< 2GB) amount of
103e07dc26bSmrg * data. For example big bitmaps which do not fit to the buffer.
104e07dc26bSmrg *
105e07dc26bSmrg * Guest starts writing to the buffer by initializing a record entry in the
106e07dc26bSmrg * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
107e07dc26bSmrg * written. As data is written to the ring buffer, the guest increases off32End
108e07dc26bSmrg * for the record.
109e07dc26bSmrg *
110e07dc26bSmrg * The host reads the aRecords on flushes and processes all completed records.
111e07dc26bSmrg * When host encounters situation when only a partial record presents and
112e07dc26bSmrg * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE -
113e07dc26bSmrg * VBVA_RING_BUFFER_THRESHOLD, the host fetched all record data and updates
114e07dc26bSmrg * off32Head. After that on each flush the host continues fetching the data
115e07dc26bSmrg * until the record is completed.
116e07dc26bSmrg *
117e07dc26bSmrg */
118e07dc26bSmrg#define VBVA_RING_BUFFER_SIZE        (_4M - _1K)
119e07dc26bSmrg#define VBVA_RING_BUFFER_THRESHOLD   (4 * _1K)
120e07dc26bSmrg
121e07dc26bSmrg#define VBVA_MAX_RECORDS (64)
122e07dc26bSmrg
123e07dc26bSmrg#define VBVA_F_MODE_ENABLED         UINT32_C(0x00000001)
124e07dc26bSmrg#define VBVA_F_MODE_VRDP            UINT32_C(0x00000002)
125e07dc26bSmrg#define VBVA_F_MODE_VRDP_RESET      UINT32_C(0x00000004)
126e07dc26bSmrg#define VBVA_F_MODE_VRDP_ORDER_MASK UINT32_C(0x00000008)
127e07dc26bSmrg
128e07dc26bSmrg#define VBVA_F_STATE_PROCESSING     UINT32_C(0x00010000)
129e07dc26bSmrg
130e07dc26bSmrg#define VBVA_F_RECORD_PARTIAL       UINT32_C(0x80000000)
131e07dc26bSmrg
132e07dc26bSmrg/**
133e07dc26bSmrg * VBVA record.
134e07dc26bSmrg */
135e07dc26bSmrgtypedef struct VBVARECORD
136e07dc26bSmrg{
137e07dc26bSmrg    /** The length of the record. Changed by guest. */
138e07dc26bSmrg    uint32_t cbRecord;
139e07dc26bSmrg} VBVARECORD;
140e07dc26bSmrgAssertCompileSize(VBVARECORD, 4);
141e07dc26bSmrg
142e07dc26bSmrg/* The size of the information. */
143e07dc26bSmrg/*
144e07dc26bSmrg * The minimum HGSMI heap size is PAGE_SIZE (4096 bytes) and is a restriction of the
145e07dc26bSmrg * runtime heapsimple API. Use minimum 2 pages here, because the info area also may
146e07dc26bSmrg * contain other data (for example HGSMIHOSTFLAGS structure).
147e07dc26bSmrg */
148e07dc26bSmrg#ifndef VBOX_XPDM_MINIPORT
149e07dc26bSmrg# define VBVA_ADAPTER_INFORMATION_SIZE (64*_1K)
150e07dc26bSmrg#else
151e07dc26bSmrg#define VBVA_ADAPTER_INFORMATION_SIZE  (16*_1K)
152e07dc26bSmrg#define VBVA_DISPLAY_INFORMATION_SIZE  (64*_1K)
153e07dc26bSmrg#endif
154e07dc26bSmrg#define VBVA_MIN_BUFFER_SIZE           (64*_1K)
155e07dc26bSmrg
156e07dc26bSmrg
157e07dc26bSmrg/* The value for port IO to let the adapter to interpret the adapter memory. */
158e07dc26bSmrg#define VBOX_VIDEO_DISABLE_ADAPTER_MEMORY        0xFFFFFFFF
159e07dc26bSmrg
160e07dc26bSmrg/* The value for port IO to let the adapter to interpret the adapter memory. */
161e07dc26bSmrg#define VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY      0x00000000
162e07dc26bSmrg
163e07dc26bSmrg/* The value for port IO to let the adapter to interpret the display memory.
164e07dc26bSmrg * The display number is encoded in low 16 bits.
165e07dc26bSmrg */
166e07dc26bSmrg#define VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE 0x00010000
167e07dc26bSmrg
168e07dc26bSmrg
169e07dc26bSmrg/* The end of the information. */
170e07dc26bSmrg#define VBOX_VIDEO_INFO_TYPE_END          0
171e07dc26bSmrg/* Instructs the host to fetch the next VBOXVIDEOINFOHDR at the given offset of VRAM. */
172e07dc26bSmrg#define VBOX_VIDEO_INFO_TYPE_LINK         1
173e07dc26bSmrg/* Information about a display memory position. */
174e07dc26bSmrg#define VBOX_VIDEO_INFO_TYPE_DISPLAY      2
175e07dc26bSmrg/* Information about a screen. */
176e07dc26bSmrg#define VBOX_VIDEO_INFO_TYPE_SCREEN       3
177e07dc26bSmrg/* Information about host notifications for the driver. */
178e07dc26bSmrg#define VBOX_VIDEO_INFO_TYPE_HOST_EVENTS  4
179e07dc26bSmrg/* Information about non-volatile guest VRAM heap. */
180e07dc26bSmrg#define VBOX_VIDEO_INFO_TYPE_NV_HEAP      5
181e07dc26bSmrg/* VBVA enable/disable. */
182e07dc26bSmrg#define VBOX_VIDEO_INFO_TYPE_VBVA_STATUS  6
183e07dc26bSmrg/* VBVA flush. */
184e07dc26bSmrg#define VBOX_VIDEO_INFO_TYPE_VBVA_FLUSH   7
185e07dc26bSmrg/* Query configuration value. */
186e07dc26bSmrg#define VBOX_VIDEO_INFO_TYPE_QUERY_CONF32 8
187e07dc26bSmrg
188e07dc26bSmrg
189e07dc26bSmrg#pragma pack(1)
190e07dc26bSmrgtypedef struct VBOXVIDEOINFOHDR
191e07dc26bSmrg{
192e07dc26bSmrg    uint8_t u8Type;
193e07dc26bSmrg    uint8_t u8Reserved;
194e07dc26bSmrg    uint16_t u16Length;
195e07dc26bSmrg} VBOXVIDEOINFOHDR;
196e07dc26bSmrg
197e07dc26bSmrg
198e07dc26bSmrgtypedef struct VBOXVIDEOINFOLINK
199e07dc26bSmrg{
200e07dc26bSmrg    /* Relative offset in VRAM */
201e07dc26bSmrg    int32_t i32Offset;
202e07dc26bSmrg} VBOXVIDEOINFOLINK;
203e07dc26bSmrg
204e07dc26bSmrg
205e07dc26bSmrg/* Resides in adapter info memory. Describes a display VRAM chunk. */
206e07dc26bSmrgtypedef struct VBOXVIDEOINFODISPLAY
207e07dc26bSmrg{
208e07dc26bSmrg    /* Index of the framebuffer assigned by guest. */
209e07dc26bSmrg    uint32_t u32Index;
210e07dc26bSmrg
211e07dc26bSmrg    /* Absolute offset in VRAM of the framebuffer to be displayed on the monitor. */
212e07dc26bSmrg    uint32_t u32Offset;
213e07dc26bSmrg
214e07dc26bSmrg    /* The size of the memory that can be used for the screen. */
215e07dc26bSmrg    uint32_t u32FramebufferSize;
216e07dc26bSmrg
217e07dc26bSmrg    /* The size of the memory that is used for the Display information.
218e07dc26bSmrg     * The information is at u32Offset + u32FramebufferSize
219e07dc26bSmrg     */
220e07dc26bSmrg    uint32_t u32InformationSize;
221e07dc26bSmrg
222e07dc26bSmrg} VBOXVIDEOINFODISPLAY;
223e07dc26bSmrg
224e07dc26bSmrg
225e07dc26bSmrg/* Resides in display info area, describes the current video mode. */
226e07dc26bSmrg#define VBOX_VIDEO_INFO_SCREEN_F_NONE   0x00
227e07dc26bSmrg#define VBOX_VIDEO_INFO_SCREEN_F_ACTIVE 0x01
228e07dc26bSmrg
229e07dc26bSmrgtypedef struct VBOXVIDEOINFOSCREEN
230e07dc26bSmrg{
231e07dc26bSmrg    /* Physical X origin relative to the primary screen. */
232e07dc26bSmrg    int32_t xOrigin;
233e07dc26bSmrg
234e07dc26bSmrg    /* Physical Y origin relative to the primary screen. */
235e07dc26bSmrg    int32_t yOrigin;
236e07dc26bSmrg
237e07dc26bSmrg    /* The scan line size in bytes. */
238e07dc26bSmrg    uint32_t u32LineSize;
239e07dc26bSmrg
240e07dc26bSmrg    /* Width of the screen. */
241e07dc26bSmrg    uint16_t u16Width;
242e07dc26bSmrg
243e07dc26bSmrg    /* Height of the screen. */
244e07dc26bSmrg    uint16_t u16Height;
245e07dc26bSmrg
246e07dc26bSmrg    /* Color depth. */
247e07dc26bSmrg    uint8_t bitsPerPixel;
248e07dc26bSmrg
249e07dc26bSmrg    /* VBOX_VIDEO_INFO_SCREEN_F_* */
250e07dc26bSmrg    uint8_t u8Flags;
251e07dc26bSmrg} VBOXVIDEOINFOSCREEN;
252e07dc26bSmrg
253e07dc26bSmrg/* The guest initializes the structure to 0. The positions of the structure in the
254e07dc26bSmrg * display info area must not be changed, host will update the structure. Guest checks
255e07dc26bSmrg * the events and modifies the structure as a response to host.
256e07dc26bSmrg */
257e07dc26bSmrg#define VBOX_VIDEO_INFO_HOST_EVENTS_F_NONE        0x00000000
258e07dc26bSmrg#define VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET  0x00000080
259e07dc26bSmrg
260e07dc26bSmrgtypedef struct VBOXVIDEOINFOHOSTEVENTS
261e07dc26bSmrg{
262e07dc26bSmrg    /* Host events. */
263e07dc26bSmrg    uint32_t fu32Events;
264e07dc26bSmrg} VBOXVIDEOINFOHOSTEVENTS;
265e07dc26bSmrg
266e07dc26bSmrg/* Resides in adapter info memory. Describes the non-volatile VRAM heap. */
267e07dc26bSmrgtypedef struct VBOXVIDEOINFONVHEAP
268e07dc26bSmrg{
269e07dc26bSmrg    /* Absolute offset in VRAM of the start of the heap. */
270e07dc26bSmrg    uint32_t u32HeapOffset;
271e07dc26bSmrg
272e07dc26bSmrg    /* The size of the heap. */
273e07dc26bSmrg    uint32_t u32HeapSize;
274e07dc26bSmrg
275e07dc26bSmrg} VBOXVIDEOINFONVHEAP;
276e07dc26bSmrg
277e07dc26bSmrg/* Display information area. */
278e07dc26bSmrgtypedef struct VBOXVIDEOINFOVBVASTATUS
279e07dc26bSmrg{
280e07dc26bSmrg    /* Absolute offset in VRAM of the start of the VBVA QUEUE. 0 to disable VBVA. */
281e07dc26bSmrg    uint32_t u32QueueOffset;
282e07dc26bSmrg
283e07dc26bSmrg    /* The size of the VBVA QUEUE. 0 to disable VBVA. */
284e07dc26bSmrg    uint32_t u32QueueSize;
285e07dc26bSmrg
286e07dc26bSmrg} VBOXVIDEOINFOVBVASTATUS;
287e07dc26bSmrg
288e07dc26bSmrgtypedef struct VBOXVIDEOINFOVBVAFLUSH
289e07dc26bSmrg{
290e07dc26bSmrg    uint32_t u32DataStart;
291e07dc26bSmrg
292e07dc26bSmrg    uint32_t u32DataEnd;
293e07dc26bSmrg
294e07dc26bSmrg} VBOXVIDEOINFOVBVAFLUSH;
295e07dc26bSmrg
296e07dc26bSmrg#define VBOX_VIDEO_QCI32_MONITOR_COUNT       0
297e07dc26bSmrg#define VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE 1
298e07dc26bSmrg
299e07dc26bSmrgtypedef struct VBOXVIDEOINFOQUERYCONF32
300e07dc26bSmrg{
301e07dc26bSmrg    uint32_t u32Index;
302e07dc26bSmrg
303e07dc26bSmrg    uint32_t u32Value;
304e07dc26bSmrg
305e07dc26bSmrg} VBOXVIDEOINFOQUERYCONF32;
306e07dc26bSmrg#pragma pack()
307e07dc26bSmrg
308e07dc26bSmrg#ifdef VBOX_WITH_VIDEOHWACCEL
309e07dc26bSmrg#pragma pack(1)
310e07dc26bSmrg
311e07dc26bSmrg#define VBOXVHWA_VERSION_MAJ 0
312e07dc26bSmrg#define VBOXVHWA_VERSION_MIN 0
313e07dc26bSmrg#define VBOXVHWA_VERSION_BLD 6
314e07dc26bSmrg#define VBOXVHWA_VERSION_RSV 0
315e07dc26bSmrg
316e07dc26bSmrgtypedef enum
317e07dc26bSmrg{
318e07dc26bSmrg    VBOXVHWACMD_TYPE_SURF_CANCREATE = 1,
319e07dc26bSmrg    VBOXVHWACMD_TYPE_SURF_CREATE,
320e07dc26bSmrg    VBOXVHWACMD_TYPE_SURF_DESTROY,
321e07dc26bSmrg    VBOXVHWACMD_TYPE_SURF_LOCK,
322e07dc26bSmrg    VBOXVHWACMD_TYPE_SURF_UNLOCK,
323e07dc26bSmrg    VBOXVHWACMD_TYPE_SURF_BLT,
324e07dc26bSmrg    VBOXVHWACMD_TYPE_SURF_FLIP,
325e07dc26bSmrg    VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE,
326e07dc26bSmrg    VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION,
327e07dc26bSmrg    VBOXVHWACMD_TYPE_SURF_COLORKEY_SET,
328e07dc26bSmrg    VBOXVHWACMD_TYPE_QUERY_INFO1,
329e07dc26bSmrg    VBOXVHWACMD_TYPE_QUERY_INFO2,
330e07dc26bSmrg    VBOXVHWACMD_TYPE_ENABLE,
331e07dc26bSmrg    VBOXVHWACMD_TYPE_DISABLE,
332e07dc26bSmrg    VBOXVHWACMD_TYPE_HH_CONSTRUCT,
333e07dc26bSmrg    VBOXVHWACMD_TYPE_HH_RESET
334e07dc26bSmrg#ifdef VBOX_WITH_WDDM
335e07dc26bSmrg    , VBOXVHWACMD_TYPE_SURF_GETINFO
336e07dc26bSmrg    , VBOXVHWACMD_TYPE_SURF_COLORFILL
337e07dc26bSmrg#endif
338e07dc26bSmrg    , VBOXVHWACMD_TYPE_HH_DISABLE
339e07dc26bSmrg    , VBOXVHWACMD_TYPE_HH_ENABLE
340e07dc26bSmrg    , VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEBEGIN
341e07dc26bSmrg    , VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEEND
342e07dc26bSmrg    , VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEPERFORM
343e07dc26bSmrg    , VBOXVHWACMD_TYPE_HH_SAVESTATE_LOADPERFORM
344e07dc26bSmrg} VBOXVHWACMD_TYPE;
345e07dc26bSmrg
346e07dc26bSmrg/* the command processing was asynch, set by the host to indicate asynch command completion
347e07dc26bSmrg * must not be cleared once set, the command completion is performed by issuing a host->guest completion command
348e07dc26bSmrg * while keeping this flag unchanged */
349e07dc26bSmrg#define VBOXVHWACMD_FLAG_HG_ASYNCH               0x00010000
350e07dc26bSmrg/* asynch completion is performed by issuing the event */
351e07dc26bSmrg#define VBOXVHWACMD_FLAG_GH_ASYNCH_EVENT         0x00000001
352e07dc26bSmrg/* issue interrupt on asynch completion */
353e07dc26bSmrg#define VBOXVHWACMD_FLAG_GH_ASYNCH_IRQ           0x00000002
354e07dc26bSmrg/* guest does not do any op on completion of this command, the host may copy the command and indicate that it does not need the command anymore
355e07dc26bSmrg * by setting the VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED flag */
356e07dc26bSmrg#define VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION  0x00000004
357e07dc26bSmrg/* the host has copied the VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION command and returned it to the guest */
358e07dc26bSmrg#define VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED      0x00020000
359e07dc26bSmrg/* this is the host->host cmd, i.e. a configuration command posted by the host to the framebuffer */
360e07dc26bSmrg#define VBOXVHWACMD_FLAG_HH_CMD                  0x10000000
361e07dc26bSmrg
362e07dc26bSmrgtypedef struct VBOXVHWACMD
363e07dc26bSmrg{
364e07dc26bSmrg    VBOXVHWACMD_TYPE enmCmd; /* command type */
365e07dc26bSmrg    volatile int32_t rc; /* command result */
366e07dc26bSmrg    int32_t iDisplay; /* display index */
367e07dc26bSmrg    volatile int32_t Flags; /* ored VBOXVHWACMD_FLAG_xxx values */
368e07dc26bSmrg    uint64_t GuestVBVAReserved1; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
369e07dc26bSmrg    uint64_t GuestVBVAReserved2; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
370e07dc26bSmrg    volatile uint32_t cRefs;
371e07dc26bSmrg    int32_t Reserved;
372e07dc26bSmrg    union
373e07dc26bSmrg    {
374e07dc26bSmrg        struct VBOXVHWACMD *pNext;
375e07dc26bSmrg        uint32_t             offNext;
376e07dc26bSmrg        uint64_t Data; /* the body is 64-bit aligned */
377e07dc26bSmrg    } u;
378e07dc26bSmrg    char body[1];
379e07dc26bSmrg} VBOXVHWACMD;
380e07dc26bSmrg
381e07dc26bSmrg#define VBOXVHWACMD_HEADSIZE() (RT_OFFSETOF(VBOXVHWACMD, body))
382e07dc26bSmrg#define VBOXVHWACMD_SIZE_FROMBODYSIZE(_s) (VBOXVHWACMD_HEADSIZE() + (_s))
383e07dc26bSmrg#define VBOXVHWACMD_SIZE(_tCmd) (VBOXVHWACMD_SIZE_FROMBODYSIZE(sizeof(_tCmd)))
384e07dc26bSmrgtypedef unsigned int VBOXVHWACMD_LENGTH;
385e07dc26bSmrgtypedef uint64_t VBOXVHWA_SURFHANDLE;
386e07dc26bSmrg#define VBOXVHWA_SURFHANDLE_INVALID 0ULL
387e07dc26bSmrg#define VBOXVHWACMD_BODY(_p, _t) ((_t*)(_p)->body)
388e07dc26bSmrg#define VBOXVHWACMD_HEAD(_pb) ((VBOXVHWACMD*)((uint8_t *)(_pb) - RT_OFFSETOF(VBOXVHWACMD, body)))
389e07dc26bSmrg
390e07dc26bSmrgtypedef struct VBOXVHWA_RECTL
391e07dc26bSmrg{
392e07dc26bSmrg    int32_t left;
393e07dc26bSmrg    int32_t top;
394e07dc26bSmrg    int32_t right;
395e07dc26bSmrg    int32_t bottom;
396e07dc26bSmrg} VBOXVHWA_RECTL;
397e07dc26bSmrg
398e07dc26bSmrgtypedef struct VBOXVHWA_COLORKEY
399e07dc26bSmrg{
400e07dc26bSmrg    uint32_t low;
401e07dc26bSmrg    uint32_t high;
402e07dc26bSmrg} VBOXVHWA_COLORKEY;
403e07dc26bSmrg
404e07dc26bSmrgtypedef struct VBOXVHWA_PIXELFORMAT
405e07dc26bSmrg{
406e07dc26bSmrg    uint32_t flags;
407e07dc26bSmrg    uint32_t fourCC;
408e07dc26bSmrg    union
409e07dc26bSmrg    {
410e07dc26bSmrg        uint32_t rgbBitCount;
411e07dc26bSmrg        uint32_t yuvBitCount;
412e07dc26bSmrg    } c;
413e07dc26bSmrg
414e07dc26bSmrg    union
415e07dc26bSmrg    {
416e07dc26bSmrg        uint32_t rgbRBitMask;
417e07dc26bSmrg        uint32_t yuvYBitMask;
418e07dc26bSmrg    } m1;
419e07dc26bSmrg
420e07dc26bSmrg    union
421e07dc26bSmrg    {
422e07dc26bSmrg        uint32_t rgbGBitMask;
423e07dc26bSmrg        uint32_t yuvUBitMask;
424e07dc26bSmrg    } m2;
425e07dc26bSmrg
426e07dc26bSmrg    union
427e07dc26bSmrg    {
428e07dc26bSmrg        uint32_t rgbBBitMask;
429e07dc26bSmrg        uint32_t yuvVBitMask;
430e07dc26bSmrg    } m3;
431e07dc26bSmrg
432e07dc26bSmrg    union
433e07dc26bSmrg    {
434e07dc26bSmrg        uint32_t rgbABitMask;
435e07dc26bSmrg    } m4;
436e07dc26bSmrg
437e07dc26bSmrg    uint32_t Reserved;
438e07dc26bSmrg} VBOXVHWA_PIXELFORMAT;
439e07dc26bSmrg
440e07dc26bSmrgtypedef struct VBOXVHWA_SURFACEDESC
441e07dc26bSmrg{
442e07dc26bSmrg    uint32_t flags;
443e07dc26bSmrg    uint32_t height;
444e07dc26bSmrg    uint32_t width;
445e07dc26bSmrg    uint32_t pitch;
446e07dc26bSmrg    uint32_t sizeX;
447e07dc26bSmrg    uint32_t sizeY;
448e07dc26bSmrg    uint32_t cBackBuffers;
449e07dc26bSmrg    uint32_t Reserved;
450e07dc26bSmrg    VBOXVHWA_COLORKEY DstOverlayCK;
451e07dc26bSmrg    VBOXVHWA_COLORKEY DstBltCK;
452e07dc26bSmrg    VBOXVHWA_COLORKEY SrcOverlayCK;
453e07dc26bSmrg    VBOXVHWA_COLORKEY SrcBltCK;
454e07dc26bSmrg    VBOXVHWA_PIXELFORMAT PixelFormat;
455e07dc26bSmrg    uint32_t surfCaps;
456e07dc26bSmrg    uint32_t Reserved2;
457e07dc26bSmrg    VBOXVHWA_SURFHANDLE hSurf;
458e07dc26bSmrg    uint64_t offSurface;
459e07dc26bSmrg} VBOXVHWA_SURFACEDESC;
460e07dc26bSmrg
461e07dc26bSmrgtypedef struct VBOXVHWA_BLTFX
462e07dc26bSmrg{
463e07dc26bSmrg    uint32_t flags;
464e07dc26bSmrg    uint32_t rop;
465e07dc26bSmrg    uint32_t rotationOp;
466e07dc26bSmrg    uint32_t rotation;
467e07dc26bSmrg    uint32_t fillColor;
468e07dc26bSmrg    uint32_t Reserved;
469e07dc26bSmrg    VBOXVHWA_COLORKEY DstCK;
470e07dc26bSmrg    VBOXVHWA_COLORKEY SrcCK;
471e07dc26bSmrg} VBOXVHWA_BLTFX;
472e07dc26bSmrg
473e07dc26bSmrgtypedef struct VBOXVHWA_OVERLAYFX
474e07dc26bSmrg{
475e07dc26bSmrg    uint32_t flags;
476e07dc26bSmrg    uint32_t Reserved1;
477e07dc26bSmrg    uint32_t fxFlags;
478e07dc26bSmrg    uint32_t Reserved2;
479e07dc26bSmrg    VBOXVHWA_COLORKEY DstCK;
480e07dc26bSmrg    VBOXVHWA_COLORKEY SrcCK;
481e07dc26bSmrg} VBOXVHWA_OVERLAYFX;
482e07dc26bSmrg
483e07dc26bSmrg#define VBOXVHWA_CAPS_BLT               0x00000040
484e07dc26bSmrg#define VBOXVHWA_CAPS_BLTCOLORFILL      0x04000000
485e07dc26bSmrg#define VBOXVHWA_CAPS_BLTFOURCC         0x00000100
486e07dc26bSmrg#define VBOXVHWA_CAPS_BLTSTRETCH        0x00000200
487e07dc26bSmrg#define VBOXVHWA_CAPS_BLTQUEUE          0x00000080
488e07dc26bSmrg
489e07dc26bSmrg#define VBOXVHWA_CAPS_OVERLAY           0x00000800
490e07dc26bSmrg#define VBOXVHWA_CAPS_OVERLAYFOURCC     0x00002000
491e07dc26bSmrg#define VBOXVHWA_CAPS_OVERLAYSTRETCH    0x00004000
492e07dc26bSmrg#define VBOXVHWA_CAPS_OVERLAYCANTCLIP   0x00001000
493e07dc26bSmrg
494e07dc26bSmrg#define VBOXVHWA_CAPS_COLORKEY          0x00400000
495e07dc26bSmrg#define VBOXVHWA_CAPS_COLORKEYHWASSIST  0x01000000
496e07dc26bSmrg
497e07dc26bSmrg#define VBOXVHWA_SCAPS_BACKBUFFER       0x00000004
498e07dc26bSmrg#define VBOXVHWA_SCAPS_COMPLEX          0x00000008
499e07dc26bSmrg#define VBOXVHWA_SCAPS_FLIP             0x00000010
500e07dc26bSmrg#define VBOXVHWA_SCAPS_FRONTBUFFER      0x00000020
501e07dc26bSmrg#define VBOXVHWA_SCAPS_OFFSCREENPLAIN   0x00000040
502e07dc26bSmrg#define VBOXVHWA_SCAPS_OVERLAY          0x00000080
503e07dc26bSmrg#define VBOXVHWA_SCAPS_PRIMARYSURFACE   0x00000200
504e07dc26bSmrg#define VBOXVHWA_SCAPS_SYSTEMMEMORY     0x00000800
505e07dc26bSmrg#define VBOXVHWA_SCAPS_VIDEOMEMORY      0x00004000
506e07dc26bSmrg#define VBOXVHWA_SCAPS_VISIBLE          0x00008000
507e07dc26bSmrg#define VBOXVHWA_SCAPS_LOCALVIDMEM      0x10000000
508e07dc26bSmrg
509e07dc26bSmrg#define VBOXVHWA_PF_PALETTEINDEXED8     0x00000020
510e07dc26bSmrg#define VBOXVHWA_PF_RGB                 0x00000040
511e07dc26bSmrg#define VBOXVHWA_PF_RGBTOYUV            0x00000100
512e07dc26bSmrg#define VBOXVHWA_PF_YUV                 0x00000200
513e07dc26bSmrg#define VBOXVHWA_PF_FOURCC              0x00000004
514e07dc26bSmrg
515e07dc26bSmrg#define VBOXVHWA_LOCK_DISCARDCONTENTS   0x00002000
516e07dc26bSmrg
517e07dc26bSmrg#define VBOXVHWA_CFG_ENABLED            0x00000001
518e07dc26bSmrg
519e07dc26bSmrg#define VBOXVHWA_SD_BACKBUFFERCOUNT     0x00000020
520e07dc26bSmrg#define VBOXVHWA_SD_CAPS                0x00000001
521e07dc26bSmrg#define VBOXVHWA_SD_CKDESTBLT           0x00004000
522e07dc26bSmrg#define VBOXVHWA_SD_CKDESTOVERLAY       0x00002000
523e07dc26bSmrg#define VBOXVHWA_SD_CKSRCBLT            0x00010000
524e07dc26bSmrg#define VBOXVHWA_SD_CKSRCOVERLAY        0x00008000
525e07dc26bSmrg#define VBOXVHWA_SD_HEIGHT              0x00000002
526e07dc26bSmrg#define VBOXVHWA_SD_PITCH               0x00000008
527e07dc26bSmrg#define VBOXVHWA_SD_PIXELFORMAT         0x00001000
528e07dc26bSmrg/*#define VBOXVHWA_SD_REFRESHRATE       0x00040000*/
529e07dc26bSmrg#define VBOXVHWA_SD_WIDTH               0x00000004
530e07dc26bSmrg
531e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_DESTBLT                  0x00000001
532e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACE          0x00000002
533e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACEYUV       0x00000004
534e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_DESTBLTYUV               0x00000008
535e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_DESTOVERLAY              0x00000010
536e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACE      0x00000020
537e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACEYUV   0x00000040
538e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_DESTOVERLAYONEACTIVE     0x00000080
539e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_DESTOVERLAYYUV           0x00000100
540e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_SRCBLT                   0x00000200
541e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACE           0x00000400
542e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACEYUV        0x00000800
543e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_SRCBLTYUV                0x00001000
544e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_SRCOVERLAY               0x00002000
545e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACE       0x00004000
546e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACEYUV    0x00008000
547e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_SRCOVERLAYONEACTIVE      0x00010000
548e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_SRCOVERLAYYUV            0x00020000
549e07dc26bSmrg#define VBOXVHWA_CKEYCAPS_NOCOSTOVERLAY            0x00040000
550e07dc26bSmrg
551e07dc26bSmrg#define VBOXVHWA_BLT_COLORFILL                      0x00000400
552e07dc26bSmrg#define VBOXVHWA_BLT_DDFX                           0x00000800
553e07dc26bSmrg#define VBOXVHWA_BLT_EXTENDED_FLAGS                 0x40000000
554e07dc26bSmrg#define VBOXVHWA_BLT_EXTENDED_LINEAR_CONTENT        0x00000004
555e07dc26bSmrg#define VBOXVHWA_BLT_EXTENDED_PRESENTATION_STRETCHFACTOR 0x00000010
556e07dc26bSmrg#define VBOXVHWA_BLT_KEYDESTOVERRIDE                0x00004000
557e07dc26bSmrg#define VBOXVHWA_BLT_KEYSRCOVERRIDE                 0x00010000
558e07dc26bSmrg#define VBOXVHWA_BLT_LAST_PRESENTATION              0x20000000
559e07dc26bSmrg#define VBOXVHWA_BLT_PRESENTATION                   0x10000000
560e07dc26bSmrg#define VBOXVHWA_BLT_ROP                            0x00020000
561e07dc26bSmrg
562e07dc26bSmrg
563e07dc26bSmrg#define VBOXVHWA_OVER_DDFX                          0x00080000
564e07dc26bSmrg#define VBOXVHWA_OVER_HIDE                          0x00000200
565e07dc26bSmrg#define VBOXVHWA_OVER_KEYDEST                       0x00000400
566e07dc26bSmrg#define VBOXVHWA_OVER_KEYDESTOVERRIDE               0x00000800
567e07dc26bSmrg#define VBOXVHWA_OVER_KEYSRC                        0x00001000
568e07dc26bSmrg#define VBOXVHWA_OVER_KEYSRCOVERRIDE                0x00002000
569e07dc26bSmrg#define VBOXVHWA_OVER_SHOW                          0x00004000
570e07dc26bSmrg
571e07dc26bSmrg#define VBOXVHWA_CKEY_COLORSPACE                    0x00000001
572e07dc26bSmrg#define VBOXVHWA_CKEY_DESTBLT                       0x00000002
573e07dc26bSmrg#define VBOXVHWA_CKEY_DESTOVERLAY                   0x00000004
574e07dc26bSmrg#define VBOXVHWA_CKEY_SRCBLT                        0x00000008
575e07dc26bSmrg#define VBOXVHWA_CKEY_SRCOVERLAY                    0x00000010
576e07dc26bSmrg
577e07dc26bSmrg#define VBOXVHWA_BLT_ARITHSTRETCHY                  0x00000001
578e07dc26bSmrg#define VBOXVHWA_BLT_MIRRORLEFTRIGHT                0x00000002
579e07dc26bSmrg#define VBOXVHWA_BLT_MIRRORUPDOWN                   0x00000004
580e07dc26bSmrg
581e07dc26bSmrg#define VBOXVHWA_OVERFX_ARITHSTRETCHY               0x00000001
582e07dc26bSmrg#define VBOXVHWA_OVERFX_MIRRORLEFTRIGHT             0x00000002
583e07dc26bSmrg#define VBOXVHWA_OVERFX_MIRRORUPDOWN                0x00000004
584e07dc26bSmrg
585e07dc26bSmrg#define VBOXVHWA_CAPS2_CANRENDERWINDOWED            0x00080000
586e07dc26bSmrg#define VBOXVHWA_CAPS2_WIDESURFACES                 0x00001000
587e07dc26bSmrg#define VBOXVHWA_CAPS2_COPYFOURCC                   0x00008000
588e07dc26bSmrg/*#define VBOXVHWA_CAPS2_FLIPINTERVAL                 0x00200000*/
589e07dc26bSmrg/*#define VBOXVHWA_CAPS2_FLIPNOVSYNC                  0x00400000*/
590e07dc26bSmrg
591e07dc26bSmrg
592e07dc26bSmrg#define VBOXVHWA_OFFSET64_VOID        (UINT64_MAX)
593e07dc26bSmrg
594e07dc26bSmrgtypedef struct VBOXVHWA_VERSION
595e07dc26bSmrg{
596e07dc26bSmrg    uint32_t maj;
597e07dc26bSmrg    uint32_t min;
598e07dc26bSmrg    uint32_t bld;
599e07dc26bSmrg    uint32_t reserved;
600e07dc26bSmrg} VBOXVHWA_VERSION;
601e07dc26bSmrg
602e07dc26bSmrg#define VBOXVHWA_VERSION_INIT(_pv) do { \
603e07dc26bSmrg        (_pv)->maj = VBOXVHWA_VERSION_MAJ; \
604e07dc26bSmrg        (_pv)->min = VBOXVHWA_VERSION_MIN; \
605e07dc26bSmrg        (_pv)->bld = VBOXVHWA_VERSION_BLD; \
606e07dc26bSmrg        (_pv)->reserved = VBOXVHWA_VERSION_RSV; \
607e07dc26bSmrg        } while(0)
608e07dc26bSmrg
609e07dc26bSmrgtypedef struct VBOXVHWACMD_QUERYINFO1
610e07dc26bSmrg{
611e07dc26bSmrg    union
612e07dc26bSmrg    {
613e07dc26bSmrg        struct
614e07dc26bSmrg        {
615e07dc26bSmrg            VBOXVHWA_VERSION guestVersion;
616e07dc26bSmrg        } in;
617e07dc26bSmrg
618e07dc26bSmrg        struct
619e07dc26bSmrg        {
620e07dc26bSmrg            uint32_t cfgFlags;
621e07dc26bSmrg            uint32_t caps;
622e07dc26bSmrg
623e07dc26bSmrg            uint32_t caps2;
624e07dc26bSmrg            uint32_t colorKeyCaps;
625e07dc26bSmrg
626e07dc26bSmrg            uint32_t stretchCaps;
627e07dc26bSmrg            uint32_t surfaceCaps;
628e07dc26bSmrg
629e07dc26bSmrg            uint32_t numOverlays;
630e07dc26bSmrg            uint32_t curOverlays;
631e07dc26bSmrg
632e07dc26bSmrg            uint32_t numFourCC;
633e07dc26bSmrg            uint32_t reserved;
634e07dc26bSmrg        } out;
635e07dc26bSmrg    } u;
636e07dc26bSmrg} VBOXVHWACMD_QUERYINFO1;
637e07dc26bSmrg
638e07dc26bSmrgtypedef struct VBOXVHWACMD_QUERYINFO2
639e07dc26bSmrg{
640e07dc26bSmrg    uint32_t numFourCC;
641e07dc26bSmrg    uint32_t FourCC[1];
642e07dc26bSmrg} VBOXVHWACMD_QUERYINFO2;
643e07dc26bSmrg
644e07dc26bSmrg#define VBOXVHWAINFO2_SIZE(_cFourCC) RT_OFFSETOF(VBOXVHWACMD_QUERYINFO2, FourCC[_cFourCC])
645e07dc26bSmrg
646e07dc26bSmrgtypedef struct VBOXVHWACMD_SURF_CANCREATE
647e07dc26bSmrg{
648e07dc26bSmrg    VBOXVHWA_SURFACEDESC SurfInfo;
649e07dc26bSmrg    union
650e07dc26bSmrg    {
651e07dc26bSmrg        struct
652e07dc26bSmrg        {
653e07dc26bSmrg            uint32_t bIsDifferentPixelFormat;
654e07dc26bSmrg            uint32_t Reserved;
655e07dc26bSmrg        } in;
656e07dc26bSmrg
657e07dc26bSmrg        struct
658e07dc26bSmrg        {
659e07dc26bSmrg            int32_t ErrInfo;
660e07dc26bSmrg        } out;
661e07dc26bSmrg    } u;
662e07dc26bSmrg} VBOXVHWACMD_SURF_CANCREATE;
663e07dc26bSmrg
664e07dc26bSmrgtypedef struct VBOXVHWACMD_SURF_CREATE
665e07dc26bSmrg{
666e07dc26bSmrg    VBOXVHWA_SURFACEDESC SurfInfo;
667e07dc26bSmrg} VBOXVHWACMD_SURF_CREATE;
668e07dc26bSmrg
669e07dc26bSmrg#ifdef VBOX_WITH_WDDM
670e07dc26bSmrgtypedef struct VBOXVHWACMD_SURF_GETINFO
671e07dc26bSmrg{
672e07dc26bSmrg    VBOXVHWA_SURFACEDESC SurfInfo;
673e07dc26bSmrg} VBOXVHWACMD_SURF_GETINFO;
674e07dc26bSmrg#endif
675e07dc26bSmrg
676e07dc26bSmrgtypedef struct VBOXVHWACMD_SURF_DESTROY
677e07dc26bSmrg{
678e07dc26bSmrg    union
679e07dc26bSmrg    {
680e07dc26bSmrg        struct
681e07dc26bSmrg        {
682e07dc26bSmrg            VBOXVHWA_SURFHANDLE hSurf;
683e07dc26bSmrg        } in;
684e07dc26bSmrg    } u;
685e07dc26bSmrg} VBOXVHWACMD_SURF_DESTROY;
686e07dc26bSmrg
687e07dc26bSmrgtypedef struct VBOXVHWACMD_SURF_LOCK
688e07dc26bSmrg{
689e07dc26bSmrg    union
690e07dc26bSmrg    {
691e07dc26bSmrg        struct
692e07dc26bSmrg        {
693e07dc26bSmrg            VBOXVHWA_SURFHANDLE hSurf;
694e07dc26bSmrg            uint64_t offSurface;
695e07dc26bSmrg            uint32_t flags;
696e07dc26bSmrg            uint32_t rectValid;
697e07dc26bSmrg            VBOXVHWA_RECTL rect;
698e07dc26bSmrg        } in;
699e07dc26bSmrg    } u;
700e07dc26bSmrg} VBOXVHWACMD_SURF_LOCK;
701e07dc26bSmrg
702e07dc26bSmrgtypedef struct VBOXVHWACMD_SURF_UNLOCK
703e07dc26bSmrg{
704e07dc26bSmrg    union
705e07dc26bSmrg    {
706e07dc26bSmrg        struct
707e07dc26bSmrg        {
708e07dc26bSmrg            VBOXVHWA_SURFHANDLE hSurf;
709e07dc26bSmrg            uint32_t xUpdatedMemValid;
710e07dc26bSmrg            uint32_t reserved;
711e07dc26bSmrg            VBOXVHWA_RECTL xUpdatedMemRect;
712e07dc26bSmrg        } in;
713e07dc26bSmrg    } u;
714e07dc26bSmrg} VBOXVHWACMD_SURF_UNLOCK;
715e07dc26bSmrg
716e07dc26bSmrgtypedef struct VBOXVHWACMD_SURF_BLT
717e07dc26bSmrg{
718e07dc26bSmrg    uint64_t DstGuestSurfInfo;
719e07dc26bSmrg    uint64_t SrcGuestSurfInfo;
720e07dc26bSmrg    union
721e07dc26bSmrg    {
722e07dc26bSmrg        struct
723e07dc26bSmrg        {
724e07dc26bSmrg            VBOXVHWA_SURFHANDLE hDstSurf;
725e07dc26bSmrg            uint64_t offDstSurface;
726e07dc26bSmrg            VBOXVHWA_RECTL dstRect;
727e07dc26bSmrg            VBOXVHWA_SURFHANDLE hSrcSurf;
728e07dc26bSmrg            uint64_t offSrcSurface;
729e07dc26bSmrg            VBOXVHWA_RECTL srcRect;
730e07dc26bSmrg            uint32_t flags;
731e07dc26bSmrg            uint32_t xUpdatedSrcMemValid;
732e07dc26bSmrg            VBOXVHWA_BLTFX desc;
733e07dc26bSmrg            VBOXVHWA_RECTL xUpdatedSrcMemRect;
734e07dc26bSmrg        } in;
735e07dc26bSmrg    } u;
736e07dc26bSmrg} VBOXVHWACMD_SURF_BLT;
737e07dc26bSmrg
738e07dc26bSmrg#ifdef VBOX_WITH_WDDM
739e07dc26bSmrgtypedef struct VBOXVHWACMD_SURF_COLORFILL
740e07dc26bSmrg{
741e07dc26bSmrg    union
742e07dc26bSmrg    {
743e07dc26bSmrg        struct
744e07dc26bSmrg        {
745e07dc26bSmrg            VBOXVHWA_SURFHANDLE hSurf;
746e07dc26bSmrg            uint64_t offSurface;
747e07dc26bSmrg            uint32_t u32Reserved;
748e07dc26bSmrg            uint32_t cRects;
749e07dc26bSmrg            VBOXVHWA_RECTL aRects[1];
750e07dc26bSmrg        } in;
751e07dc26bSmrg    } u;
752e07dc26bSmrg} VBOXVHWACMD_SURF_COLORFILL;
753e07dc26bSmrg#endif
754e07dc26bSmrg
755e07dc26bSmrgtypedef struct VBOXVHWACMD_SURF_FLIP
756e07dc26bSmrg{
757e07dc26bSmrg    uint64_t TargGuestSurfInfo;
758e07dc26bSmrg    uint64_t CurrGuestSurfInfo;
759e07dc26bSmrg    union
760e07dc26bSmrg    {
761e07dc26bSmrg        struct
762e07dc26bSmrg        {
763e07dc26bSmrg            VBOXVHWA_SURFHANDLE hTargSurf;
764e07dc26bSmrg            uint64_t offTargSurface;
765e07dc26bSmrg            VBOXVHWA_SURFHANDLE hCurrSurf;
766e07dc26bSmrg            uint64_t offCurrSurface;
767e07dc26bSmrg            uint32_t flags;
768e07dc26bSmrg            uint32_t xUpdatedTargMemValid;
769e07dc26bSmrg            VBOXVHWA_RECTL xUpdatedTargMemRect;
770e07dc26bSmrg        } in;
771e07dc26bSmrg    } u;
772e07dc26bSmrg} VBOXVHWACMD_SURF_FLIP;
773e07dc26bSmrg
774e07dc26bSmrgtypedef struct VBOXVHWACMD_SURF_COLORKEY_SET
775e07dc26bSmrg{
776e07dc26bSmrg    union
777e07dc26bSmrg    {
778e07dc26bSmrg        struct
779e07dc26bSmrg        {
780e07dc26bSmrg            VBOXVHWA_SURFHANDLE hSurf;
781e07dc26bSmrg            uint64_t offSurface;
782e07dc26bSmrg            VBOXVHWA_COLORKEY CKey;
783e07dc26bSmrg            uint32_t flags;
784e07dc26bSmrg            uint32_t reserved;
785e07dc26bSmrg        } in;
786e07dc26bSmrg    } u;
787e07dc26bSmrg} VBOXVHWACMD_SURF_COLORKEY_SET;
788e07dc26bSmrg
789e07dc26bSmrg#define VBOXVHWACMD_SURF_OVERLAY_UPDATE_F_SRCMEMRECT 0x00000001
790e07dc26bSmrg#define VBOXVHWACMD_SURF_OVERLAY_UPDATE_F_DSTMEMRECT 0x00000002
791e07dc26bSmrg
792e07dc26bSmrgtypedef struct VBOXVHWACMD_SURF_OVERLAY_UPDATE
793e07dc26bSmrg{
794e07dc26bSmrg    union
795e07dc26bSmrg    {
796e07dc26bSmrg        struct
797e07dc26bSmrg        {
798e07dc26bSmrg            VBOXVHWA_SURFHANDLE hDstSurf;
799e07dc26bSmrg            uint64_t offDstSurface;
800e07dc26bSmrg            VBOXVHWA_RECTL dstRect;
801e07dc26bSmrg            VBOXVHWA_SURFHANDLE hSrcSurf;
802e07dc26bSmrg            uint64_t offSrcSurface;
803e07dc26bSmrg            VBOXVHWA_RECTL srcRect;
804e07dc26bSmrg            uint32_t flags;
805e07dc26bSmrg            uint32_t xFlags;
806e07dc26bSmrg            VBOXVHWA_OVERLAYFX desc;
807e07dc26bSmrg            VBOXVHWA_RECTL xUpdatedSrcMemRect;
808e07dc26bSmrg            VBOXVHWA_RECTL xUpdatedDstMemRect;
809e07dc26bSmrg        } in;
810e07dc26bSmrg    } u;
811e07dc26bSmrg}VBOXVHWACMD_SURF_OVERLAY_UPDATE;
812e07dc26bSmrg
813e07dc26bSmrgtypedef struct VBOXVHWACMD_SURF_OVERLAY_SETPOSITION
814e07dc26bSmrg{
815e07dc26bSmrg    union
816e07dc26bSmrg    {
817e07dc26bSmrg        struct
818e07dc26bSmrg        {
819e07dc26bSmrg            VBOXVHWA_SURFHANDLE hDstSurf;
820e07dc26bSmrg            uint64_t offDstSurface;
821e07dc26bSmrg            VBOXVHWA_SURFHANDLE hSrcSurf;
822e07dc26bSmrg            uint64_t offSrcSurface;
823e07dc26bSmrg            uint32_t xPos;
824e07dc26bSmrg            uint32_t yPos;
825e07dc26bSmrg            uint32_t flags;
826e07dc26bSmrg            uint32_t reserved;
827e07dc26bSmrg        } in;
828e07dc26bSmrg    } u;
829e07dc26bSmrg} VBOXVHWACMD_SURF_OVERLAY_SETPOSITION;
830e07dc26bSmrg
831e07dc26bSmrgtypedef struct VBOXVHWACMD_HH_CONSTRUCT
832e07dc26bSmrg{
833e07dc26bSmrg    void    *pVM;
834e07dc26bSmrg    /* VRAM info for the backend to be able to properly translate VRAM offsets */
835e07dc26bSmrg    void    *pvVRAM;
836e07dc26bSmrg    uint32_t cbVRAM;
837e07dc26bSmrg} VBOXVHWACMD_HH_CONSTRUCT;
838e07dc26bSmrg
839e07dc26bSmrgtypedef struct VBOXVHWACMD_HH_SAVESTATE_SAVEPERFORM
840e07dc26bSmrg{
841e07dc26bSmrg    struct SSMHANDLE * pSSM;
842e07dc26bSmrg} VBOXVHWACMD_HH_SAVESTATE_SAVEPERFORM;
843e07dc26bSmrg
844e07dc26bSmrgtypedef struct VBOXVHWACMD_HH_SAVESTATE_LOADPERFORM
845e07dc26bSmrg{
846e07dc26bSmrg    struct SSMHANDLE * pSSM;
847e07dc26bSmrg} VBOXVHWACMD_HH_SAVESTATE_LOADPERFORM;
848e07dc26bSmrg
849e07dc26bSmrgtypedef DECLCALLBACK(void) FNVBOXVHWA_HH_CALLBACK(void*);
850e07dc26bSmrgtypedef FNVBOXVHWA_HH_CALLBACK *PFNVBOXVHWA_HH_CALLBACK;
851e07dc26bSmrg
852e07dc26bSmrg#define VBOXVHWA_HH_CALLBACK_SET(_pCmd, _pfn, _parg) \
853e07dc26bSmrg    do { \
854e07dc26bSmrg        (_pCmd)->GuestVBVAReserved1 = (uint64_t)(uintptr_t)(_pfn); \
855e07dc26bSmrg        (_pCmd)->GuestVBVAReserved2 = (uint64_t)(uintptr_t)(_parg); \
856e07dc26bSmrg    }while(0)
857e07dc26bSmrg
858e07dc26bSmrg#define VBOXVHWA_HH_CALLBACK_GET(_pCmd) ((PFNVBOXVHWA_HH_CALLBACK)(_pCmd)->GuestVBVAReserved1)
859e07dc26bSmrg#define VBOXVHWA_HH_CALLBACK_GET_ARG(_pCmd) ((void*)(_pCmd)->GuestVBVAReserved2)
860e07dc26bSmrg
861e07dc26bSmrg#pragma pack()
862e07dc26bSmrg#endif /* #ifdef VBOX_WITH_VIDEOHWACCEL */
863e07dc26bSmrg
864e07dc26bSmrg/* All structures are without alignment. */
865e07dc26bSmrg#pragma pack(1)
866e07dc26bSmrg
867e07dc26bSmrgtypedef struct VBVAHOSTFLAGS
868e07dc26bSmrg{
869e07dc26bSmrg    uint32_t u32HostEvents;
870e07dc26bSmrg    uint32_t u32SupportedOrders;
871e07dc26bSmrg} VBVAHOSTFLAGS;
872e07dc26bSmrg
873e07dc26bSmrgtypedef struct VBVABUFFER
874e07dc26bSmrg{
875e07dc26bSmrg    VBVAHOSTFLAGS hostFlags;
876e07dc26bSmrg
877e07dc26bSmrg    /* The offset where the data start in the buffer. */
878e07dc26bSmrg    uint32_t off32Data;
879e07dc26bSmrg    /* The offset where next data must be placed in the buffer. */
880e07dc26bSmrg    uint32_t off32Free;
881e07dc26bSmrg
882e07dc26bSmrg    /* The queue of record descriptions. */
883e07dc26bSmrg    VBVARECORD aRecords[VBVA_MAX_RECORDS];
884e07dc26bSmrg    uint32_t indexRecordFirst;
885e07dc26bSmrg    uint32_t indexRecordFree;
886e07dc26bSmrg
887e07dc26bSmrg    /* Space to leave free in the buffer when large partial records are transferred. */
888e07dc26bSmrg    uint32_t cbPartialWriteThreshold;
889e07dc26bSmrg
890e07dc26bSmrg    uint32_t cbData;
891e07dc26bSmrg    uint8_t  au8Data[1]; /* variable size for the rest of the VBVABUFFER area in VRAM. */
892e07dc26bSmrg} VBVABUFFER;
893e07dc26bSmrg
894e07dc26bSmrg#define VBVA_MAX_RECORD_SIZE (128*_1M)
895e07dc26bSmrg
896e07dc26bSmrg/* guest->host commands */
897e07dc26bSmrg#define VBVA_QUERY_CONF32 1
898e07dc26bSmrg#define VBVA_SET_CONF32   2
899e07dc26bSmrg#define VBVA_INFO_VIEW    3
900e07dc26bSmrg#define VBVA_INFO_HEAP    4
901e07dc26bSmrg#define VBVA_FLUSH        5
902e07dc26bSmrg#define VBVA_INFO_SCREEN  6
903e07dc26bSmrg#define VBVA_ENABLE       7
904e07dc26bSmrg#define VBVA_MOUSE_POINTER_SHAPE 8
905e07dc26bSmrg#ifdef VBOX_WITH_VIDEOHWACCEL
906e07dc26bSmrg# define VBVA_VHWA_CMD    9
907e07dc26bSmrg#endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
908e07dc26bSmrg#ifdef VBOX_WITH_VDMA
909e07dc26bSmrg# define VBVA_VDMA_CTL   10 /* setup G<->H DMA channel info */
910e07dc26bSmrg# define VBVA_VDMA_CMD    11 /* G->H DMA command             */
911e07dc26bSmrg#endif
912e07dc26bSmrg#define VBVA_INFO_CAPS   12 /* informs host about HGSMI caps. see VBVACAPS below */
913e07dc26bSmrg#define VBVA_SCANLINE_CFG    13 /* configures scanline, see VBVASCANLINECFG below */
914e07dc26bSmrg#define VBVA_SCANLINE_INFO   14 /* requests scanline info, see VBVASCANLINEINFO below */
915e07dc26bSmrg#define VBVA_CMDVBVA_SUBMIT  16 /* inform host about VBVA Command submission */
916e07dc26bSmrg#define VBVA_CMDVBVA_FLUSH   17 /* inform host about VBVA Command submission */
917e07dc26bSmrg#define VBVA_CMDVBVA_CTL     18 /* G->H DMA command             */
918e07dc26bSmrg#define VBVA_QUERY_MODE_HINTS 19 /* Query most recent mode hints sent. */
919e07dc26bSmrg/** Report the guest virtual desktop position and size for mapping host and
920e07dc26bSmrg * guest pointer positions. */
921e07dc26bSmrg#define VBVA_REPORT_INPUT_MAPPING 20
922e07dc26bSmrg/** Report the guest cursor position and query the host position. */
923e07dc26bSmrg#define VBVA_CURSOR_POSITION 21
924e07dc26bSmrg
925e07dc26bSmrg/* host->guest commands */
926e07dc26bSmrg#define VBVAHG_EVENT              1
927e07dc26bSmrg#define VBVAHG_DISPLAY_CUSTOM     2
928e07dc26bSmrg#ifdef VBOX_WITH_VDMA
929e07dc26bSmrg#define VBVAHG_SHGSMI_COMPLETION  3
930e07dc26bSmrg#endif
931e07dc26bSmrg
932e07dc26bSmrg#ifdef VBOX_WITH_VIDEOHWACCEL
933e07dc26bSmrg#define VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE 1
934e07dc26bSmrg#pragma pack(1)
935e07dc26bSmrgtypedef struct VBVAHOSTCMDVHWACMDCOMPLETE
936e07dc26bSmrg{
937e07dc26bSmrg    uint32_t offCmd;
938e07dc26bSmrg}VBVAHOSTCMDVHWACMDCOMPLETE;
939e07dc26bSmrg#pragma pack()
940e07dc26bSmrg#endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */
941e07dc26bSmrg
942e07dc26bSmrg#pragma pack(1)
943e07dc26bSmrgtypedef enum
944e07dc26bSmrg{
945e07dc26bSmrg    VBVAHOSTCMD_OP_EVENT = 1,
946e07dc26bSmrg    VBVAHOSTCMD_OP_CUSTOM
947e07dc26bSmrg}VBVAHOSTCMD_OP_TYPE;
948e07dc26bSmrg
949e07dc26bSmrgtypedef struct VBVAHOSTCMDEVENT
950e07dc26bSmrg{
951e07dc26bSmrg    uint64_t pEvent;
952e07dc26bSmrg}VBVAHOSTCMDEVENT;
953e07dc26bSmrg
954e07dc26bSmrg
955e07dc26bSmrgtypedef struct VBVAHOSTCMD
956e07dc26bSmrg{
957e07dc26bSmrg    /* destination ID if >=0 specifies display index, otherwize the command is directed to the miniport */
958e07dc26bSmrg    int32_t iDstID;
959e07dc26bSmrg    int32_t customOpCode;
960e07dc26bSmrg    union
961e07dc26bSmrg    {
962e07dc26bSmrg        struct VBVAHOSTCMD *pNext;
963e07dc26bSmrg        uint32_t             offNext;
964e07dc26bSmrg        uint64_t Data; /* the body is 64-bit aligned */
965e07dc26bSmrg    } u;
966e07dc26bSmrg    char body[1];
967e07dc26bSmrg}VBVAHOSTCMD;
968e07dc26bSmrg
969e07dc26bSmrg#define VBVAHOSTCMD_SIZE(_size) (sizeof(VBVAHOSTCMD) + (_size))
970e07dc26bSmrg#define VBVAHOSTCMD_BODY(_pCmd, _tBody) ((_tBody*)(_pCmd)->body)
971e07dc26bSmrg#define VBVAHOSTCMD_HDR(_pBody) ((VBVAHOSTCMD*)(((uint8_t*)_pBody) - RT_OFFSETOF(VBVAHOSTCMD, body)))
972e07dc26bSmrg#define VBVAHOSTCMD_HDRSIZE (RT_OFFSETOF(VBVAHOSTCMD, body))
973e07dc26bSmrg
974e07dc26bSmrg#pragma pack()
975e07dc26bSmrg
976e07dc26bSmrg/* VBVACONF32::u32Index */
977e07dc26bSmrg#define VBOX_VBVA_CONF32_MONITOR_COUNT  0
978e07dc26bSmrg#define VBOX_VBVA_CONF32_HOST_HEAP_SIZE 1
979e07dc26bSmrg/** Returns VINF_SUCCESS if the host can report mode hints via VBVA.
980e07dc26bSmrg * Set value to VERR_NOT_SUPPORTED before calling. */
981e07dc26bSmrg#define VBOX_VBVA_CONF32_MODE_HINT_REPORTING  2
982e07dc26bSmrg/** Returns VINF_SUCCESS if the host can report guest cursor enabled status via
983e07dc26bSmrg * VBVA.  Set value to VERR_NOT_SUPPORTED before calling. */
984e07dc26bSmrg#define VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING  3
985e07dc26bSmrg/** Returns the currently available host cursor capabilities.  Available if
986e07dc26bSmrg * VBVACONF32::VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING returns success.
987e07dc26bSmrg * @see VMMDevReqMouseStatus::mouseFeatures. */
988e07dc26bSmrg#define VBOX_VBVA_CONF32_CURSOR_CAPABILITIES  4
989e07dc26bSmrg/** Returns the supported flags in VBVAINFOSCREEN::u8Flags. */
990e07dc26bSmrg#define VBOX_VBVA_CONF32_SCREEN_FLAGS 5
991e07dc26bSmrg/** Returns the max size of VBVA record. */
992e07dc26bSmrg#define VBOX_VBVA_CONF32_MAX_RECORD_SIZE 6
993e07dc26bSmrg
994e07dc26bSmrgtypedef struct VBVACONF32
995e07dc26bSmrg{
996e07dc26bSmrg    uint32_t u32Index;
997e07dc26bSmrg    uint32_t u32Value;
998e07dc26bSmrg} VBVACONF32;
999e07dc26bSmrg
1000e07dc26bSmrg/** Reserved for historical reasons. */
1001e07dc26bSmrg#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED0  RT_BIT(0)
1002e07dc26bSmrg/** Guest cursor capability: can the host show a hardware cursor at the host
1003e07dc26bSmrg * pointer location? */
1004e07dc26bSmrg#define VBOX_VBVA_CURSOR_CAPABILITY_HARDWARE   RT_BIT(1)
1005e07dc26bSmrg/** Reserved for historical reasons. */
1006e07dc26bSmrg#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED2  RT_BIT(2)
1007e07dc26bSmrg/** Reserved for historical reasons.  Must always be unset. */
1008e07dc26bSmrg#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED3  RT_BIT(3)
1009e07dc26bSmrg/** Reserved for historical reasons. */
1010e07dc26bSmrg#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED4  RT_BIT(4)
1011e07dc26bSmrg/** Reserved for historical reasons. */
1012e07dc26bSmrg#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED5  RT_BIT(5)
1013e07dc26bSmrg
1014e07dc26bSmrgtypedef struct VBVAINFOVIEW
1015e07dc26bSmrg{
1016e07dc26bSmrg    /* Index of the screen, assigned by the guest. */
1017e07dc26bSmrg    uint32_t u32ViewIndex;
1018e07dc26bSmrg
1019e07dc26bSmrg    /* The screen offset in VRAM, the framebuffer starts here. */
1020e07dc26bSmrg    uint32_t u32ViewOffset;
1021e07dc26bSmrg
1022e07dc26bSmrg    /* The size of the VRAM memory that can be used for the view. */
1023e07dc26bSmrg    uint32_t u32ViewSize;
1024e07dc26bSmrg
1025e07dc26bSmrg    /* The recommended maximum size of the VRAM memory for the screen. */
1026e07dc26bSmrg    uint32_t u32MaxScreenSize;
1027e07dc26bSmrg} VBVAINFOVIEW;
1028e07dc26bSmrg
1029e07dc26bSmrgtypedef struct VBVAINFOHEAP
1030e07dc26bSmrg{
1031e07dc26bSmrg    /* Absolute offset in VRAM of the start of the heap. */
1032e07dc26bSmrg    uint32_t u32HeapOffset;
1033e07dc26bSmrg
1034e07dc26bSmrg    /* The size of the heap. */
1035e07dc26bSmrg    uint32_t u32HeapSize;
1036e07dc26bSmrg
1037e07dc26bSmrg} VBVAINFOHEAP;
1038e07dc26bSmrg
1039e07dc26bSmrgtypedef struct VBVAFLUSH
1040e07dc26bSmrg{
1041e07dc26bSmrg    uint32_t u32Reserved;
1042e07dc26bSmrg
1043e07dc26bSmrg} VBVAFLUSH;
1044e07dc26bSmrg
1045e07dc26bSmrgtypedef struct VBVACMDVBVASUBMIT
1046e07dc26bSmrg{
1047e07dc26bSmrg    uint32_t u32Reserved;
1048e07dc26bSmrg} VBVACMDVBVASUBMIT;
1049e07dc26bSmrg
1050e07dc26bSmrg/* flush is requested because due to guest command buffer overflow */
1051e07dc26bSmrg#define VBVACMDVBVAFLUSH_F_GUEST_BUFFER_OVERFLOW 1
1052e07dc26bSmrg
1053e07dc26bSmrgtypedef struct VBVACMDVBVAFLUSH
1054e07dc26bSmrg{
1055e07dc26bSmrg    uint32_t u32Flags;
1056e07dc26bSmrg} VBVACMDVBVAFLUSH;
1057e07dc26bSmrg
1058e07dc26bSmrg
1059e07dc26bSmrg/* VBVAINFOSCREEN::u8Flags */
1060e07dc26bSmrg#define VBVA_SCREEN_F_NONE     0x0000
1061e07dc26bSmrg#define VBVA_SCREEN_F_ACTIVE   0x0001
1062e07dc26bSmrg/** The virtual monitor has been disabled by the guest and should be removed
1063e07dc26bSmrg * by the host and ignored for purposes of pointer position calculation. */
1064e07dc26bSmrg#define VBVA_SCREEN_F_DISABLED 0x0002
1065e07dc26bSmrg/** The virtual monitor has been blanked by the guest and should be blacked
1066e07dc26bSmrg * out by the host using width, height, etc values from the VBVAINFOSCREEN request. */
1067e07dc26bSmrg#define VBVA_SCREEN_F_BLANK    0x0004
1068e07dc26bSmrg/** The virtual monitor has been blanked by the guest and should be blacked
1069e07dc26bSmrg * out by the host using the previous mode values for width. height, etc. */
1070e07dc26bSmrg#define VBVA_SCREEN_F_BLANK2   0x0008
1071e07dc26bSmrg
1072e07dc26bSmrgtypedef struct VBVAINFOSCREEN
1073e07dc26bSmrg{
1074e07dc26bSmrg    /* Which view contains the screen. */
1075e07dc26bSmrg    uint32_t u32ViewIndex;
1076e07dc26bSmrg
1077e07dc26bSmrg    /* Physical X origin relative to the primary screen. */
1078e07dc26bSmrg    int32_t i32OriginX;
1079e07dc26bSmrg
1080e07dc26bSmrg    /* Physical Y origin relative to the primary screen. */
1081e07dc26bSmrg    int32_t i32OriginY;
1082e07dc26bSmrg
1083e07dc26bSmrg    /* Offset of visible framebuffer relative to the framebuffer start. */
1084e07dc26bSmrg    uint32_t u32StartOffset;
1085e07dc26bSmrg
1086e07dc26bSmrg    /* The scan line size in bytes. */
1087e07dc26bSmrg    uint32_t u32LineSize;
1088e07dc26bSmrg
1089e07dc26bSmrg    /* Width of the screen. */
1090e07dc26bSmrg    uint32_t u32Width;
1091e07dc26bSmrg
1092e07dc26bSmrg    /* Height of the screen. */
1093e07dc26bSmrg    uint32_t u32Height;
1094e07dc26bSmrg
1095e07dc26bSmrg    /* Color depth. */
1096e07dc26bSmrg    uint16_t u16BitsPerPixel;
1097e07dc26bSmrg
1098e07dc26bSmrg    /* VBVA_SCREEN_F_* */
1099e07dc26bSmrg    uint16_t u16Flags;
1100e07dc26bSmrg} VBVAINFOSCREEN;
1101e07dc26bSmrg
1102e07dc26bSmrg
1103e07dc26bSmrg/* VBVAENABLE::u32Flags */
1104e07dc26bSmrg#define VBVA_F_NONE    0x00000000
1105e07dc26bSmrg#define VBVA_F_ENABLE  0x00000001
1106e07dc26bSmrg#define VBVA_F_DISABLE 0x00000002
1107e07dc26bSmrg/* extended VBVA to be used with WDDM */
1108e07dc26bSmrg#define VBVA_F_EXTENDED 0x00000004
1109e07dc26bSmrg/* vbva offset is absolute VRAM offset */
1110e07dc26bSmrg#define VBVA_F_ABSOFFSET 0x00000008
1111e07dc26bSmrg
1112e07dc26bSmrgtypedef struct VBVAENABLE
1113e07dc26bSmrg{
1114e07dc26bSmrg    uint32_t u32Flags;
1115e07dc26bSmrg    uint32_t u32Offset;
1116e07dc26bSmrg    int32_t  i32Result;
1117e07dc26bSmrg} VBVAENABLE;
1118e07dc26bSmrg
1119e07dc26bSmrgtypedef struct VBVAENABLE_EX
1120e07dc26bSmrg{
1121e07dc26bSmrg    VBVAENABLE Base;
1122e07dc26bSmrg    uint32_t u32ScreenId;
1123e07dc26bSmrg} VBVAENABLE_EX;
1124e07dc26bSmrg
1125e07dc26bSmrg
1126e07dc26bSmrgtypedef struct VBVAMOUSEPOINTERSHAPE
1127e07dc26bSmrg{
1128e07dc26bSmrg    /* The host result. */
1129e07dc26bSmrg    int32_t i32Result;
1130e07dc26bSmrg
1131e07dc26bSmrg    /* VBOX_MOUSE_POINTER_* bit flags. */
1132e07dc26bSmrg    uint32_t fu32Flags;
1133e07dc26bSmrg
1134e07dc26bSmrg    /* X coordinate of the hot spot. */
1135e07dc26bSmrg    uint32_t u32HotX;
1136e07dc26bSmrg
1137e07dc26bSmrg    /* Y coordinate of the hot spot. */
1138e07dc26bSmrg    uint32_t u32HotY;
1139e07dc26bSmrg
1140e07dc26bSmrg    /* Width of the pointer in pixels. */
1141e07dc26bSmrg    uint32_t u32Width;
1142e07dc26bSmrg
1143e07dc26bSmrg    /* Height of the pointer in scanlines. */
1144e07dc26bSmrg    uint32_t u32Height;
1145e07dc26bSmrg
1146e07dc26bSmrg    /* Pointer data.
1147e07dc26bSmrg     *
1148e07dc26bSmrg     ****
1149e07dc26bSmrg     * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
1150e07dc26bSmrg     *
1151e07dc26bSmrg     * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
1152e07dc26bSmrg     * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
1153e07dc26bSmrg     *
1154e07dc26bSmrg     * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
1155e07dc26bSmrg     * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
1156e07dc26bSmrg     * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
1157e07dc26bSmrg     *
1158e07dc26bSmrg     * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
1159e07dc26bSmrg     * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
1160e07dc26bSmrg     * end of any scanline are undefined.
1161e07dc26bSmrg     *
1162e07dc26bSmrg     * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
1163e07dc26bSmrg     * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
1164e07dc26bSmrg     * Bytes in the gap between the AND and the XOR mask are undefined.
1165e07dc26bSmrg     * XOR mask scanlines have no gap between them and size of XOR mask is:
1166e07dc26bSmrg     * cXor = width * 4 * height.
1167e07dc26bSmrg     ****
1168e07dc26bSmrg     *
1169e07dc26bSmrg     * Preallocate 4 bytes for accessing actual data as p->au8Data.
1170e07dc26bSmrg     */
1171e07dc26bSmrg    uint8_t au8Data[4];
1172e07dc26bSmrg
1173e07dc26bSmrg} VBVAMOUSEPOINTERSHAPE;
1174e07dc26bSmrg
1175e07dc26bSmrg/** @name VBVAMOUSEPOINTERSHAPE::fu32Flags
1176e07dc26bSmrg * @note The VBOX_MOUSE_POINTER_* flags are used in the guest video driver,
1177e07dc26bSmrg *       values must be <= 0x8000 and must not be changed. (try make more sense
1178e07dc26bSmrg *       of this, please).
1179e07dc26bSmrg * @{
1180e07dc26bSmrg */
1181e07dc26bSmrg/** pointer is visible */
1182e07dc26bSmrg#define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
1183e07dc26bSmrg/** pointer has alpha channel */
1184e07dc26bSmrg#define VBOX_MOUSE_POINTER_ALPHA   (0x0002)
1185e07dc26bSmrg/** pointerData contains new pointer shape */
1186e07dc26bSmrg#define VBOX_MOUSE_POINTER_SHAPE   (0x0004)
1187e07dc26bSmrg/** @} */
1188e07dc26bSmrg
1189e07dc26bSmrg/* the guest driver can handle asynch guest cmd completion by reading the command offset from io port */
1190e07dc26bSmrg#define VBVACAPS_COMPLETEGCMD_BY_IOREAD 0x00000001
1191e07dc26bSmrg/* the guest driver can handle video adapter IRQs */
1192e07dc26bSmrg#define VBVACAPS_IRQ                    0x00000002
1193e07dc26bSmrg/** The guest can read video mode hints sent via VBVA. */
1194e07dc26bSmrg#define VBVACAPS_VIDEO_MODE_HINTS       0x00000004
1195e07dc26bSmrg/** The guest can switch to a software cursor on demand. */
1196e07dc26bSmrg#define VBVACAPS_DISABLE_CURSOR_INTEGRATION 0x00000008
1197e07dc26bSmrg/** The guest does not depend on host handling the VBE registers. */
1198e07dc26bSmrg#define VBVACAPS_USE_VBVA_ONLY 0x00000010
1199e07dc26bSmrgtypedef struct VBVACAPS
1200e07dc26bSmrg{
1201e07dc26bSmrg    int32_t rc;
1202e07dc26bSmrg    uint32_t fCaps;
1203e07dc26bSmrg} VBVACAPS;
1204e07dc26bSmrg
1205e07dc26bSmrg/* makes graphics device generate IRQ on VSYNC */
1206e07dc26bSmrg#define VBVASCANLINECFG_ENABLE_VSYNC_IRQ        0x00000001
1207e07dc26bSmrg/* guest driver may request the current scanline */
1208e07dc26bSmrg#define VBVASCANLINECFG_ENABLE_SCANLINE_INFO    0x00000002
1209e07dc26bSmrg/* request the current refresh period, returned in u32RefreshPeriodMs */
1210e07dc26bSmrg#define VBVASCANLINECFG_QUERY_REFRESH_PERIOD    0x00000004
1211e07dc26bSmrg/* set new refresh period specified in u32RefreshPeriodMs.
1212e07dc26bSmrg * if used with VBVASCANLINECFG_QUERY_REFRESH_PERIOD,
1213e07dc26bSmrg * u32RefreshPeriodMs is set to the previous refresh period on return */
1214e07dc26bSmrg#define VBVASCANLINECFG_SET_REFRESH_PERIOD      0x00000008
1215e07dc26bSmrg
1216e07dc26bSmrgtypedef struct VBVASCANLINECFG
1217e07dc26bSmrg{
1218e07dc26bSmrg    int32_t rc;
1219e07dc26bSmrg    uint32_t fFlags;
1220e07dc26bSmrg    uint32_t u32RefreshPeriodMs;
1221e07dc26bSmrg    uint32_t u32Reserved;
1222e07dc26bSmrg} VBVASCANLINECFG;
1223e07dc26bSmrg
1224e07dc26bSmrgtypedef struct VBVASCANLINEINFO
1225e07dc26bSmrg{
1226e07dc26bSmrg    int32_t rc;
1227e07dc26bSmrg    uint32_t u32ScreenId;
1228e07dc26bSmrg    uint32_t u32InVBlank;
1229e07dc26bSmrg    uint32_t u32ScanLine;
1230e07dc26bSmrg} VBVASCANLINEINFO;
1231e07dc26bSmrg
1232e07dc26bSmrg/** Query the most recent mode hints received from the host. */
1233e07dc26bSmrgtypedef struct VBVAQUERYMODEHINTS
1234e07dc26bSmrg{
1235e07dc26bSmrg    /** The maximum number of screens to return hints for. */
1236e07dc26bSmrg    uint16_t cHintsQueried;
1237e07dc26bSmrg    /** The size of the mode hint structures directly following this one. */
1238e07dc26bSmrg    uint16_t cbHintStructureGuest;
1239e07dc26bSmrg    /** The return code for the operation.  Initialise to VERR_NOT_SUPPORTED. */
1240e07dc26bSmrg    int32_t  rc;
1241e07dc26bSmrg} VBVAQUERYMODEHINTS;
1242e07dc26bSmrg
1243e07dc26bSmrg/** Structure in which a mode hint is returned.  The guest allocates an array
1244e07dc26bSmrg *  of these immediately after the VBVAQUERYMODEHINTS structure.  To accomodate
1245e07dc26bSmrg *  future extensions, the VBVAQUERYMODEHINTS structure specifies the size of
1246e07dc26bSmrg *  the VBVAMODEHINT structures allocated by the guest, and the host only fills
1247e07dc26bSmrg *  out structure elements which fit into that size.  The host should fill any
1248e07dc26bSmrg *  unused members (e.g. dx, dy) or structure space on the end with ~0.  The
1249e07dc26bSmrg *  whole structure can legally be set to ~0 to skip a screen. */
1250e07dc26bSmrgtypedef struct VBVAMODEHINT
1251e07dc26bSmrg{
1252e07dc26bSmrg    uint32_t magic;
1253e07dc26bSmrg    uint32_t cx;
1254e07dc26bSmrg    uint32_t cy;
1255e07dc26bSmrg    uint32_t cBPP;  /* Which has never been used... */
1256e07dc26bSmrg    uint32_t cDisplay;
1257e07dc26bSmrg    uint32_t dx;  /**< X offset into the virtual frame-buffer. */
1258e07dc26bSmrg    uint32_t dy;  /**< Y offset into the virtual frame-buffer. */
1259e07dc26bSmrg    uint32_t fEnabled;  /* Not fFlags.  Add new members for new flags. */
1260e07dc26bSmrg} VBVAMODEHINT;
1261e07dc26bSmrg
1262e07dc26bSmrg#define VBVAMODEHINT_MAGIC UINT32_C(0x0801add9)
1263e07dc26bSmrg
1264e07dc26bSmrg/** Report the rectangle relative to which absolute pointer events should be
1265e07dc26bSmrg *  expressed.  This information remains valid until the next VBVA resize event
1266e07dc26bSmrg *  for any screen, at which time it is reset to the bounding rectangle of all
1267e07dc26bSmrg *  virtual screens and must be re-set.
1268e07dc26bSmrg *  @see VBVA_REPORT_INPUT_MAPPING. */
1269e07dc26bSmrgtypedef struct VBVAREPORTINPUTMAPPING
1270e07dc26bSmrg{
1271e07dc26bSmrg    int32_t x;    /**< Upper left X co-ordinate relative to the first screen. */
1272e07dc26bSmrg    int32_t y;    /**< Upper left Y co-ordinate relative to the first screen. */
1273e07dc26bSmrg    uint32_t cx;  /**< Rectangle width. */
1274e07dc26bSmrg    uint32_t cy;  /**< Rectangle height. */
1275e07dc26bSmrg} VBVAREPORTINPUTMAPPING;
1276e07dc26bSmrg
1277e07dc26bSmrg/** Report the guest cursor position and query the host one.  The host may wish
1278e07dc26bSmrg *  to use the guest information to re-position its own cursor (though this is
1279e07dc26bSmrg *  currently unlikely).
1280e07dc26bSmrg *  @see VBVA_CURSOR_POSITION */
1281e07dc26bSmrgtypedef struct VBVACURSORPOSITION
1282e07dc26bSmrg{
1283e07dc26bSmrg    uint32_t fReportPosition;  /**< Are we reporting a position? */
1284e07dc26bSmrg    uint32_t x;                /**< Guest cursor X position */
1285e07dc26bSmrg    uint32_t y;                /**< Guest cursor Y position */
1286e07dc26bSmrg} VBVACURSORPOSITION;
1287e07dc26bSmrg
1288e07dc26bSmrg#pragma pack()
1289e07dc26bSmrg
1290e07dc26bSmrgtypedef uint64_t VBOXVIDEOOFFSET;
1291e07dc26bSmrg
1292e07dc26bSmrg#define VBOXVIDEOOFFSET_VOID ((VBOXVIDEOOFFSET)~0)
1293e07dc26bSmrg
1294e07dc26bSmrg#pragma pack(1)
1295e07dc26bSmrg
1296e07dc26bSmrg/*
1297e07dc26bSmrg * VBOXSHGSMI made on top HGSMI and allows receiving notifications
1298e07dc26bSmrg * about G->H command completion
1299e07dc26bSmrg */
1300e07dc26bSmrg/* SHGSMI command header */
1301e07dc26bSmrgtypedef struct VBOXSHGSMIHEADER
1302e07dc26bSmrg{
1303e07dc26bSmrg    uint64_t pvNext;    /*<- completion processing queue */
1304e07dc26bSmrg    uint32_t fFlags;    /*<- see VBOXSHGSMI_FLAG_XXX Flags */
1305e07dc26bSmrg    uint32_t cRefs;     /*<- command referece count */
1306e07dc26bSmrg    uint64_t u64Info1;  /*<- contents depends on the fFlags value */
1307e07dc26bSmrg    uint64_t u64Info2;  /*<- contents depends on the fFlags value */
1308e07dc26bSmrg} VBOXSHGSMIHEADER, *PVBOXSHGSMIHEADER;
1309e07dc26bSmrg
1310e07dc26bSmrgtypedef enum
1311e07dc26bSmrg{
1312e07dc26bSmrg    VBOXVDMACMD_TYPE_UNDEFINED         = 0,
1313e07dc26bSmrg    VBOXVDMACMD_TYPE_DMA_PRESENT_BLT   = 1,
1314e07dc26bSmrg    VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER,
1315e07dc26bSmrg    VBOXVDMACMD_TYPE_DMA_BPB_FILL,
1316e07dc26bSmrg    VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY,
1317e07dc26bSmrg    VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL,
1318e07dc26bSmrg    VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP,
1319e07dc26bSmrg    VBOXVDMACMD_TYPE_DMA_NOP,
1320e07dc26bSmrg    VBOXVDMACMD_TYPE_CHROMIUM_CMD, /* chromium cmd */
1321e07dc26bSmrg    VBOXVDMACMD_TYPE_DMA_BPB_TRANSFER_VRAMSYS,
1322e07dc26bSmrg    VBOXVDMACMD_TYPE_CHILD_STATUS_IRQ /* make the device notify child (monitor) state change IRQ */
1323e07dc26bSmrg} VBOXVDMACMD_TYPE;
1324e07dc26bSmrg
1325e07dc26bSmrg#pragma pack()
1326e07dc26bSmrg
1327e07dc26bSmrg/* the command processing was asynch, set by the host to indicate asynch command completion
1328e07dc26bSmrg * must not be cleared once set, the command completion is performed by issuing a host->guest completion command
1329e07dc26bSmrg * while keeping this flag unchanged */
1330e07dc26bSmrg#define VBOXSHGSMI_FLAG_HG_ASYNCH               0x00010000
1331e07dc26bSmrg#if 0
1332e07dc26bSmrg/* if set     - asynch completion is performed by issuing the event,
1333e07dc26bSmrg * if cleared - asynch completion is performed by calling a callback */
1334e07dc26bSmrg#define VBOXSHGSMI_FLAG_GH_ASYNCH_EVENT         0x00000001
1335e07dc26bSmrg#endif
1336e07dc26bSmrg/* issue interrupt on asynch completion, used for critical G->H commands,
1337e07dc26bSmrg * i.e. for completion of which guest is waiting. */
1338e07dc26bSmrg#define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ           0x00000002
1339e07dc26bSmrg/* guest does not do any op on completion of this command,
1340e07dc26bSmrg * the host may copy the command and indicate that it does not need the command anymore
1341e07dc26bSmrg * by not setting VBOXSHGSMI_FLAG_HG_ASYNCH */
1342e07dc26bSmrg#define VBOXSHGSMI_FLAG_GH_ASYNCH_NOCOMPLETION  0x00000004
1343e07dc26bSmrg/* guest requires the command to be processed asynchronously,
1344e07dc26bSmrg * not setting VBOXSHGSMI_FLAG_HG_ASYNCH by the host in this case is treated as command failure */
1345e07dc26bSmrg#define VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE         0x00000008
1346e07dc26bSmrg/* force IRQ on cmd completion */
1347e07dc26bSmrg#define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ_FORCE     0x00000010
1348e07dc26bSmrg/* an IRQ-level callback is associated with the command */
1349e07dc26bSmrg#define VBOXSHGSMI_FLAG_GH_ASYNCH_CALLBACK_IRQ  0x00000020
1350e07dc26bSmrg/* guest expects this command to be completed synchronously */
1351e07dc26bSmrg#define VBOXSHGSMI_FLAG_GH_SYNCH                0x00000040
1352e07dc26bSmrg
1353e07dc26bSmrg
1354e07dc26bSmrgDECLINLINE(uint8_t *) VBoxSHGSMIBufferData (const VBOXSHGSMIHEADER* pHeader)
1355e07dc26bSmrg{
1356e07dc26bSmrg    return (uint8_t *)pHeader + sizeof (VBOXSHGSMIHEADER);
1357e07dc26bSmrg}
1358e07dc26bSmrg
1359e07dc26bSmrg#define VBoxSHGSMIBufferHeaderSize() (sizeof (VBOXSHGSMIHEADER))
1360e07dc26bSmrg
1361e07dc26bSmrgDECLINLINE(PVBOXSHGSMIHEADER) VBoxSHGSMIBufferHeader (const void *pvData)
1362e07dc26bSmrg{
1363e07dc26bSmrg    return (PVBOXSHGSMIHEADER)((uint8_t *)pvData - sizeof (VBOXSHGSMIHEADER));
1364e07dc26bSmrg}
1365e07dc26bSmrg
1366e07dc26bSmrg#ifdef VBOX_WITH_VDMA
1367e07dc26bSmrg# pragma pack(1)
1368e07dc26bSmrg
1369e07dc26bSmrg/* VDMA - Video DMA */
1370e07dc26bSmrg
1371e07dc26bSmrg/* VDMA Control API */
1372e07dc26bSmrg/* VBOXVDMA_CTL::u32Flags */
1373e07dc26bSmrgtypedef enum
1374e07dc26bSmrg{
1375e07dc26bSmrg    VBOXVDMA_CTL_TYPE_NONE = 0,
1376e07dc26bSmrg    VBOXVDMA_CTL_TYPE_ENABLE,
1377e07dc26bSmrg    VBOXVDMA_CTL_TYPE_DISABLE,
1378e07dc26bSmrg    VBOXVDMA_CTL_TYPE_FLUSH,
1379e07dc26bSmrg    VBOXVDMA_CTL_TYPE_WATCHDOG
1380e07dc26bSmrg} VBOXVDMA_CTL_TYPE;
1381e07dc26bSmrg
1382e07dc26bSmrgtypedef struct VBOXVDMA_CTL
1383e07dc26bSmrg{
1384e07dc26bSmrg    VBOXVDMA_CTL_TYPE enmCtl;
1385e07dc26bSmrg    uint32_t u32Offset;
1386e07dc26bSmrg    int32_t  i32Result;
1387e07dc26bSmrg} VBOXVDMA_CTL, *PVBOXVDMA_CTL;
1388e07dc26bSmrg
1389e07dc26bSmrgtypedef struct VBOXVDMA_RECTL
1390e07dc26bSmrg{
1391e07dc26bSmrg    int16_t left;
1392e07dc26bSmrg    int16_t top;
1393e07dc26bSmrg    uint16_t width;
1394e07dc26bSmrg    uint16_t height;
1395e07dc26bSmrg} VBOXVDMA_RECTL, *PVBOXVDMA_RECTL;
1396e07dc26bSmrg
1397e07dc26bSmrgtypedef enum
1398e07dc26bSmrg{
1399e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_UNKNOWN      =  0,
1400e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_R8G8B8       = 20,
1401e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_A8R8G8B8     = 21,
1402e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_X8R8G8B8     = 22,
1403e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_R5G6B5       = 23,
1404e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_X1R5G5B5     = 24,
1405e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_A1R5G5B5     = 25,
1406e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_A4R4G4B4     = 26,
1407e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_R3G3B2       = 27,
1408e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_A8           = 28,
1409e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_A8R3G3B2     = 29,
1410e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_X4R4G4B4     = 30,
1411e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_A2B10G10R10  = 31,
1412e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_A8B8G8R8     = 32,
1413e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_X8B8G8R8     = 33,
1414e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_G16R16       = 34,
1415e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_A2R10G10B10  = 35,
1416e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_A16B16G16R16 = 36,
1417e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_A8P8         = 40,
1418e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_P8           = 41,
1419e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_L8           = 50,
1420e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_A8L8         = 51,
1421e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_A4L4         = 52,
1422e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_V8U8         = 60,
1423e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_L6V5U5       = 61,
1424e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_X8L8V8U8     = 62,
1425e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_Q8W8V8U8     = 63,
1426e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_V16U16       = 64,
1427e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_W11V11U10    = 65,
1428e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT_A2W10V10U10  = 67
1429e07dc26bSmrg} VBOXVDMA_PIXEL_FORMAT;
1430e07dc26bSmrg
1431e07dc26bSmrgtypedef struct VBOXVDMA_SURF_DESC
1432e07dc26bSmrg{
1433e07dc26bSmrg    uint32_t width;
1434e07dc26bSmrg    uint32_t height;
1435e07dc26bSmrg    VBOXVDMA_PIXEL_FORMAT format;
1436e07dc26bSmrg    uint32_t bpp;
1437e07dc26bSmrg    uint32_t pitch;
1438e07dc26bSmrg    uint32_t fFlags;
1439e07dc26bSmrg} VBOXVDMA_SURF_DESC, *PVBOXVDMA_SURF_DESC;
1440e07dc26bSmrg
1441e07dc26bSmrg/*typedef uint64_t VBOXVDMAPHADDRESS;*/
1442e07dc26bSmrgtypedef uint64_t VBOXVDMASURFHANDLE;
1443e07dc26bSmrg
1444e07dc26bSmrg/* region specified as a rectangle, otherwize it is a size of memory pointed to by phys address */
1445e07dc26bSmrg#define VBOXVDMAOPERAND_FLAGS_RECTL       0x1
1446e07dc26bSmrg/* Surface handle is valid */
1447e07dc26bSmrg#define VBOXVDMAOPERAND_FLAGS_PRIMARY        0x2
1448e07dc26bSmrg/* address is offset in VRAM */
1449e07dc26bSmrg#define VBOXVDMAOPERAND_FLAGS_VRAMOFFSET  0x4
1450e07dc26bSmrg
1451e07dc26bSmrg
1452e07dc26bSmrg/* VBOXVDMACBUF_DR::phBuf specifies offset in VRAM */
1453e07dc26bSmrg#define VBOXVDMACBUF_FLAG_BUF_VRAM_OFFSET 0x00000001
1454e07dc26bSmrg/* command buffer follows the VBOXVDMACBUF_DR in VRAM, VBOXVDMACBUF_DR::phBuf is ignored */
1455e07dc26bSmrg#define VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR  0x00000002
1456e07dc26bSmrg
1457e07dc26bSmrg/*
1458e07dc26bSmrg * We can not submit the DMA command via VRAM since we do not have control over
1459e07dc26bSmrg * DMA command buffer [de]allocation, i.e. we only control the buffer contents.
1460e07dc26bSmrg * In other words the system may call one of our callbacks to fill a command buffer
1461e07dc26bSmrg * with the necessary commands and then discard the buffer w/o any notification.
1462e07dc26bSmrg *
1463e07dc26bSmrg * We have only DMA command buffer physical address at submission time.
1464e07dc26bSmrg *
1465e07dc26bSmrg * so the only way is to */
1466e07dc26bSmrgtypedef struct VBOXVDMACBUF_DR
1467e07dc26bSmrg{
1468e07dc26bSmrg    uint16_t fFlags;
1469e07dc26bSmrg    uint16_t cbBuf;
1470e07dc26bSmrg    /* RT_SUCCESS()     - on success
1471e07dc26bSmrg     * VERR_INTERRUPTED - on preemption
1472e07dc26bSmrg     * VERR_xxx         - on error */
1473e07dc26bSmrg    int32_t  rc;
1474e07dc26bSmrg    union
1475e07dc26bSmrg    {
1476e07dc26bSmrg        uint64_t phBuf;
1477e07dc26bSmrg        VBOXVIDEOOFFSET offVramBuf;
1478e07dc26bSmrg    } Location;
1479e07dc26bSmrg    uint64_t aGuestData[7];
1480e07dc26bSmrg} VBOXVDMACBUF_DR, *PVBOXVDMACBUF_DR;
1481e07dc26bSmrg
1482e07dc26bSmrg#define VBOXVDMACBUF_DR_TAIL(_pCmd, _t) ( (_t*)(((uint8_t*)(_pCmd)) + sizeof (VBOXVDMACBUF_DR)) )
1483e07dc26bSmrg#define VBOXVDMACBUF_DR_FROM_TAIL(_pCmd) ( (VBOXVDMACBUF_DR*)(((uint8_t*)(_pCmd)) - sizeof (VBOXVDMACBUF_DR)) )
1484e07dc26bSmrg
1485e07dc26bSmrgtypedef struct VBOXVDMACMD
1486e07dc26bSmrg{
1487e07dc26bSmrg    VBOXVDMACMD_TYPE enmType;
1488e07dc26bSmrg    uint32_t u32CmdSpecific;
1489e07dc26bSmrg} VBOXVDMACMD, *PVBOXVDMACMD;
1490e07dc26bSmrg
1491e07dc26bSmrg#define VBOXVDMACMD_HEADER_SIZE() sizeof (VBOXVDMACMD)
1492e07dc26bSmrg#define VBOXVDMACMD_SIZE_FROMBODYSIZE(_s) (VBOXVDMACMD_HEADER_SIZE() + (_s))
1493e07dc26bSmrg#define VBOXVDMACMD_SIZE(_t) (VBOXVDMACMD_SIZE_FROMBODYSIZE(sizeof (_t)))
1494e07dc26bSmrg#define VBOXVDMACMD_BODY(_pCmd, _t) ( (_t*)(((uint8_t*)(_pCmd)) + VBOXVDMACMD_HEADER_SIZE()) )
1495e07dc26bSmrg#define VBOXVDMACMD_BODY_SIZE(_s) ( (_s) - VBOXVDMACMD_HEADER_SIZE() )
1496e07dc26bSmrg#define VBOXVDMACMD_FROM_BODY(_pCmd) ( (VBOXVDMACMD*)(((uint8_t*)(_pCmd)) - VBOXVDMACMD_HEADER_SIZE()) )
1497e07dc26bSmrg#define VBOXVDMACMD_BODY_FIELD_OFFSET(_ot, _t, _f) ( (_ot)(uintptr_t)( VBOXVDMACMD_BODY(0, uint8_t) + RT_OFFSETOF(_t, _f) ) )
1498e07dc26bSmrg
1499e07dc26bSmrgtypedef struct VBOXVDMACMD_DMA_PRESENT_BLT
1500e07dc26bSmrg{
1501e07dc26bSmrg    VBOXVIDEOOFFSET offSrc;
1502e07dc26bSmrg    VBOXVIDEOOFFSET offDst;
1503e07dc26bSmrg    VBOXVDMA_SURF_DESC srcDesc;
1504e07dc26bSmrg    VBOXVDMA_SURF_DESC dstDesc;
1505e07dc26bSmrg    VBOXVDMA_RECTL srcRectl;
1506e07dc26bSmrg    VBOXVDMA_RECTL dstRectl;
1507e07dc26bSmrg    uint32_t u32Reserved;
1508e07dc26bSmrg    uint32_t cDstSubRects;
1509e07dc26bSmrg    VBOXVDMA_RECTL aDstSubRects[1];
1510e07dc26bSmrg} VBOXVDMACMD_DMA_PRESENT_BLT, *PVBOXVDMACMD_DMA_PRESENT_BLT;
1511e07dc26bSmrg
1512e07dc26bSmrgtypedef struct VBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY
1513e07dc26bSmrg{
1514e07dc26bSmrg    VBOXVDMA_RECTL Rect;
1515e07dc26bSmrg} VBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY, *PVBOXVDMACMD_DMA_PRESENT_SHADOW2PRIMARY;
1516e07dc26bSmrg
1517e07dc26bSmrg
1518e07dc26bSmrg#define VBOXVDMACMD_DMA_BPB_TRANSFER_F_SRC_VRAMOFFSET 0x00000001
1519e07dc26bSmrg#define VBOXVDMACMD_DMA_BPB_TRANSFER_F_DST_VRAMOFFSET 0x00000002
1520e07dc26bSmrg
1521e07dc26bSmrgtypedef struct VBOXVDMACMD_DMA_BPB_TRANSFER
1522e07dc26bSmrg{
1523e07dc26bSmrg    uint32_t cbTransferSize;
1524e07dc26bSmrg    uint32_t fFlags;
1525e07dc26bSmrg    union
1526e07dc26bSmrg    {
1527e07dc26bSmrg        uint64_t phBuf;
1528e07dc26bSmrg        VBOXVIDEOOFFSET offVramBuf;
1529e07dc26bSmrg    } Src;
1530e07dc26bSmrg    union
1531e07dc26bSmrg    {
1532e07dc26bSmrg        uint64_t phBuf;
1533e07dc26bSmrg        VBOXVIDEOOFFSET offVramBuf;
1534e07dc26bSmrg    } Dst;
1535e07dc26bSmrg} VBOXVDMACMD_DMA_BPB_TRANSFER, *PVBOXVDMACMD_DMA_BPB_TRANSFER;
1536e07dc26bSmrg
1537e07dc26bSmrg#define VBOXVDMACMD_SYSMEMEL_F_PAGELIST 0x00000001
1538e07dc26bSmrg
1539e07dc26bSmrgtypedef struct VBOXVDMACMD_SYSMEMEL
1540e07dc26bSmrg{
1541e07dc26bSmrg    uint32_t cPages;
1542e07dc26bSmrg    uint32_t fFlags;
1543e07dc26bSmrg    uint64_t phBuf[1];
1544e07dc26bSmrg} VBOXVDMACMD_SYSMEMEL, *PVBOXVDMACMD_SYSMEMEL;
1545e07dc26bSmrg
1546e07dc26bSmrg#define VBOXVDMACMD_SYSMEMEL_NEXT(_pEl) (((_pEl)->fFlags & VBOXVDMACMD_SYSMEMEL_F_PAGELIST) ? \
1547e07dc26bSmrg        ((PVBOXVDMACMD_SYSMEMEL)(((uint8_t*)(_pEl))+RT_OFFSETOF(VBOXVDMACMD_SYSMEMEL, phBuf[(_pEl)->cPages]))) \
1548e07dc26bSmrg        : \
1549e07dc26bSmrg        ((_pEl)+1)
1550e07dc26bSmrg
1551e07dc26bSmrg#define VBOXVDMACMD_DMA_BPB_TRANSFER_VRAMSYS_SYS2VRAM 0x00000001
1552e07dc26bSmrg
1553e07dc26bSmrgtypedef struct VBOXVDMACMD_DMA_BPB_TRANSFER_VRAMSYS
1554e07dc26bSmrg{
1555e07dc26bSmrg    uint32_t cTransferPages;
1556e07dc26bSmrg    uint32_t fFlags;
1557e07dc26bSmrg    VBOXVIDEOOFFSET offVramBuf;
1558e07dc26bSmrg    VBOXVDMACMD_SYSMEMEL FirstEl;
1559e07dc26bSmrg} VBOXVDMACMD_DMA_BPB_TRANSFER_VRAMSYS, *PVBOXVDMACMD_DMA_BPB_TRANSFER_VRAMSYS;
1560e07dc26bSmrg
1561e07dc26bSmrgtypedef struct VBOXVDMACMD_DMA_BPB_FILL
1562e07dc26bSmrg{
1563e07dc26bSmrg    VBOXVIDEOOFFSET offSurf;
1564e07dc26bSmrg    uint32_t cbFillSize;
1565e07dc26bSmrg    uint32_t u32FillPattern;
1566e07dc26bSmrg} VBOXVDMACMD_DMA_BPB_FILL, *PVBOXVDMACMD_DMA_BPB_FILL;
1567e07dc26bSmrg
1568e07dc26bSmrg#define VBOXVDMA_CHILD_STATUS_F_CONNECTED    0x01
1569e07dc26bSmrg#define VBOXVDMA_CHILD_STATUS_F_DISCONNECTED 0x02
1570e07dc26bSmrg#define VBOXVDMA_CHILD_STATUS_F_ROTATED      0x04
1571e07dc26bSmrg
1572e07dc26bSmrgtypedef struct VBOXVDMA_CHILD_STATUS
1573e07dc26bSmrg{
1574e07dc26bSmrg    uint32_t iChild;
1575e07dc26bSmrg    uint8_t  fFlags;
1576e07dc26bSmrg    uint8_t  u8RotationAngle;
1577e07dc26bSmrg    uint16_t u16Reserved;
1578e07dc26bSmrg} VBOXVDMA_CHILD_STATUS, *PVBOXVDMA_CHILD_STATUS;
1579e07dc26bSmrg
1580e07dc26bSmrg/* apply the aInfos are applied to all targets, the iTarget is ignored */
1581e07dc26bSmrg#define VBOXVDMACMD_CHILD_STATUS_IRQ_F_APPLY_TO_ALL 0x00000001
1582e07dc26bSmrg
1583e07dc26bSmrgtypedef struct VBOXVDMACMD_CHILD_STATUS_IRQ
1584e07dc26bSmrg{
1585e07dc26bSmrg    uint32_t cInfos;
1586e07dc26bSmrg    uint32_t fFlags;
1587e07dc26bSmrg    VBOXVDMA_CHILD_STATUS aInfos[1];
1588e07dc26bSmrg} VBOXVDMACMD_CHILD_STATUS_IRQ, *PVBOXVDMACMD_CHILD_STATUS_IRQ;
1589e07dc26bSmrg
1590e07dc26bSmrg# pragma pack()
1591e07dc26bSmrg#endif /* #ifdef VBOX_WITH_VDMA */
1592e07dc26bSmrg
1593e07dc26bSmrg#pragma pack(1)
1594e07dc26bSmrgtypedef struct VBOXVDMACMD_CHROMIUM_BUFFER
1595e07dc26bSmrg{
1596e07dc26bSmrg    VBOXVIDEOOFFSET offBuffer;
1597e07dc26bSmrg    uint32_t cbBuffer;
1598e07dc26bSmrg    uint32_t u32GuestData;
1599e07dc26bSmrg    uint64_t u64GuestData;
1600e07dc26bSmrg} VBOXVDMACMD_CHROMIUM_BUFFER, *PVBOXVDMACMD_CHROMIUM_BUFFER;
1601e07dc26bSmrg
1602e07dc26bSmrgtypedef struct VBOXVDMACMD_CHROMIUM_CMD
1603e07dc26bSmrg{
1604e07dc26bSmrg    uint32_t cBuffers;
1605e07dc26bSmrg    uint32_t u32Reserved;
1606e07dc26bSmrg    VBOXVDMACMD_CHROMIUM_BUFFER aBuffers[1];
1607e07dc26bSmrg} VBOXVDMACMD_CHROMIUM_CMD, *PVBOXVDMACMD_CHROMIUM_CMD;
1608e07dc26bSmrg
1609e07dc26bSmrgtypedef enum
1610e07dc26bSmrg{
1611e07dc26bSmrg    VBOXVDMACMD_CHROMIUM_CTL_TYPE_UNKNOWN = 0,
1612e07dc26bSmrg    VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP,
1613e07dc26bSmrg    VBOXVDMACMD_CHROMIUM_CTL_TYPE_SAVESTATE_BEGIN,
1614e07dc26bSmrg    VBOXVDMACMD_CHROMIUM_CTL_TYPE_SAVESTATE_END,
1615e07dc26bSmrg    VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP_MAINCB,
1616e07dc26bSmrg    VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRCONNECT,
1617e07dc26bSmrg    VBOXVDMACMD_CHROMIUM_CTL_TYPE_SIZEHACK = 0x7fffffff
1618e07dc26bSmrg} VBOXVDMACMD_CHROMIUM_CTL_TYPE;
1619e07dc26bSmrg
1620e07dc26bSmrgtypedef struct VBOXVDMACMD_CHROMIUM_CTL
1621e07dc26bSmrg{
1622e07dc26bSmrg    VBOXVDMACMD_CHROMIUM_CTL_TYPE enmType;
1623e07dc26bSmrg    uint32_t cbCmd;
1624e07dc26bSmrg} VBOXVDMACMD_CHROMIUM_CTL, *PVBOXVDMACMD_CHROMIUM_CTL;
1625e07dc26bSmrg
1626e07dc26bSmrg
1627e07dc26bSmrgtypedef struct PDMIDISPLAYVBVACALLBACKS *HCRHGSMICMDCOMPLETION;
1628e07dc26bSmrgtypedef DECLCALLBACK(int) FNCRHGSMICMDCOMPLETION(HCRHGSMICMDCOMPLETION hCompletion, PVBOXVDMACMD_CHROMIUM_CMD pCmd, int rc);
1629e07dc26bSmrgtypedef FNCRHGSMICMDCOMPLETION *PFNCRHGSMICMDCOMPLETION;
1630e07dc26bSmrg
1631e07dc26bSmrg/* tells whether 3D backend has some 3D overlay data displayed */
1632e07dc26bSmrgtypedef DECLCALLBACK(bool) FNCROGLHASDATA(void);
1633e07dc26bSmrgtypedef FNCROGLHASDATA *PFNCROGLHASDATA;
1634e07dc26bSmrg
1635e07dc26bSmrg/* same as PFNCROGLHASDATA, but for specific screen */
1636e07dc26bSmrgtypedef DECLCALLBACK(bool) FNCROGLHASDATAFORSCREEN(uint32_t i32ScreenID);
1637e07dc26bSmrgtypedef FNCROGLHASDATAFORSCREEN *PFNCROGLHASDATAFORSCREEN;
1638e07dc26bSmrg
1639e07dc26bSmrg/* callbacks chrogl gives to main */
1640e07dc26bSmrgtypedef struct CR_MAIN_INTERFACE
1641e07dc26bSmrg{
1642e07dc26bSmrg    PFNCROGLHASDATA pfnHasData;
1643e07dc26bSmrg    PFNCROGLHASDATAFORSCREEN pfnHasDataForScreen;
1644e07dc26bSmrg} CR_MAIN_INTERFACE;
1645e07dc26bSmrg
1646e07dc26bSmrgtypedef struct VBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_MAINCB
1647e07dc26bSmrg{
1648e07dc26bSmrg    VBOXVDMACMD_CHROMIUM_CTL Hdr;
1649e07dc26bSmrg    /*in*/
1650e07dc26bSmrg    HCRHGSMICMDCOMPLETION hCompletion;
1651e07dc26bSmrg    PFNCRHGSMICMDCOMPLETION pfnCompletion;
1652e07dc26bSmrg    /*out*/
1653e07dc26bSmrg    CR_MAIN_INTERFACE MainInterface;
1654e07dc26bSmrg} VBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_MAINCB, *PVBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_MAINCB;
1655e07dc26bSmrg
1656e07dc26bSmrgtypedef struct VBOXCRCON_SERVER *HVBOXCRCON_SERVER;
1657e07dc26bSmrgtypedef struct PDMIDISPLAYVBVACALLBACKS* HVBOXCRCON_CLIENT;
1658e07dc26bSmrg
1659e07dc26bSmrgtypedef struct VBOXCRCON_3DRGN_CLIENT* HVBOXCRCON_3DRGN_CLIENT;
1660e07dc26bSmrgtypedef struct VBOXCRCON_3DRGN_ASYNCCLIENT* HVBOXCRCON_3DRGN_ASYNCCLIENT;
1661e07dc26bSmrg
1662e07dc26bSmrg/* server callbacks */
1663e07dc26bSmrg/* submit chromium cmd */
1664e07dc26bSmrgtypedef DECLCALLBACK(int) FNVBOXCRCON_SVR_CRCMD(HVBOXCRCON_SERVER hServer, PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
1665e07dc26bSmrgtypedef FNVBOXCRCON_SVR_CRCMD *PFNVBOXCRCON_SVR_CRCMD;
1666e07dc26bSmrg
1667e07dc26bSmrg/* submit chromium control cmd */
1668e07dc26bSmrgtypedef DECLCALLBACK(int) FNVBOXCRCON_SVR_CRCTL(HVBOXCRCON_SERVER hServer, PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCmd);
1669e07dc26bSmrgtypedef FNVBOXCRCON_SVR_CRCTL *PFNVBOXCRCON_SVR_CRCTL;
1670e07dc26bSmrg
1671e07dc26bSmrg/* request 3D data.
1672e07dc26bSmrg * The protocol is the following:
1673e07dc26bSmrg * 1. if there is no 3D data displayed on screen, returns VINF_EOF immediately w/o calling any PFNVBOXCRCON_3DRGN_XXX callbacks
1674e07dc26bSmrg * 2. otherwise calls PFNVBOXCRCON_3DRGN_ONSUBMIT, submits the "regions get" request to the CrOpenGL server to process it asynchronously and returns VINF_SUCCESS
1675e07dc26bSmrg * 2.a on "regions get" request processing calls PFNVBOXCRCON_3DRGN_BEGIN,
1676e07dc26bSmrg * 2.b then PFNVBOXCRCON_3DRGN_REPORT zero or more times for each 3D region,
1677e07dc26bSmrg * 2.c and then PFNVBOXCRCON_3DRGN_END
1678e07dc26bSmrg * 3. returns VERR_XXX code on failure
1679e07dc26bSmrg * */
1680e07dc26bSmrgtypedef DECLCALLBACK(int) FNVBOXCRCON_SVR_3DRGN_GET(HVBOXCRCON_SERVER hServer, HVBOXCRCON_3DRGN_CLIENT hRgnClient, uint32_t idScreen);
1681e07dc26bSmrgtypedef FNVBOXCRCON_SVR_3DRGN_GET *PFNVBOXCRCON_SVR_3DRGN_GET;
1682e07dc26bSmrg
1683e07dc26bSmrg/* 3D Regions Client callbacks */
1684e07dc26bSmrg/* called from the PFNVBOXCRCON_SVR_3DRGN_GET callback in case server has 3D data and is going to process the request asynchronously,
1685e07dc26bSmrg * see comments for PFNVBOXCRCON_SVR_3DRGN_GET above */
1686e07dc26bSmrgtypedef DECLCALLBACK(int) FNVBOXCRCON_3DRGN_ONSUBMIT(HVBOXCRCON_3DRGN_CLIENT hRgnClient, uint32_t idScreen, HVBOXCRCON_3DRGN_ASYNCCLIENT *phRgnAsyncClient);
1687e07dc26bSmrgtypedef FNVBOXCRCON_3DRGN_ONSUBMIT *PFNVBOXCRCON_3DRGN_ONSUBMIT;
1688e07dc26bSmrg
1689e07dc26bSmrg/* called from the "regions get" command processing thread, to indicate that the "regions get" is started.
1690e07dc26bSmrg * see comments for PFNVBOXCRCON_SVR_3DRGN_GET above */
1691e07dc26bSmrgtypedef DECLCALLBACK(int) FNVBOXCRCON_3DRGN_BEGIN(HVBOXCRCON_3DRGN_ASYNCCLIENT hRgnAsyncClient, uint32_t idScreen);
1692e07dc26bSmrgtypedef FNVBOXCRCON_3DRGN_BEGIN *PFNVBOXCRCON_3DRGN_BEGIN;
1693e07dc26bSmrg
1694e07dc26bSmrg/* called from the "regions get" command processing thread, to report a 3D region.
1695e07dc26bSmrg * see comments for PFNVBOXCRCON_SVR_3DRGN_GET above */
1696e07dc26bSmrgtypedef DECLCALLBACK(int) FNVBOXCRCON_3DRGN_REPORT(HVBOXCRCON_3DRGN_ASYNCCLIENT hRgnAsyncClient, uint32_t idScreen, void *pvData, uint32_t cbStride, const RTRECT *pRect);
1697e07dc26bSmrgtypedef FNVBOXCRCON_3DRGN_REPORT *PFNVBOXCRCON_3DRGN_REPORT;
1698e07dc26bSmrg
1699e07dc26bSmrg/* called from the "regions get" command processing thread, to indicate that the "regions get" is completed.
1700e07dc26bSmrg * see comments for PFNVBOXCRCON_SVR_3DRGN_GET above */
1701e07dc26bSmrgtypedef DECLCALLBACK(int) FNVBOXCRCON_3DRGN_END(HVBOXCRCON_3DRGN_ASYNCCLIENT hRgnAsyncClient, uint32_t idScreen);
1702e07dc26bSmrgtypedef FNVBOXCRCON_3DRGN_END *PFNVBOXCRCON_3DRGN_END;
1703e07dc26bSmrg
1704e07dc26bSmrg
1705e07dc26bSmrg/* client callbacks */
1706e07dc26bSmrg/* complete chromium cmd */
1707e07dc26bSmrgtypedef DECLCALLBACK(int) FNVBOXCRCON_CLT_CRCTL_COMPLETE(HVBOXCRCON_CLIENT hClient, PVBOXVDMACMD_CHROMIUM_CTL pCtl, int rc);
1708e07dc26bSmrgtypedef FNVBOXCRCON_CLT_CRCTL_COMPLETE *PFNVBOXCRCON_CLT_CRCTL_COMPLETE;
1709e07dc26bSmrg
1710e07dc26bSmrg/* complete chromium control cmd */
1711e07dc26bSmrgtypedef DECLCALLBACK(int) FNVBOXCRCON_CLT_CRCMD_COMPLETE(HVBOXCRCON_CLIENT hClient, PVBOXVDMACMD_CHROMIUM_CMD pCmd, int rc);
1712e07dc26bSmrgtypedef FNVBOXCRCON_CLT_CRCMD_COMPLETE *PFNVBOXCRCON_CLT_CRCMD_COMPLETE;
1713e07dc26bSmrg
1714e07dc26bSmrgtypedef struct VBOXCRCON_SERVER_CALLBACKS
1715e07dc26bSmrg{
1716e07dc26bSmrg    HVBOXCRCON_SERVER hServer;
1717e07dc26bSmrg    PFNVBOXCRCON_SVR_CRCMD pfnCrCmd;
1718e07dc26bSmrg    PFNVBOXCRCON_SVR_CRCTL pfnCrCtl;
1719e07dc26bSmrg    PFNVBOXCRCON_SVR_3DRGN_GET pfn3DRgnGet;
1720e07dc26bSmrg} VBOXCRCON_SERVER_CALLBACKS, *PVBOXCRCON_SERVER_CALLBACKS;
1721e07dc26bSmrg
1722e07dc26bSmrgtypedef struct VBOXCRCON_CLIENT_CALLBACKS
1723e07dc26bSmrg{
1724e07dc26bSmrg    HVBOXCRCON_CLIENT hClient;
1725e07dc26bSmrg    PFNVBOXCRCON_CLT_CRCMD_COMPLETE pfnCrCmdComplete;
1726e07dc26bSmrg    PFNVBOXCRCON_CLT_CRCTL_COMPLETE pfnCrCtlComplete;
1727e07dc26bSmrg    PFNVBOXCRCON_3DRGN_ONSUBMIT pfn3DRgnOnSubmit;
1728e07dc26bSmrg    PFNVBOXCRCON_3DRGN_BEGIN pfn3DRgnBegin;
1729e07dc26bSmrg    PFNVBOXCRCON_3DRGN_REPORT pfn3DRgnReport;
1730e07dc26bSmrg    PFNVBOXCRCON_3DRGN_END pfn3DRgnEnd;
1731e07dc26bSmrg} VBOXCRCON_CLIENT_CALLBACKS, *PVBOXCRCON_CLIENT_CALLBACKS;
1732e07dc26bSmrg
1733e07dc26bSmrg/* issued by Main to establish connection between Main and CrOpenGL service */
1734e07dc26bSmrgtypedef struct VBOXVDMACMD_CHROMIUM_CTL_CRCONNECT
1735e07dc26bSmrg{
1736e07dc26bSmrg    VBOXVDMACMD_CHROMIUM_CTL Hdr;
1737e07dc26bSmrg    /*input (filled by Client) :*/
1738e07dc26bSmrg    /*class VMMDev*/void *pVMMDev;
1739e07dc26bSmrg    VBOXCRCON_CLIENT_CALLBACKS ClientCallbacks;
1740e07dc26bSmrg    /*output (filled by Server) :*/
1741e07dc26bSmrg    VBOXCRCON_SERVER_CALLBACKS ServerCallbacks;
1742e07dc26bSmrg} VBOXVDMACMD_CHROMIUM_CTL_CRCONNECT, *PVBOXVDMACMD_CHROMIUM_CTL_CRCONNECT;
1743e07dc26bSmrg
1744e07dc26bSmrg/* ring command buffer dr */
1745e07dc26bSmrg#define VBOXCMDVBVA_STATE_SUBMITTED   1
1746e07dc26bSmrg#define VBOXCMDVBVA_STATE_CANCELLED   2
1747e07dc26bSmrg#define VBOXCMDVBVA_STATE_IN_PROGRESS 3
1748e07dc26bSmrg/* the "completed" state is signalled via the ring buffer values */
1749e07dc26bSmrg
1750e07dc26bSmrg/* CrHgsmi command */
1751e07dc26bSmrg#define VBOXCMDVBVA_OPTYPE_CRCMD                        1
1752e07dc26bSmrg/* blit command that does blitting of allocations identified by VRAM offset or host id
1753e07dc26bSmrg * for VRAM-offset ones the size and format are same as primary */
1754e07dc26bSmrg#define VBOXCMDVBVA_OPTYPE_BLT                          2
1755e07dc26bSmrg/* flip */
1756e07dc26bSmrg#define VBOXCMDVBVA_OPTYPE_FLIP                         3
1757e07dc26bSmrg/* ColorFill */
1758e07dc26bSmrg#define VBOXCMDVBVA_OPTYPE_CLRFILL                      4
1759e07dc26bSmrg/* allocation paging transfer request */
1760e07dc26bSmrg#define VBOXCMDVBVA_OPTYPE_PAGING_TRANSFER              5
1761e07dc26bSmrg/* allocation paging fill request */
1762e07dc26bSmrg#define VBOXCMDVBVA_OPTYPE_PAGING_FILL                  6
1763e07dc26bSmrg/* same as VBOXCMDVBVA_OPTYPE_NOP, but contains VBOXCMDVBVA_HDR data */
1764e07dc26bSmrg#define VBOXCMDVBVA_OPTYPE_NOPCMD                       7
1765e07dc26bSmrg/* actual command is stored in guest system memory */
1766e07dc26bSmrg#define VBOXCMDVBVA_OPTYPE_SYSMEMCMD                    8
1767e07dc26bSmrg/* complex command - i.e. can contain multiple commands
1768e07dc26bSmrg * i.e. the VBOXCMDVBVA_OPTYPE_COMPLEXCMD VBOXCMDVBVA_HDR is followed
1769e07dc26bSmrg * by one or more VBOXCMDVBVA_HDR commands.
1770e07dc26bSmrg * Each command's size is specified in it's VBOXCMDVBVA_HDR's u32FenceID field */
1771e07dc26bSmrg#define VBOXCMDVBVA_OPTYPE_COMPLEXCMD                   9
1772e07dc26bSmrg
1773e07dc26bSmrg/* nop - is a one-bit command. The buffer size to skip is determined by VBVA buffer size */
1774e07dc26bSmrg#define VBOXCMDVBVA_OPTYPE_NOP                          0x80
1775e07dc26bSmrg
1776e07dc26bSmrg/* u8Flags flags */
1777e07dc26bSmrg/* transfer from RAM to Allocation */
1778e07dc26bSmrg#define VBOXCMDVBVA_OPF_PAGING_TRANSFER_IN                  0x80
1779e07dc26bSmrg
1780e07dc26bSmrg#define VBOXCMDVBVA_OPF_BLT_TYPE_SAMEDIM_A8R8G8B8           0
1781e07dc26bSmrg#define VBOXCMDVBVA_OPF_BLT_TYPE_GENERIC_A8R8G8B8           1
1782e07dc26bSmrg#define VBOXCMDVBVA_OPF_BLT_TYPE_OFFPRIMSZFMT_OR_ID         2
1783e07dc26bSmrg
1784e07dc26bSmrg#define VBOXCMDVBVA_OPF_BLT_TYPE_MASK                       3
1785e07dc26bSmrg
1786e07dc26bSmrg
1787e07dc26bSmrg#define VBOXCMDVBVA_OPF_CLRFILL_TYPE_GENERIC_A8R8G8B8       0
1788e07dc26bSmrg
1789e07dc26bSmrg#define VBOXCMDVBVA_OPF_CLRFILL_TYPE_MASK                   1
1790e07dc26bSmrg
1791e07dc26bSmrg
1792e07dc26bSmrg/* blit direction is from first operand to second */
1793e07dc26bSmrg#define VBOXCMDVBVA_OPF_BLT_DIR_IN_2                        0x10
1794e07dc26bSmrg/* operand 1 contains host id */
1795e07dc26bSmrg#define VBOXCMDVBVA_OPF_OPERAND1_ISID                       0x20
1796e07dc26bSmrg/* operand 2 contains host id */
1797e07dc26bSmrg#define VBOXCMDVBVA_OPF_OPERAND2_ISID                       0x40
1798e07dc26bSmrg/* primary hint id is src */
1799e07dc26bSmrg#define VBOXCMDVBVA_OPF_PRIMARY_HINT_SRC                    0x80
1800e07dc26bSmrg
1801e07dc26bSmrg/* trying to make the header as small as possible,
1802e07dc26bSmrg * we'd have pretty few op codes actually, so 8bit is quite enough,
1803e07dc26bSmrg * we will be able to extend it in any way. */
1804e07dc26bSmrgtypedef struct VBOXCMDVBVA_HDR
1805e07dc26bSmrg{
1806e07dc26bSmrg    /* one VBOXCMDVBVA_OPTYPE_XXX, except NOP, see comments above */
1807e07dc26bSmrg    uint8_t u8OpCode;
1808e07dc26bSmrg    /* command-specific
1809e07dc26bSmrg     * VBOXCMDVBVA_OPTYPE_CRCMD                     - must be null
1810e07dc26bSmrg     * VBOXCMDVBVA_OPTYPE_BLT                       - OR-ed VBOXCMDVBVA_OPF_ALLOC_XXX flags
1811e07dc26bSmrg     * VBOXCMDVBVA_OPTYPE_PAGING_TRANSFER           - must be null
1812e07dc26bSmrg     * VBOXCMDVBVA_OPTYPE_PAGING_FILL               - must be null
1813e07dc26bSmrg     * VBOXCMDVBVA_OPTYPE_NOPCMD                    - must be null
1814e07dc26bSmrg     * VBOXCMDVBVA_OPTYPE_NOP                       - not applicable (as the entire VBOXCMDVBVA_HDR is not valid) */
1815e07dc26bSmrg    uint8_t u8Flags;
1816e07dc26bSmrg    /* one of VBOXCMDVBVA_STATE_XXX*/
1817e07dc26bSmrg    volatile uint8_t u8State;
1818e07dc26bSmrg    union
1819e07dc26bSmrg    {
1820e07dc26bSmrg        /* result, 0 on success, otherwise contains the failure code TBD */
1821e07dc26bSmrg        int8_t i8Result;
1822e07dc26bSmrg        uint8_t u8PrimaryID;
1823e07dc26bSmrg    } u;
1824e07dc26bSmrg    union
1825e07dc26bSmrg    {
1826e07dc26bSmrg        /* complex command (VBOXCMDVBVA_OPTYPE_COMPLEXCMD) element data */
1827e07dc26bSmrg        struct
1828e07dc26bSmrg        {
1829e07dc26bSmrg            /* command length */
1830e07dc26bSmrg            uint16_t u16CbCmdHost;
1831e07dc26bSmrg            /* guest-specific data, host expects it to be NULL */
1832e07dc26bSmrg            uint16_t u16CbCmdGuest;
1833e07dc26bSmrg        } complexCmdEl;
1834e07dc26bSmrg        /* DXGK DDI fence ID */
1835e07dc26bSmrg        uint32_t u32FenceID;
1836e07dc26bSmrg    } u2;
1837e07dc26bSmrg} VBOXCMDVBVA_HDR;
1838e07dc26bSmrg
1839e07dc26bSmrgtypedef uint32_t VBOXCMDVBVAOFFSET;
1840e07dc26bSmrgtypedef uint64_t VBOXCMDVBVAPHADDR;
1841e07dc26bSmrgtypedef uint32_t VBOXCMDVBVAPAGEIDX;
1842e07dc26bSmrg
1843e07dc26bSmrgtypedef struct VBOXCMDVBVA_CRCMD_BUFFER
1844e07dc26bSmrg{
1845e07dc26bSmrg    uint32_t cbBuffer;
1846e07dc26bSmrg    VBOXCMDVBVAOFFSET offBuffer;
1847e07dc26bSmrg} VBOXCMDVBVA_CRCMD_BUFFER;
1848e07dc26bSmrg
1849e07dc26bSmrgtypedef struct VBOXCMDVBVA_CRCMD_CMD
1850e07dc26bSmrg{
1851e07dc26bSmrg    uint32_t cBuffers;
1852e07dc26bSmrg    VBOXCMDVBVA_CRCMD_BUFFER aBuffers[1];
1853e07dc26bSmrg} VBOXCMDVBVA_CRCMD_CMD;
1854e07dc26bSmrg
1855e07dc26bSmrgtypedef struct VBOXCMDVBVA_CRCMD
1856e07dc26bSmrg{
1857e07dc26bSmrg    VBOXCMDVBVA_HDR Hdr;
1858e07dc26bSmrg    VBOXCMDVBVA_CRCMD_CMD Cmd;
1859e07dc26bSmrg} VBOXCMDVBVA_CRCMD;
1860e07dc26bSmrg
1861e07dc26bSmrgtypedef struct VBOXCMDVBVA_ALLOCINFO
1862e07dc26bSmrg{
1863e07dc26bSmrg    union
1864e07dc26bSmrg    {
1865e07dc26bSmrg        VBOXCMDVBVAOFFSET offVRAM;
1866e07dc26bSmrg        uint32_t id;
1867e07dc26bSmrg    } u;
1868e07dc26bSmrg} VBOXCMDVBVA_ALLOCINFO;
1869e07dc26bSmrg
1870e07dc26bSmrgtypedef struct VBOXCMDVBVA_ALLOCDESC
1871e07dc26bSmrg{
1872e07dc26bSmrg    VBOXCMDVBVA_ALLOCINFO Info;
1873e07dc26bSmrg    uint16_t u16Width;
1874e07dc26bSmrg    uint16_t u16Height;
1875e07dc26bSmrg} VBOXCMDVBVA_ALLOCDESC;
1876e07dc26bSmrg
1877e07dc26bSmrgtypedef struct VBOXCMDVBVA_RECT
1878e07dc26bSmrg{
1879e07dc26bSmrg   /** Coordinates of affected rectangle. */
1880e07dc26bSmrg   int16_t xLeft;
1881e07dc26bSmrg   int16_t yTop;
1882e07dc26bSmrg   int16_t xRight;
1883e07dc26bSmrg   int16_t yBottom;
1884e07dc26bSmrg} VBOXCMDVBVA_RECT;
1885e07dc26bSmrg
1886e07dc26bSmrgtypedef struct VBOXCMDVBVA_POINT
1887e07dc26bSmrg{
1888e07dc26bSmrg   int16_t x;
1889e07dc26bSmrg   int16_t y;
1890e07dc26bSmrg} VBOXCMDVBVA_POINT;
1891e07dc26bSmrg
1892e07dc26bSmrgtypedef struct VBOXCMDVBVA_BLT_HDR
1893e07dc26bSmrg{
1894e07dc26bSmrg    VBOXCMDVBVA_HDR Hdr;
1895e07dc26bSmrg    VBOXCMDVBVA_POINT Pos;
1896e07dc26bSmrg} VBOXCMDVBVA_BLT_HDR;
1897e07dc26bSmrg
1898e07dc26bSmrgtypedef struct VBOXCMDVBVA_BLT_PRIMARY
1899e07dc26bSmrg{
1900e07dc26bSmrg    VBOXCMDVBVA_BLT_HDR Hdr;
1901e07dc26bSmrg    VBOXCMDVBVA_ALLOCINFO alloc;
1902e07dc26bSmrg    /* the rects count is determined from the command size */
1903e07dc26bSmrg    VBOXCMDVBVA_RECT aRects[1];
1904e07dc26bSmrg} VBOXCMDVBVA_BLT_PRIMARY;
1905e07dc26bSmrg
1906e07dc26bSmrgtypedef struct VBOXCMDVBVA_BLT_PRIMARY_GENERIC_A8R8G8B8
1907e07dc26bSmrg{
1908e07dc26bSmrg    VBOXCMDVBVA_BLT_HDR Hdr;
1909e07dc26bSmrg    VBOXCMDVBVA_ALLOCDESC alloc;
1910e07dc26bSmrg    /* the rects count is determined from the command size */
1911e07dc26bSmrg    VBOXCMDVBVA_RECT aRects[1];
1912e07dc26bSmrg} VBOXCMDVBVA_BLT_PRIMARY_GENERIC_A8R8G8B8;
1913e07dc26bSmrg
1914e07dc26bSmrgtypedef struct VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID
1915e07dc26bSmrg{
1916e07dc26bSmrg    VBOXCMDVBVA_BLT_HDR Hdr;
1917e07dc26bSmrg    VBOXCMDVBVA_ALLOCINFO alloc;
1918e07dc26bSmrg    uint32_t id;
1919e07dc26bSmrg    /* the rects count is determined from the command size */
1920e07dc26bSmrg    VBOXCMDVBVA_RECT aRects[1];
1921e07dc26bSmrg} VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID;
1922e07dc26bSmrg
1923e07dc26bSmrgtypedef struct VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8
1924e07dc26bSmrg{
1925e07dc26bSmrg    VBOXCMDVBVA_BLT_HDR Hdr;
1926e07dc26bSmrg    VBOXCMDVBVA_ALLOCDESC alloc1;
1927e07dc26bSmrg    VBOXCMDVBVA_ALLOCINFO info2;
1928e07dc26bSmrg    /* the rects count is determined from the command size */
1929e07dc26bSmrg    VBOXCMDVBVA_RECT aRects[1];
1930e07dc26bSmrg} VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8;
1931e07dc26bSmrg
1932e07dc26bSmrgtypedef struct VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8
1933e07dc26bSmrg{
1934e07dc26bSmrg    VBOXCMDVBVA_BLT_HDR Hdr;
1935e07dc26bSmrg    VBOXCMDVBVA_ALLOCDESC alloc1;
1936e07dc26bSmrg    VBOXCMDVBVA_ALLOCDESC alloc2;
1937e07dc26bSmrg    /* the rects count is determined from the command size */
1938e07dc26bSmrg    VBOXCMDVBVA_RECT aRects[1];
1939e07dc26bSmrg} VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8;
1940e07dc26bSmrg
1941e07dc26bSmrg#define VBOXCMDVBVA_SIZEOF_BLTSTRUCT_MAX (sizeof (VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8))
1942e07dc26bSmrg
1943e07dc26bSmrgtypedef struct VBOXCMDVBVA_FLIP
1944e07dc26bSmrg{
1945e07dc26bSmrg    VBOXCMDVBVA_HDR Hdr;
1946e07dc26bSmrg    VBOXCMDVBVA_ALLOCINFO src;
1947e07dc26bSmrg    VBOXCMDVBVA_RECT aRects[1];
1948e07dc26bSmrg} VBOXCMDVBVA_FLIP;
1949e07dc26bSmrg
1950e07dc26bSmrg#define VBOXCMDVBVA_SIZEOF_FLIPSTRUCT_MIN (RT_OFFSETOF(VBOXCMDVBVA_FLIP, aRects))
1951e07dc26bSmrg
1952e07dc26bSmrgtypedef struct VBOXCMDVBVA_CLRFILL_HDR
1953e07dc26bSmrg{
1954e07dc26bSmrg    VBOXCMDVBVA_HDR Hdr;
1955e07dc26bSmrg    uint32_t u32Color;
1956e07dc26bSmrg} VBOXCMDVBVA_CLRFILL_HDR;
1957e07dc26bSmrg
1958e07dc26bSmrgtypedef struct VBOXCMDVBVA_CLRFILL_PRIMARY
1959e07dc26bSmrg{
1960e07dc26bSmrg    VBOXCMDVBVA_CLRFILL_HDR Hdr;
1961e07dc26bSmrg    VBOXCMDVBVA_RECT aRects[1];
1962e07dc26bSmrg} VBOXCMDVBVA_CLRFILL_PRIMARY;
1963e07dc26bSmrg
1964e07dc26bSmrgtypedef struct VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8
1965e07dc26bSmrg{
1966e07dc26bSmrg    VBOXCMDVBVA_CLRFILL_HDR Hdr;
1967e07dc26bSmrg    VBOXCMDVBVA_ALLOCDESC dst;
1968e07dc26bSmrg    VBOXCMDVBVA_RECT aRects[1];
1969e07dc26bSmrg} VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8;
1970e07dc26bSmrg
1971e07dc26bSmrg#define VBOXCMDVBVA_SIZEOF_CLRFILLSTRUCT_MAX (sizeof (VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8))
1972e07dc26bSmrg
1973e07dc26bSmrg#if 0
1974e07dc26bSmrg#define VBOXCMDVBVA_SYSMEMEL_CPAGES_MAX  0x1000
1975e07dc26bSmrg
1976e07dc26bSmrgtypedef struct VBOXCMDVBVA_SYSMEMEL
1977e07dc26bSmrg{
1978e07dc26bSmrg    uint32_t cPagesAfterFirst  : 12;
1979e07dc26bSmrg    uint32_t iPage1            : 20;
1980e07dc26bSmrg    uint32_t iPage2;
1981e07dc26bSmrg} VBOXCMDVBVA_SYSMEMEL;
1982e07dc26bSmrg#endif
1983e07dc26bSmrg
1984e07dc26bSmrgtypedef struct VBOXCMDVBVA_PAGING_TRANSFER_DATA
1985e07dc26bSmrg{
1986e07dc26bSmrg    /* for now can only contain offVRAM.
1987e07dc26bSmrg     * paging transfer can NOT be initiated for allocations having host 3D object (hostID) associated */
1988e07dc26bSmrg    VBOXCMDVBVA_ALLOCINFO Alloc;
1989e07dc26bSmrg    VBOXCMDVBVAPAGEIDX aPageNumbers[1];
1990e07dc26bSmrg} VBOXCMDVBVA_PAGING_TRANSFER_DATA;
1991e07dc26bSmrg
1992e07dc26bSmrgtypedef struct VBOXCMDVBVA_PAGING_TRANSFER
1993e07dc26bSmrg{
1994e07dc26bSmrg    VBOXCMDVBVA_HDR Hdr;
1995e07dc26bSmrg    VBOXCMDVBVA_PAGING_TRANSFER_DATA Data;
1996e07dc26bSmrg} VBOXCMDVBVA_PAGING_TRANSFER;
1997e07dc26bSmrg
1998e07dc26bSmrgtypedef struct VBOXCMDVBVA_PAGING_FILL
1999e07dc26bSmrg{
2000e07dc26bSmrg    VBOXCMDVBVA_HDR Hdr;
2001e07dc26bSmrg    uint32_t u32CbFill;
2002e07dc26bSmrg    uint32_t u32Pattern;
2003e07dc26bSmrg    /* paging transfer can NOT be initiated for allocations having host 3D object (hostID) associated */
2004e07dc26bSmrg    VBOXCMDVBVAOFFSET offVRAM;
2005e07dc26bSmrg} VBOXCMDVBVA_PAGING_FILL;
2006e07dc26bSmrg
2007e07dc26bSmrgtypedef struct VBOXCMDVBVA_SYSMEMCMD
2008e07dc26bSmrg{
2009e07dc26bSmrg    VBOXCMDVBVA_HDR Hdr;
2010e07dc26bSmrg    VBOXCMDVBVAPHADDR phCmd;
2011e07dc26bSmrg} VBOXCMDVBVA_SYSMEMCMD;
2012e07dc26bSmrg
2013e07dc26bSmrg#define VBOXCMDVBVACTL_TYPE_ENABLE     1
2014e07dc26bSmrg#define VBOXCMDVBVACTL_TYPE_3DCTL      2
2015e07dc26bSmrg#define VBOXCMDVBVACTL_TYPE_RESIZE     3
2016e07dc26bSmrg
2017e07dc26bSmrgtypedef struct VBOXCMDVBVA_CTL
2018e07dc26bSmrg{
2019e07dc26bSmrg    uint32_t u32Type;
2020e07dc26bSmrg    int32_t i32Result;
2021e07dc26bSmrg} VBOXCMDVBVA_CTL;
2022e07dc26bSmrg
2023e07dc26bSmrgtypedef struct VBOXCMDVBVA_CTL_ENABLE
2024e07dc26bSmrg{
2025e07dc26bSmrg    VBOXCMDVBVA_CTL Hdr;
2026e07dc26bSmrg    VBVAENABLE Enable;
2027e07dc26bSmrg} VBOXCMDVBVA_CTL_ENABLE;
2028e07dc26bSmrg
2029e07dc26bSmrg#define VBOXCMDVBVA_SCREENMAP_SIZE(_elType) ((VBOX_VIDEO_MAX_SCREENS + sizeof (_elType) - 1) / sizeof (_elType))
2030e07dc26bSmrg#define VBOXCMDVBVA_SCREENMAP_DECL(_elType, _name) _elType _name[VBOXCMDVBVA_SCREENMAP_SIZE(_elType)]
2031e07dc26bSmrg
2032e07dc26bSmrgtypedef struct VBOXCMDVBVA_RESIZE_ENTRY
2033e07dc26bSmrg{
2034e07dc26bSmrg    VBVAINFOSCREEN Screen;
2035e07dc26bSmrg    VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aTargetMap);
2036e07dc26bSmrg} VBOXCMDVBVA_RESIZE_ENTRY;
2037e07dc26bSmrg
2038e07dc26bSmrgtypedef struct VBOXCMDVBVA_RESIZE
2039e07dc26bSmrg{
2040e07dc26bSmrg    VBOXCMDVBVA_RESIZE_ENTRY aEntries[1];
2041e07dc26bSmrg} VBOXCMDVBVA_RESIZE;
2042e07dc26bSmrg
2043e07dc26bSmrgtypedef struct VBOXCMDVBVA_CTL_RESIZE
2044e07dc26bSmrg{
2045e07dc26bSmrg    VBOXCMDVBVA_CTL Hdr;
2046e07dc26bSmrg    VBOXCMDVBVA_RESIZE Resize;
2047e07dc26bSmrg} VBOXCMDVBVA_CTL_RESIZE;
2048e07dc26bSmrg
2049e07dc26bSmrg#define VBOXCMDVBVA3DCTL_TYPE_CONNECT     1
2050e07dc26bSmrg#define VBOXCMDVBVA3DCTL_TYPE_DISCONNECT  2
2051e07dc26bSmrg#define VBOXCMDVBVA3DCTL_TYPE_CMD         3
2052e07dc26bSmrg
2053e07dc26bSmrgtypedef struct VBOXCMDVBVA_3DCTL
2054e07dc26bSmrg{
2055e07dc26bSmrg    uint32_t u32Type;
2056e07dc26bSmrg    uint32_t u32CmdClientId;
2057e07dc26bSmrg} VBOXCMDVBVA_3DCTL;
2058e07dc26bSmrg
2059e07dc26bSmrgtypedef struct VBOXCMDVBVA_3DCTL_CONNECT
2060e07dc26bSmrg{
2061e07dc26bSmrg    VBOXCMDVBVA_3DCTL Hdr;
2062e07dc26bSmrg    uint32_t u32MajorVersion;
2063e07dc26bSmrg    uint32_t u32MinorVersion;
2064e07dc26bSmrg    uint64_t u64Pid;
2065e07dc26bSmrg} VBOXCMDVBVA_3DCTL_CONNECT;
2066e07dc26bSmrg
2067e07dc26bSmrgtypedef struct VBOXCMDVBVA_3DCTL_CMD
2068e07dc26bSmrg{
2069e07dc26bSmrg    VBOXCMDVBVA_3DCTL Hdr;
2070e07dc26bSmrg    VBOXCMDVBVA_HDR Cmd;
2071e07dc26bSmrg} VBOXCMDVBVA_3DCTL_CMD;
2072e07dc26bSmrg
2073e07dc26bSmrgtypedef struct VBOXCMDVBVA_CTL_3DCTL_CMD
2074e07dc26bSmrg{
2075e07dc26bSmrg    VBOXCMDVBVA_CTL Hdr;
2076e07dc26bSmrg    VBOXCMDVBVA_3DCTL_CMD Cmd;
2077e07dc26bSmrg} VBOXCMDVBVA_CTL_3DCTL_CMD;
2078e07dc26bSmrg
2079e07dc26bSmrgtypedef struct VBOXCMDVBVA_CTL_3DCTL_CONNECT
2080e07dc26bSmrg{
2081e07dc26bSmrg    VBOXCMDVBVA_CTL Hdr;
2082e07dc26bSmrg    VBOXCMDVBVA_3DCTL_CONNECT Connect;
2083e07dc26bSmrg} VBOXCMDVBVA_CTL_3DCTL_CONNECT;
2084e07dc26bSmrg
2085e07dc26bSmrgtypedef struct VBOXCMDVBVA_CTL_3DCTL
2086e07dc26bSmrg{
2087e07dc26bSmrg    VBOXCMDVBVA_CTL Hdr;
2088e07dc26bSmrg    VBOXCMDVBVA_3DCTL Ctl;
2089e07dc26bSmrg} VBOXCMDVBVA_CTL_3DCTL;
2090e07dc26bSmrg
2091e07dc26bSmrg#pragma pack()
2092e07dc26bSmrg
2093e07dc26bSmrg
2094e07dc26bSmrg#ifdef VBOXVDMA_WITH_VBVA
2095e07dc26bSmrg# pragma pack(1)
2096e07dc26bSmrg
2097e07dc26bSmrgtypedef struct VBOXVDMAVBVACMD
2098e07dc26bSmrg{
2099e07dc26bSmrg    HGSMIOFFSET offCmd;
2100e07dc26bSmrg} VBOXVDMAVBVACMD;
2101e07dc26bSmrg
2102e07dc26bSmrg#pragma pack()
2103e07dc26bSmrg#endif
2104e07dc26bSmrg
2105e07dc26bSmrg#endif
2106e07dc26bSmrg
2107