1131abc56SHans de Goede /* SPDX-License-Identifier: MIT */ 2131abc56SHans de Goede /* Copyright (C) 2006-2016 Oracle Corporation */ 3131abc56SHans de Goede 4131abc56SHans de Goede #ifndef __VBOXVIDEO_H__ 5131abc56SHans de Goede #define __VBOXVIDEO_H__ 6131abc56SHans de Goede 7131abc56SHans de Goede #define VBOX_VIDEO_MAX_SCREENS 64 8131abc56SHans de Goede 9131abc56SHans de Goede /* 10131abc56SHans de Goede * The last 4096 bytes of the guest VRAM contains the generic info for all 11131abc56SHans de Goede * DualView chunks: sizes and offsets of chunks. This is filled by miniport. 12131abc56SHans de Goede * 13131abc56SHans de Goede * Last 4096 bytes of each chunk contain chunk specific data: framebuffer info, 14131abc56SHans de Goede * etc. This is used exclusively by the corresponding instance of a display 15131abc56SHans de Goede * driver. 16131abc56SHans de Goede * 17131abc56SHans de Goede * The VRAM layout: 18131abc56SHans de Goede * Last 4096 bytes - Adapter information area. 19131abc56SHans de Goede * 4096 bytes aligned miniport heap (value specified in the config rouded up). 20131abc56SHans de Goede * Slack - what left after dividing the VRAM. 21131abc56SHans de Goede * 4096 bytes aligned framebuffers: 22131abc56SHans de Goede * last 4096 bytes of each framebuffer is the display information area. 23131abc56SHans de Goede * 24131abc56SHans de Goede * The Virtual Graphics Adapter information in the guest VRAM is stored by the 25131abc56SHans de Goede * guest video driver using structures prepended by VBOXVIDEOINFOHDR. 26131abc56SHans de Goede * 27131abc56SHans de Goede * When the guest driver writes dword 0 to the VBE_DISPI_INDEX_VBOX_VIDEO 28131abc56SHans de Goede * the host starts to process the info. The first element at the start of 29131abc56SHans de Goede * the 4096 bytes region should be normally be a LINK that points to 30131abc56SHans de Goede * actual information chain. That way the guest driver can have some 31131abc56SHans de Goede * fixed layout of the information memory block and just rewrite 32131abc56SHans de Goede * the link to point to relevant memory chain. 33131abc56SHans de Goede * 34131abc56SHans de Goede * The processing stops at the END element. 35131abc56SHans de Goede * 36131abc56SHans de Goede * The host can access the memory only when the port IO is processed. 37131abc56SHans de Goede * All data that will be needed later must be copied from these 4096 bytes. 38131abc56SHans de Goede * But other VRAM can be used by host until the mode is disabled. 39131abc56SHans de Goede * 40131abc56SHans de Goede * The guest driver writes dword 0xffffffff to the VBE_DISPI_INDEX_VBOX_VIDEO 41131abc56SHans de Goede * to disable the mode. 42131abc56SHans de Goede * 43131abc56SHans de Goede * VBE_DISPI_INDEX_VBOX_VIDEO is used to read the configuration information 44131abc56SHans de Goede * from the host and issue commands to the host. 45131abc56SHans de Goede * 46*2830ca9eSJilin Yuan * The guest writes the VBE_DISPI_INDEX_VBOX_VIDEO index register, the 47131abc56SHans de Goede * following operations with the VBE data register can be performed: 48131abc56SHans de Goede * 49131abc56SHans de Goede * Operation Result 50131abc56SHans de Goede * write 16 bit value NOP 51131abc56SHans de Goede * read 16 bit value count of monitors 52131abc56SHans de Goede * write 32 bit value set the vbox cmd value and the cmd processed by the host 53131abc56SHans de Goede * read 32 bit value result of the last vbox command is returned 54131abc56SHans de Goede */ 55131abc56SHans de Goede 56131abc56SHans de Goede struct vbva_cmd_hdr { 57131abc56SHans de Goede s16 x; 58131abc56SHans de Goede s16 y; 59131abc56SHans de Goede u16 w; 60131abc56SHans de Goede u16 h; 61131abc56SHans de Goede } __packed; 62131abc56SHans de Goede 63131abc56SHans de Goede /* 64131abc56SHans de Goede * The VBVA ring buffer is suitable for transferring large (< 2GB) amount of 65131abc56SHans de Goede * data. For example big bitmaps which do not fit to the buffer. 66131abc56SHans de Goede * 67131abc56SHans de Goede * Guest starts writing to the buffer by initializing a record entry in the 68131abc56SHans de Goede * records queue. VBVA_F_RECORD_PARTIAL indicates that the record is being 69131abc56SHans de Goede * written. As data is written to the ring buffer, the guest increases 70131abc56SHans de Goede * free_offset. 71131abc56SHans de Goede * 72131abc56SHans de Goede * The host reads the records on flushes and processes all completed records. 73131abc56SHans de Goede * When host encounters situation when only a partial record presents and 74131abc56SHans de Goede * len_and_flags & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE - 75131abc56SHans de Goede * VBVA_RING_BUFFER_THRESHOLD, the host fetched all record data and updates 76131abc56SHans de Goede * data_offset. After that on each flush the host continues fetching the data 77131abc56SHans de Goede * until the record is completed. 78131abc56SHans de Goede */ 79131abc56SHans de Goede 80131abc56SHans de Goede #define VBVA_RING_BUFFER_SIZE (4194304 - 1024) 81131abc56SHans de Goede #define VBVA_RING_BUFFER_THRESHOLD (4096) 82131abc56SHans de Goede 83131abc56SHans de Goede #define VBVA_MAX_RECORDS (64) 84131abc56SHans de Goede 85131abc56SHans de Goede #define VBVA_F_MODE_ENABLED 0x00000001u 86131abc56SHans de Goede #define VBVA_F_MODE_VRDP 0x00000002u 87131abc56SHans de Goede #define VBVA_F_MODE_VRDP_RESET 0x00000004u 88131abc56SHans de Goede #define VBVA_F_MODE_VRDP_ORDER_MASK 0x00000008u 89131abc56SHans de Goede 90131abc56SHans de Goede #define VBVA_F_STATE_PROCESSING 0x00010000u 91131abc56SHans de Goede 92131abc56SHans de Goede #define VBVA_F_RECORD_PARTIAL 0x80000000u 93131abc56SHans de Goede 94131abc56SHans de Goede struct vbva_record { 95131abc56SHans de Goede u32 len_and_flags; 96131abc56SHans de Goede } __packed; 97131abc56SHans de Goede 98131abc56SHans de Goede /* 99131abc56SHans de Goede * The minimum HGSMI heap size is PAGE_SIZE (4096 bytes) and is a restriction of 100131abc56SHans de Goede * the runtime heapsimple API. Use minimum 2 pages here, because the info area 101131abc56SHans de Goede * also may contain other data (for example hgsmi_host_flags structure). 102131abc56SHans de Goede */ 103131abc56SHans de Goede #define VBVA_ADAPTER_INFORMATION_SIZE 65536 104131abc56SHans de Goede #define VBVA_MIN_BUFFER_SIZE 65536 105131abc56SHans de Goede 106131abc56SHans de Goede /* The value for port IO to let the adapter to interpret the adapter memory. */ 107131abc56SHans de Goede #define VBOX_VIDEO_DISABLE_ADAPTER_MEMORY 0xFFFFFFFF 108131abc56SHans de Goede 109131abc56SHans de Goede /* The value for port IO to let the adapter to interpret the adapter memory. */ 110131abc56SHans de Goede #define VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY 0x00000000 111131abc56SHans de Goede 112131abc56SHans de Goede /* 113131abc56SHans de Goede * The value for port IO to let the adapter to interpret the display memory. 114131abc56SHans de Goede * The display number is encoded in low 16 bits. 115131abc56SHans de Goede */ 116131abc56SHans de Goede #define VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE 0x00010000 117131abc56SHans de Goede 118131abc56SHans de Goede struct vbva_host_flags { 119131abc56SHans de Goede u32 host_events; 120131abc56SHans de Goede u32 supported_orders; 121131abc56SHans de Goede } __packed; 122131abc56SHans de Goede 123131abc56SHans de Goede struct vbva_buffer { 124131abc56SHans de Goede struct vbva_host_flags host_flags; 125131abc56SHans de Goede 126131abc56SHans de Goede /* The offset where the data start in the buffer. */ 127131abc56SHans de Goede u32 data_offset; 128131abc56SHans de Goede /* The offset where next data must be placed in the buffer. */ 129131abc56SHans de Goede u32 free_offset; 130131abc56SHans de Goede 131131abc56SHans de Goede /* The queue of record descriptions. */ 132131abc56SHans de Goede struct vbva_record records[VBVA_MAX_RECORDS]; 133131abc56SHans de Goede u32 record_first_index; 134131abc56SHans de Goede u32 record_free_index; 135131abc56SHans de Goede 136131abc56SHans de Goede /* Space to leave free when large partial records are transferred. */ 137131abc56SHans de Goede u32 partial_write_tresh; 138131abc56SHans de Goede 139131abc56SHans de Goede u32 data_len; 140131abc56SHans de Goede /* variable size for the rest of the vbva_buffer area in VRAM. */ 141afdd5979SGustavo A. R. Silva u8 data[]; 142131abc56SHans de Goede } __packed; 143131abc56SHans de Goede 144131abc56SHans de Goede #define VBVA_MAX_RECORD_SIZE (128 * 1024 * 1024) 145131abc56SHans de Goede 146131abc56SHans de Goede /* guest->host commands */ 147131abc56SHans de Goede #define VBVA_QUERY_CONF32 1 148131abc56SHans de Goede #define VBVA_SET_CONF32 2 149131abc56SHans de Goede #define VBVA_INFO_VIEW 3 150131abc56SHans de Goede #define VBVA_INFO_HEAP 4 151131abc56SHans de Goede #define VBVA_FLUSH 5 152131abc56SHans de Goede #define VBVA_INFO_SCREEN 6 153131abc56SHans de Goede #define VBVA_ENABLE 7 154131abc56SHans de Goede #define VBVA_MOUSE_POINTER_SHAPE 8 155131abc56SHans de Goede /* informs host about HGSMI caps. see vbva_caps below */ 156131abc56SHans de Goede #define VBVA_INFO_CAPS 12 157131abc56SHans de Goede /* configures scanline, see VBVASCANLINECFG below */ 158131abc56SHans de Goede #define VBVA_SCANLINE_CFG 13 159131abc56SHans de Goede /* requests scanline info, see VBVASCANLINEINFO below */ 160131abc56SHans de Goede #define VBVA_SCANLINE_INFO 14 161131abc56SHans de Goede /* inform host about VBVA Command submission */ 162131abc56SHans de Goede #define VBVA_CMDVBVA_SUBMIT 16 163131abc56SHans de Goede /* inform host about VBVA Command submission */ 164131abc56SHans de Goede #define VBVA_CMDVBVA_FLUSH 17 165131abc56SHans de Goede /* G->H DMA command */ 166131abc56SHans de Goede #define VBVA_CMDVBVA_CTL 18 167131abc56SHans de Goede /* Query most recent mode hints sent */ 168131abc56SHans de Goede #define VBVA_QUERY_MODE_HINTS 19 169131abc56SHans de Goede /* 170131abc56SHans de Goede * Report the guest virtual desktop position and size for mapping host and 171131abc56SHans de Goede * guest pointer positions. 172131abc56SHans de Goede */ 173131abc56SHans de Goede #define VBVA_REPORT_INPUT_MAPPING 20 174131abc56SHans de Goede /* Report the guest cursor position and query the host position. */ 175131abc56SHans de Goede #define VBVA_CURSOR_POSITION 21 176131abc56SHans de Goede 177131abc56SHans de Goede /* host->guest commands */ 178131abc56SHans de Goede #define VBVAHG_EVENT 1 179131abc56SHans de Goede #define VBVAHG_DISPLAY_CUSTOM 2 180131abc56SHans de Goede 181131abc56SHans de Goede /* vbva_conf32::index */ 182131abc56SHans de Goede #define VBOX_VBVA_CONF32_MONITOR_COUNT 0 183131abc56SHans de Goede #define VBOX_VBVA_CONF32_HOST_HEAP_SIZE 1 184131abc56SHans de Goede /* 185131abc56SHans de Goede * Returns VINF_SUCCESS if the host can report mode hints via VBVA. 186131abc56SHans de Goede * Set value to VERR_NOT_SUPPORTED before calling. 187131abc56SHans de Goede */ 188131abc56SHans de Goede #define VBOX_VBVA_CONF32_MODE_HINT_REPORTING 2 189131abc56SHans de Goede /* 190131abc56SHans de Goede * Returns VINF_SUCCESS if the host can report guest cursor enabled status via 191131abc56SHans de Goede * VBVA. Set value to VERR_NOT_SUPPORTED before calling. 192131abc56SHans de Goede */ 193131abc56SHans de Goede #define VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING 3 194131abc56SHans de Goede /* 195131abc56SHans de Goede * Returns the currently available host cursor capabilities. Available if 196131abc56SHans de Goede * VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING returns success. 197131abc56SHans de Goede */ 198131abc56SHans de Goede #define VBOX_VBVA_CONF32_CURSOR_CAPABILITIES 4 199131abc56SHans de Goede /* Returns the supported flags in vbva_infoscreen.flags. */ 200131abc56SHans de Goede #define VBOX_VBVA_CONF32_SCREEN_FLAGS 5 201131abc56SHans de Goede /* Returns the max size of VBVA record. */ 202131abc56SHans de Goede #define VBOX_VBVA_CONF32_MAX_RECORD_SIZE 6 203131abc56SHans de Goede 204131abc56SHans de Goede struct vbva_conf32 { 205131abc56SHans de Goede u32 index; 206131abc56SHans de Goede u32 value; 207131abc56SHans de Goede } __packed; 208131abc56SHans de Goede 209131abc56SHans de Goede /* Reserved for historical reasons. */ 210131abc56SHans de Goede #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED0 BIT(0) 211131abc56SHans de Goede /* 212131abc56SHans de Goede * Guest cursor capability: can the host show a hardware cursor at the host 213131abc56SHans de Goede * pointer location? 214131abc56SHans de Goede */ 215131abc56SHans de Goede #define VBOX_VBVA_CURSOR_CAPABILITY_HARDWARE BIT(1) 216131abc56SHans de Goede /* Reserved for historical reasons. */ 217131abc56SHans de Goede #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED2 BIT(2) 218131abc56SHans de Goede /* Reserved for historical reasons. Must always be unset. */ 219131abc56SHans de Goede #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED3 BIT(3) 220131abc56SHans de Goede /* Reserved for historical reasons. */ 221131abc56SHans de Goede #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED4 BIT(4) 222131abc56SHans de Goede /* Reserved for historical reasons. */ 223131abc56SHans de Goede #define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED5 BIT(5) 224131abc56SHans de Goede 225131abc56SHans de Goede struct vbva_infoview { 226131abc56SHans de Goede /* Index of the screen, assigned by the guest. */ 227131abc56SHans de Goede u32 view_index; 228131abc56SHans de Goede 229131abc56SHans de Goede /* The screen offset in VRAM, the framebuffer starts here. */ 230131abc56SHans de Goede u32 view_offset; 231131abc56SHans de Goede 232131abc56SHans de Goede /* The size of the VRAM memory that can be used for the view. */ 233131abc56SHans de Goede u32 view_size; 234131abc56SHans de Goede 235131abc56SHans de Goede /* The recommended maximum size of the VRAM memory for the screen. */ 236131abc56SHans de Goede u32 max_screen_size; 237131abc56SHans de Goede } __packed; 238131abc56SHans de Goede 239131abc56SHans de Goede struct vbva_flush { 240131abc56SHans de Goede u32 reserved; 241131abc56SHans de Goede } __packed; 242131abc56SHans de Goede 243131abc56SHans de Goede /* vbva_infoscreen.flags */ 244131abc56SHans de Goede #define VBVA_SCREEN_F_NONE 0x0000 245131abc56SHans de Goede #define VBVA_SCREEN_F_ACTIVE 0x0001 246131abc56SHans de Goede /* 247131abc56SHans de Goede * The virtual monitor has been disabled by the guest and should be removed 248131abc56SHans de Goede * by the host and ignored for purposes of pointer position calculation. 249131abc56SHans de Goede */ 250131abc56SHans de Goede #define VBVA_SCREEN_F_DISABLED 0x0002 251131abc56SHans de Goede /* 252131abc56SHans de Goede * The virtual monitor has been blanked by the guest and should be blacked 253131abc56SHans de Goede * out by the host using width, height, etc values from the vbva_infoscreen 254131abc56SHans de Goede * request. 255131abc56SHans de Goede */ 256131abc56SHans de Goede #define VBVA_SCREEN_F_BLANK 0x0004 257131abc56SHans de Goede /* 258131abc56SHans de Goede * The virtual monitor has been blanked by the guest and should be blacked 259131abc56SHans de Goede * out by the host using the previous mode values for width. height, etc. 260131abc56SHans de Goede */ 261131abc56SHans de Goede #define VBVA_SCREEN_F_BLANK2 0x0008 262131abc56SHans de Goede 263131abc56SHans de Goede struct vbva_infoscreen { 264131abc56SHans de Goede /* Which view contains the screen. */ 265131abc56SHans de Goede u32 view_index; 266131abc56SHans de Goede 267131abc56SHans de Goede /* Physical X origin relative to the primary screen. */ 268131abc56SHans de Goede s32 origin_x; 269131abc56SHans de Goede 270131abc56SHans de Goede /* Physical Y origin relative to the primary screen. */ 271131abc56SHans de Goede s32 origin_y; 272131abc56SHans de Goede 273131abc56SHans de Goede /* Offset of visible framebuffer relative to the framebuffer start. */ 274131abc56SHans de Goede u32 start_offset; 275131abc56SHans de Goede 276131abc56SHans de Goede /* The scan line size in bytes. */ 277131abc56SHans de Goede u32 line_size; 278131abc56SHans de Goede 279131abc56SHans de Goede /* Width of the screen. */ 280131abc56SHans de Goede u32 width; 281131abc56SHans de Goede 282131abc56SHans de Goede /* Height of the screen. */ 283131abc56SHans de Goede u32 height; 284131abc56SHans de Goede 285131abc56SHans de Goede /* Color depth. */ 286131abc56SHans de Goede u16 bits_per_pixel; 287131abc56SHans de Goede 288131abc56SHans de Goede /* VBVA_SCREEN_F_* */ 289131abc56SHans de Goede u16 flags; 290131abc56SHans de Goede } __packed; 291131abc56SHans de Goede 292131abc56SHans de Goede /* vbva_enable.flags */ 293131abc56SHans de Goede #define VBVA_F_NONE 0x00000000 294131abc56SHans de Goede #define VBVA_F_ENABLE 0x00000001 295131abc56SHans de Goede #define VBVA_F_DISABLE 0x00000002 296131abc56SHans de Goede /* extended VBVA to be used with WDDM */ 297131abc56SHans de Goede #define VBVA_F_EXTENDED 0x00000004 298131abc56SHans de Goede /* vbva offset is absolute VRAM offset */ 299131abc56SHans de Goede #define VBVA_F_ABSOFFSET 0x00000008 300131abc56SHans de Goede 301131abc56SHans de Goede struct vbva_enable { 302131abc56SHans de Goede u32 flags; 303131abc56SHans de Goede u32 offset; 304131abc56SHans de Goede s32 result; 305131abc56SHans de Goede } __packed; 306131abc56SHans de Goede 307131abc56SHans de Goede struct vbva_enable_ex { 308131abc56SHans de Goede struct vbva_enable base; 309131abc56SHans de Goede u32 screen_id; 310131abc56SHans de Goede } __packed; 311131abc56SHans de Goede 312131abc56SHans de Goede struct vbva_mouse_pointer_shape { 313131abc56SHans de Goede /* The host result. */ 314131abc56SHans de Goede s32 result; 315131abc56SHans de Goede 316131abc56SHans de Goede /* VBOX_MOUSE_POINTER_* bit flags. */ 317131abc56SHans de Goede u32 flags; 318131abc56SHans de Goede 319131abc56SHans de Goede /* X coordinate of the hot spot. */ 320131abc56SHans de Goede u32 hot_X; 321131abc56SHans de Goede 322131abc56SHans de Goede /* Y coordinate of the hot spot. */ 323131abc56SHans de Goede u32 hot_y; 324131abc56SHans de Goede 325131abc56SHans de Goede /* Width of the pointer in pixels. */ 326131abc56SHans de Goede u32 width; 327131abc56SHans de Goede 328131abc56SHans de Goede /* Height of the pointer in scanlines. */ 329131abc56SHans de Goede u32 height; 330131abc56SHans de Goede 331131abc56SHans de Goede /* Pointer data. 332131abc56SHans de Goede * 333131abc56SHans de Goede * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) 334131abc56SHans de Goede * mask. 335131abc56SHans de Goede * 336131abc56SHans de Goede * For pointers without alpha channel the XOR mask pixels are 32 bit 337131abc56SHans de Goede * values: (lsb)BGR0(msb). For pointers with alpha channel the XOR mask 338131abc56SHans de Goede * consists of (lsb)BGRA(msb) 32 bit values. 339131abc56SHans de Goede * 340131abc56SHans de Goede * Guest driver must create the AND mask for pointers with alpha chan., 341131abc56SHans de Goede * so if host does not support alpha, the pointer could be displayed as 342131abc56SHans de Goede * a normal color pointer. The AND mask can be constructed from alpha 343131abc56SHans de Goede * values. For example alpha value >= 0xf0 means bit 0 in the AND mask. 344131abc56SHans de Goede * 345131abc56SHans de Goede * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND 346131abc56SHans de Goede * mask, therefore, is and_len = (width + 7) / 8 * height. The padding 347131abc56SHans de Goede * bits at the end of any scanline are undefined. 348131abc56SHans de Goede * 349131abc56SHans de Goede * The XOR mask follows the AND mask on the next 4 bytes aligned offset: 350131abc56SHans de Goede * u8 *xor = and + (and_len + 3) & ~3 351131abc56SHans de Goede * Bytes in the gap between the AND and the XOR mask are undefined. 352131abc56SHans de Goede * XOR mask scanlines have no gap between them and size of XOR mask is: 353131abc56SHans de Goede * xor_len = width * 4 * height. 354131abc56SHans de Goede * 355131abc56SHans de Goede * Preallocate 4 bytes for accessing actual data as p->data. 356131abc56SHans de Goede */ 357131abc56SHans de Goede u8 data[4]; 358131abc56SHans de Goede } __packed; 359131abc56SHans de Goede 360131abc56SHans de Goede /* pointer is visible */ 361131abc56SHans de Goede #define VBOX_MOUSE_POINTER_VISIBLE 0x0001 362131abc56SHans de Goede /* pointer has alpha channel */ 363131abc56SHans de Goede #define VBOX_MOUSE_POINTER_ALPHA 0x0002 364131abc56SHans de Goede /* pointerData contains new pointer shape */ 365131abc56SHans de Goede #define VBOX_MOUSE_POINTER_SHAPE 0x0004 366131abc56SHans de Goede 367131abc56SHans de Goede /* 368131abc56SHans de Goede * The guest driver can handle asynch guest cmd completion by reading the 369131abc56SHans de Goede * command offset from io port. 370131abc56SHans de Goede */ 371131abc56SHans de Goede #define VBVACAPS_COMPLETEGCMD_BY_IOREAD 0x00000001 372131abc56SHans de Goede /* the guest driver can handle video adapter IRQs */ 373131abc56SHans de Goede #define VBVACAPS_IRQ 0x00000002 374131abc56SHans de Goede /* The guest can read video mode hints sent via VBVA. */ 375131abc56SHans de Goede #define VBVACAPS_VIDEO_MODE_HINTS 0x00000004 376131abc56SHans de Goede /* The guest can switch to a software cursor on demand. */ 377131abc56SHans de Goede #define VBVACAPS_DISABLE_CURSOR_INTEGRATION 0x00000008 378131abc56SHans de Goede /* The guest does not depend on host handling the VBE registers. */ 379131abc56SHans de Goede #define VBVACAPS_USE_VBVA_ONLY 0x00000010 380131abc56SHans de Goede 381131abc56SHans de Goede struct vbva_caps { 382131abc56SHans de Goede s32 rc; 383131abc56SHans de Goede u32 caps; 384131abc56SHans de Goede } __packed; 385131abc56SHans de Goede 386131abc56SHans de Goede /* Query the most recent mode hints received from the host. */ 387131abc56SHans de Goede struct vbva_query_mode_hints { 388131abc56SHans de Goede /* The maximum number of screens to return hints for. */ 389131abc56SHans de Goede u16 hints_queried_count; 390131abc56SHans de Goede /* The size of the mode hint structures directly following this one. */ 391131abc56SHans de Goede u16 hint_structure_guest_size; 392131abc56SHans de Goede /* Return code for the operation. Initialise to VERR_NOT_SUPPORTED. */ 393131abc56SHans de Goede s32 rc; 394131abc56SHans de Goede } __packed; 395131abc56SHans de Goede 396131abc56SHans de Goede /* 397131abc56SHans de Goede * Structure in which a mode hint is returned. The guest allocates an array 398131abc56SHans de Goede * of these immediately after the vbva_query_mode_hints structure. 399131abc56SHans de Goede * To accommodate future extensions, the vbva_query_mode_hints structure 400131abc56SHans de Goede * specifies the size of the vbva_modehint structures allocated by the guest, 401131abc56SHans de Goede * and the host only fills out structure elements which fit into that size. The 402131abc56SHans de Goede * host should fill any unused members (e.g. dx, dy) or structure space on the 403131abc56SHans de Goede * end with ~0. The whole structure can legally be set to ~0 to skip a screen. 404131abc56SHans de Goede */ 405131abc56SHans de Goede struct vbva_modehint { 406131abc56SHans de Goede u32 magic; 407131abc56SHans de Goede u32 cx; 408131abc56SHans de Goede u32 cy; 409131abc56SHans de Goede u32 bpp; /* Which has never been used... */ 410131abc56SHans de Goede u32 display; 411131abc56SHans de Goede u32 dx; /* X offset into the virtual frame-buffer. */ 412131abc56SHans de Goede u32 dy; /* Y offset into the virtual frame-buffer. */ 413131abc56SHans de Goede u32 enabled; /* Not flags. Add new members for new flags. */ 414131abc56SHans de Goede } __packed; 415131abc56SHans de Goede 416131abc56SHans de Goede #define VBVAMODEHINT_MAGIC 0x0801add9u 417131abc56SHans de Goede 418131abc56SHans de Goede /* 419131abc56SHans de Goede * Report the rectangle relative to which absolute pointer events should be 420131abc56SHans de Goede * expressed. This information remains valid until the next VBVA resize event 421131abc56SHans de Goede * for any screen, at which time it is reset to the bounding rectangle of all 422131abc56SHans de Goede * virtual screens and must be re-set. 423131abc56SHans de Goede */ 424131abc56SHans de Goede struct vbva_report_input_mapping { 425131abc56SHans de Goede s32 x; /* Upper left X co-ordinate relative to the first screen. */ 426131abc56SHans de Goede s32 y; /* Upper left Y co-ordinate relative to the first screen. */ 427131abc56SHans de Goede u32 cx; /* Rectangle width. */ 428131abc56SHans de Goede u32 cy; /* Rectangle height. */ 429131abc56SHans de Goede } __packed; 430131abc56SHans de Goede 431131abc56SHans de Goede /* 432131abc56SHans de Goede * Report the guest cursor position and query the host one. The host may wish 433131abc56SHans de Goede * to use the guest information to re-position its own cursor (though this is 434131abc56SHans de Goede * currently unlikely). 435131abc56SHans de Goede */ 436131abc56SHans de Goede struct vbva_cursor_position { 437131abc56SHans de Goede u32 report_position; /* Are we reporting a position? */ 438131abc56SHans de Goede u32 x; /* Guest cursor X position */ 439131abc56SHans de Goede u32 y; /* Guest cursor Y position */ 440131abc56SHans de Goede } __packed; 441131abc56SHans de Goede 442131abc56SHans de Goede #endif 443