18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: MIT */ 28c2ecf20Sopenharmony_ci/* Copyright (C) 2006-2016 Oracle Corporation */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifndef __VBOXVIDEO_H__ 58c2ecf20Sopenharmony_ci#define __VBOXVIDEO_H__ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#define VBOX_VIDEO_MAX_SCREENS 64 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci/* 108c2ecf20Sopenharmony_ci * The last 4096 bytes of the guest VRAM contains the generic info for all 118c2ecf20Sopenharmony_ci * DualView chunks: sizes and offsets of chunks. This is filled by miniport. 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * Last 4096 bytes of each chunk contain chunk specific data: framebuffer info, 148c2ecf20Sopenharmony_ci * etc. This is used exclusively by the corresponding instance of a display 158c2ecf20Sopenharmony_ci * driver. 168c2ecf20Sopenharmony_ci * 178c2ecf20Sopenharmony_ci * The VRAM layout: 188c2ecf20Sopenharmony_ci * Last 4096 bytes - Adapter information area. 198c2ecf20Sopenharmony_ci * 4096 bytes aligned miniport heap (value specified in the config rouded up). 208c2ecf20Sopenharmony_ci * Slack - what left after dividing the VRAM. 218c2ecf20Sopenharmony_ci * 4096 bytes aligned framebuffers: 228c2ecf20Sopenharmony_ci * last 4096 bytes of each framebuffer is the display information area. 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * The Virtual Graphics Adapter information in the guest VRAM is stored by the 258c2ecf20Sopenharmony_ci * guest video driver using structures prepended by VBOXVIDEOINFOHDR. 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * When the guest driver writes dword 0 to the VBE_DISPI_INDEX_VBOX_VIDEO 288c2ecf20Sopenharmony_ci * the host starts to process the info. The first element at the start of 298c2ecf20Sopenharmony_ci * the 4096 bytes region should be normally be a LINK that points to 308c2ecf20Sopenharmony_ci * actual information chain. That way the guest driver can have some 318c2ecf20Sopenharmony_ci * fixed layout of the information memory block and just rewrite 328c2ecf20Sopenharmony_ci * the link to point to relevant memory chain. 338c2ecf20Sopenharmony_ci * 348c2ecf20Sopenharmony_ci * The processing stops at the END element. 358c2ecf20Sopenharmony_ci * 368c2ecf20Sopenharmony_ci * The host can access the memory only when the port IO is processed. 378c2ecf20Sopenharmony_ci * All data that will be needed later must be copied from these 4096 bytes. 388c2ecf20Sopenharmony_ci * But other VRAM can be used by host until the mode is disabled. 398c2ecf20Sopenharmony_ci * 408c2ecf20Sopenharmony_ci * The guest driver writes dword 0xffffffff to the VBE_DISPI_INDEX_VBOX_VIDEO 418c2ecf20Sopenharmony_ci * to disable the mode. 428c2ecf20Sopenharmony_ci * 438c2ecf20Sopenharmony_ci * VBE_DISPI_INDEX_VBOX_VIDEO is used to read the configuration information 448c2ecf20Sopenharmony_ci * from the host and issue commands to the host. 458c2ecf20Sopenharmony_ci * 468c2ecf20Sopenharmony_ci * The guest writes the VBE_DISPI_INDEX_VBOX_VIDEO index register, the the 478c2ecf20Sopenharmony_ci * following operations with the VBE data register can be performed: 488c2ecf20Sopenharmony_ci * 498c2ecf20Sopenharmony_ci * Operation Result 508c2ecf20Sopenharmony_ci * write 16 bit value NOP 518c2ecf20Sopenharmony_ci * read 16 bit value count of monitors 528c2ecf20Sopenharmony_ci * write 32 bit value set the vbox cmd value and the cmd processed by the host 538c2ecf20Sopenharmony_ci * read 32 bit value result of the last vbox command is returned 548c2ecf20Sopenharmony_ci */ 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_cistruct vbva_cmd_hdr { 578c2ecf20Sopenharmony_ci s16 x; 588c2ecf20Sopenharmony_ci s16 y; 598c2ecf20Sopenharmony_ci u16 w; 608c2ecf20Sopenharmony_ci u16 h; 618c2ecf20Sopenharmony_ci} __packed; 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci/* 648c2ecf20Sopenharmony_ci * The VBVA ring buffer is suitable for transferring large (< 2GB) amount of 658c2ecf20Sopenharmony_ci * data. For example big bitmaps which do not fit to the buffer. 668c2ecf20Sopenharmony_ci * 678c2ecf20Sopenharmony_ci * Guest starts writing to the buffer by initializing a record entry in the 688c2ecf20Sopenharmony_ci * records queue. VBVA_F_RECORD_PARTIAL indicates that the record is being 698c2ecf20Sopenharmony_ci * written. As data is written to the ring buffer, the guest increases 708c2ecf20Sopenharmony_ci * free_offset. 718c2ecf20Sopenharmony_ci * 728c2ecf20Sopenharmony_ci * The host reads the records on flushes and processes all completed records. 738c2ecf20Sopenharmony_ci * When host encounters situation when only a partial record presents and 748c2ecf20Sopenharmony_ci * len_and_flags & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE - 758c2ecf20Sopenharmony_ci * VBVA_RING_BUFFER_THRESHOLD, the host fetched all record data and updates 768c2ecf20Sopenharmony_ci * data_offset. After that on each flush the host continues fetching the data 778c2ecf20Sopenharmony_ci * until the record is completed. 788c2ecf20Sopenharmony_ci */ 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci#define VBVA_RING_BUFFER_SIZE (4194304 - 1024) 818c2ecf20Sopenharmony_ci#define VBVA_RING_BUFFER_THRESHOLD (4096) 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci#define VBVA_MAX_RECORDS (64) 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#define VBVA_F_MODE_ENABLED 0x00000001u 868c2ecf20Sopenharmony_ci#define VBVA_F_MODE_VRDP 0x00000002u 878c2ecf20Sopenharmony_ci#define VBVA_F_MODE_VRDP_RESET 0x00000004u 888c2ecf20Sopenharmony_ci#define VBVA_F_MODE_VRDP_ORDER_MASK 0x00000008u 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#define VBVA_F_STATE_PROCESSING 0x00010000u 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci#define VBVA_F_RECORD_PARTIAL 0x80000000u 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_cistruct vbva_record { 958c2ecf20Sopenharmony_ci u32 len_and_flags; 968c2ecf20Sopenharmony_ci} __packed; 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci/* 998c2ecf20Sopenharmony_ci * The minimum HGSMI heap size is PAGE_SIZE (4096 bytes) and is a restriction of 1008c2ecf20Sopenharmony_ci * the runtime heapsimple API. Use minimum 2 pages here, because the info area 1018c2ecf20Sopenharmony_ci * also may contain other data (for example hgsmi_host_flags structure). 1028c2ecf20Sopenharmony_ci */ 1038c2ecf20Sopenharmony_ci#define VBVA_ADAPTER_INFORMATION_SIZE 65536 1048c2ecf20Sopenharmony_ci#define VBVA_MIN_BUFFER_SIZE 65536 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci/* The value for port IO to let the adapter to interpret the adapter memory. */ 1078c2ecf20Sopenharmony_ci#define VBOX_VIDEO_DISABLE_ADAPTER_MEMORY 0xFFFFFFFF 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci/* The value for port IO to let the adapter to interpret the adapter memory. */ 1108c2ecf20Sopenharmony_ci#define VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY 0x00000000 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci/* 1138c2ecf20Sopenharmony_ci * The value for port IO to let the adapter to interpret the display memory. 1148c2ecf20Sopenharmony_ci * The display number is encoded in low 16 bits. 1158c2ecf20Sopenharmony_ci */ 1168c2ecf20Sopenharmony_ci#define VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE 0x00010000 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_cistruct vbva_host_flags { 1198c2ecf20Sopenharmony_ci u32 host_events; 1208c2ecf20Sopenharmony_ci u32 supported_orders; 1218c2ecf20Sopenharmony_ci} __packed; 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_cistruct vbva_buffer { 1248c2ecf20Sopenharmony_ci struct vbva_host_flags host_flags; 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci /* The offset where the data start in the buffer. */ 1278c2ecf20Sopenharmony_ci u32 data_offset; 1288c2ecf20Sopenharmony_ci /* The offset where next data must be placed in the buffer. */ 1298c2ecf20Sopenharmony_ci u32 free_offset; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci /* The queue of record descriptions. */ 1328c2ecf20Sopenharmony_ci struct vbva_record records[VBVA_MAX_RECORDS]; 1338c2ecf20Sopenharmony_ci u32 record_first_index; 1348c2ecf20Sopenharmony_ci u32 record_free_index; 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci /* Space to leave free when large partial records are transferred. */ 1378c2ecf20Sopenharmony_ci u32 partial_write_tresh; 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci u32 data_len; 1408c2ecf20Sopenharmony_ci /* variable size for the rest of the vbva_buffer area in VRAM. */ 1418c2ecf20Sopenharmony_ci u8 data[]; 1428c2ecf20Sopenharmony_ci} __packed; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci#define VBVA_MAX_RECORD_SIZE (128 * 1024 * 1024) 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci/* guest->host commands */ 1478c2ecf20Sopenharmony_ci#define VBVA_QUERY_CONF32 1 1488c2ecf20Sopenharmony_ci#define VBVA_SET_CONF32 2 1498c2ecf20Sopenharmony_ci#define VBVA_INFO_VIEW 3 1508c2ecf20Sopenharmony_ci#define VBVA_INFO_HEAP 4 1518c2ecf20Sopenharmony_ci#define VBVA_FLUSH 5 1528c2ecf20Sopenharmony_ci#define VBVA_INFO_SCREEN 6 1538c2ecf20Sopenharmony_ci#define VBVA_ENABLE 7 1548c2ecf20Sopenharmony_ci#define VBVA_MOUSE_POINTER_SHAPE 8 1558c2ecf20Sopenharmony_ci/* informs host about HGSMI caps. see vbva_caps below */ 1568c2ecf20Sopenharmony_ci#define VBVA_INFO_CAPS 12 1578c2ecf20Sopenharmony_ci/* configures scanline, see VBVASCANLINECFG below */ 1588c2ecf20Sopenharmony_ci#define VBVA_SCANLINE_CFG 13 1598c2ecf20Sopenharmony_ci/* requests scanline info, see VBVASCANLINEINFO below */ 1608c2ecf20Sopenharmony_ci#define VBVA_SCANLINE_INFO 14 1618c2ecf20Sopenharmony_ci/* inform host about VBVA Command submission */ 1628c2ecf20Sopenharmony_ci#define VBVA_CMDVBVA_SUBMIT 16 1638c2ecf20Sopenharmony_ci/* inform host about VBVA Command submission */ 1648c2ecf20Sopenharmony_ci#define VBVA_CMDVBVA_FLUSH 17 1658c2ecf20Sopenharmony_ci/* G->H DMA command */ 1668c2ecf20Sopenharmony_ci#define VBVA_CMDVBVA_CTL 18 1678c2ecf20Sopenharmony_ci/* Query most recent mode hints sent */ 1688c2ecf20Sopenharmony_ci#define VBVA_QUERY_MODE_HINTS 19 1698c2ecf20Sopenharmony_ci/* 1708c2ecf20Sopenharmony_ci * Report the guest virtual desktop position and size for mapping host and 1718c2ecf20Sopenharmony_ci * guest pointer positions. 1728c2ecf20Sopenharmony_ci */ 1738c2ecf20Sopenharmony_ci#define VBVA_REPORT_INPUT_MAPPING 20 1748c2ecf20Sopenharmony_ci/* Report the guest cursor position and query the host position. */ 1758c2ecf20Sopenharmony_ci#define VBVA_CURSOR_POSITION 21 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci/* host->guest commands */ 1788c2ecf20Sopenharmony_ci#define VBVAHG_EVENT 1 1798c2ecf20Sopenharmony_ci#define VBVAHG_DISPLAY_CUSTOM 2 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci/* vbva_conf32::index */ 1828c2ecf20Sopenharmony_ci#define VBOX_VBVA_CONF32_MONITOR_COUNT 0 1838c2ecf20Sopenharmony_ci#define VBOX_VBVA_CONF32_HOST_HEAP_SIZE 1 1848c2ecf20Sopenharmony_ci/* 1858c2ecf20Sopenharmony_ci * Returns VINF_SUCCESS if the host can report mode hints via VBVA. 1868c2ecf20Sopenharmony_ci * Set value to VERR_NOT_SUPPORTED before calling. 1878c2ecf20Sopenharmony_ci */ 1888c2ecf20Sopenharmony_ci#define VBOX_VBVA_CONF32_MODE_HINT_REPORTING 2 1898c2ecf20Sopenharmony_ci/* 1908c2ecf20Sopenharmony_ci * Returns VINF_SUCCESS if the host can report guest cursor enabled status via 1918c2ecf20Sopenharmony_ci * VBVA. Set value to VERR_NOT_SUPPORTED before calling. 1928c2ecf20Sopenharmony_ci */ 1938c2ecf20Sopenharmony_ci#define VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING 3 1948c2ecf20Sopenharmony_ci/* 1958c2ecf20Sopenharmony_ci * Returns the currently available host cursor capabilities. Available if 1968c2ecf20Sopenharmony_ci * VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING returns success. 1978c2ecf20Sopenharmony_ci */ 1988c2ecf20Sopenharmony_ci#define VBOX_VBVA_CONF32_CURSOR_CAPABILITIES 4 1998c2ecf20Sopenharmony_ci/* Returns the supported flags in vbva_infoscreen.flags. */ 2008c2ecf20Sopenharmony_ci#define VBOX_VBVA_CONF32_SCREEN_FLAGS 5 2018c2ecf20Sopenharmony_ci/* Returns the max size of VBVA record. */ 2028c2ecf20Sopenharmony_ci#define VBOX_VBVA_CONF32_MAX_RECORD_SIZE 6 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_cistruct vbva_conf32 { 2058c2ecf20Sopenharmony_ci u32 index; 2068c2ecf20Sopenharmony_ci u32 value; 2078c2ecf20Sopenharmony_ci} __packed; 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci/* Reserved for historical reasons. */ 2108c2ecf20Sopenharmony_ci#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED0 BIT(0) 2118c2ecf20Sopenharmony_ci/* 2128c2ecf20Sopenharmony_ci * Guest cursor capability: can the host show a hardware cursor at the host 2138c2ecf20Sopenharmony_ci * pointer location? 2148c2ecf20Sopenharmony_ci */ 2158c2ecf20Sopenharmony_ci#define VBOX_VBVA_CURSOR_CAPABILITY_HARDWARE BIT(1) 2168c2ecf20Sopenharmony_ci/* Reserved for historical reasons. */ 2178c2ecf20Sopenharmony_ci#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED2 BIT(2) 2188c2ecf20Sopenharmony_ci/* Reserved for historical reasons. Must always be unset. */ 2198c2ecf20Sopenharmony_ci#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED3 BIT(3) 2208c2ecf20Sopenharmony_ci/* Reserved for historical reasons. */ 2218c2ecf20Sopenharmony_ci#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED4 BIT(4) 2228c2ecf20Sopenharmony_ci/* Reserved for historical reasons. */ 2238c2ecf20Sopenharmony_ci#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED5 BIT(5) 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_cistruct vbva_infoview { 2268c2ecf20Sopenharmony_ci /* Index of the screen, assigned by the guest. */ 2278c2ecf20Sopenharmony_ci u32 view_index; 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci /* The screen offset in VRAM, the framebuffer starts here. */ 2308c2ecf20Sopenharmony_ci u32 view_offset; 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci /* The size of the VRAM memory that can be used for the view. */ 2338c2ecf20Sopenharmony_ci u32 view_size; 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci /* The recommended maximum size of the VRAM memory for the screen. */ 2368c2ecf20Sopenharmony_ci u32 max_screen_size; 2378c2ecf20Sopenharmony_ci} __packed; 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_cistruct vbva_flush { 2408c2ecf20Sopenharmony_ci u32 reserved; 2418c2ecf20Sopenharmony_ci} __packed; 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci/* vbva_infoscreen.flags */ 2448c2ecf20Sopenharmony_ci#define VBVA_SCREEN_F_NONE 0x0000 2458c2ecf20Sopenharmony_ci#define VBVA_SCREEN_F_ACTIVE 0x0001 2468c2ecf20Sopenharmony_ci/* 2478c2ecf20Sopenharmony_ci * The virtual monitor has been disabled by the guest and should be removed 2488c2ecf20Sopenharmony_ci * by the host and ignored for purposes of pointer position calculation. 2498c2ecf20Sopenharmony_ci */ 2508c2ecf20Sopenharmony_ci#define VBVA_SCREEN_F_DISABLED 0x0002 2518c2ecf20Sopenharmony_ci/* 2528c2ecf20Sopenharmony_ci * The virtual monitor has been blanked by the guest and should be blacked 2538c2ecf20Sopenharmony_ci * out by the host using width, height, etc values from the vbva_infoscreen 2548c2ecf20Sopenharmony_ci * request. 2558c2ecf20Sopenharmony_ci */ 2568c2ecf20Sopenharmony_ci#define VBVA_SCREEN_F_BLANK 0x0004 2578c2ecf20Sopenharmony_ci/* 2588c2ecf20Sopenharmony_ci * The virtual monitor has been blanked by the guest and should be blacked 2598c2ecf20Sopenharmony_ci * out by the host using the previous mode values for width. height, etc. 2608c2ecf20Sopenharmony_ci */ 2618c2ecf20Sopenharmony_ci#define VBVA_SCREEN_F_BLANK2 0x0008 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_cistruct vbva_infoscreen { 2648c2ecf20Sopenharmony_ci /* Which view contains the screen. */ 2658c2ecf20Sopenharmony_ci u32 view_index; 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci /* Physical X origin relative to the primary screen. */ 2688c2ecf20Sopenharmony_ci s32 origin_x; 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ci /* Physical Y origin relative to the primary screen. */ 2718c2ecf20Sopenharmony_ci s32 origin_y; 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_ci /* Offset of visible framebuffer relative to the framebuffer start. */ 2748c2ecf20Sopenharmony_ci u32 start_offset; 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci /* The scan line size in bytes. */ 2778c2ecf20Sopenharmony_ci u32 line_size; 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci /* Width of the screen. */ 2808c2ecf20Sopenharmony_ci u32 width; 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ci /* Height of the screen. */ 2838c2ecf20Sopenharmony_ci u32 height; 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci /* Color depth. */ 2868c2ecf20Sopenharmony_ci u16 bits_per_pixel; 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci /* VBVA_SCREEN_F_* */ 2898c2ecf20Sopenharmony_ci u16 flags; 2908c2ecf20Sopenharmony_ci} __packed; 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci/* vbva_enable.flags */ 2938c2ecf20Sopenharmony_ci#define VBVA_F_NONE 0x00000000 2948c2ecf20Sopenharmony_ci#define VBVA_F_ENABLE 0x00000001 2958c2ecf20Sopenharmony_ci#define VBVA_F_DISABLE 0x00000002 2968c2ecf20Sopenharmony_ci/* extended VBVA to be used with WDDM */ 2978c2ecf20Sopenharmony_ci#define VBVA_F_EXTENDED 0x00000004 2988c2ecf20Sopenharmony_ci/* vbva offset is absolute VRAM offset */ 2998c2ecf20Sopenharmony_ci#define VBVA_F_ABSOFFSET 0x00000008 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_cistruct vbva_enable { 3028c2ecf20Sopenharmony_ci u32 flags; 3038c2ecf20Sopenharmony_ci u32 offset; 3048c2ecf20Sopenharmony_ci s32 result; 3058c2ecf20Sopenharmony_ci} __packed; 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_cistruct vbva_enable_ex { 3088c2ecf20Sopenharmony_ci struct vbva_enable base; 3098c2ecf20Sopenharmony_ci u32 screen_id; 3108c2ecf20Sopenharmony_ci} __packed; 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_cistruct vbva_mouse_pointer_shape { 3138c2ecf20Sopenharmony_ci /* The host result. */ 3148c2ecf20Sopenharmony_ci s32 result; 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_ci /* VBOX_MOUSE_POINTER_* bit flags. */ 3178c2ecf20Sopenharmony_ci u32 flags; 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_ci /* X coordinate of the hot spot. */ 3208c2ecf20Sopenharmony_ci u32 hot_X; 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ci /* Y coordinate of the hot spot. */ 3238c2ecf20Sopenharmony_ci u32 hot_y; 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci /* Width of the pointer in pixels. */ 3268c2ecf20Sopenharmony_ci u32 width; 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ci /* Height of the pointer in scanlines. */ 3298c2ecf20Sopenharmony_ci u32 height; 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_ci /* Pointer data. 3328c2ecf20Sopenharmony_ci * 3338c2ecf20Sopenharmony_ci * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) 3348c2ecf20Sopenharmony_ci * mask. 3358c2ecf20Sopenharmony_ci * 3368c2ecf20Sopenharmony_ci * For pointers without alpha channel the XOR mask pixels are 32 bit 3378c2ecf20Sopenharmony_ci * values: (lsb)BGR0(msb). For pointers with alpha channel the XOR mask 3388c2ecf20Sopenharmony_ci * consists of (lsb)BGRA(msb) 32 bit values. 3398c2ecf20Sopenharmony_ci * 3408c2ecf20Sopenharmony_ci * Guest driver must create the AND mask for pointers with alpha chan., 3418c2ecf20Sopenharmony_ci * so if host does not support alpha, the pointer could be displayed as 3428c2ecf20Sopenharmony_ci * a normal color pointer. The AND mask can be constructed from alpha 3438c2ecf20Sopenharmony_ci * values. For example alpha value >= 0xf0 means bit 0 in the AND mask. 3448c2ecf20Sopenharmony_ci * 3458c2ecf20Sopenharmony_ci * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND 3468c2ecf20Sopenharmony_ci * mask, therefore, is and_len = (width + 7) / 8 * height. The padding 3478c2ecf20Sopenharmony_ci * bits at the end of any scanline are undefined. 3488c2ecf20Sopenharmony_ci * 3498c2ecf20Sopenharmony_ci * The XOR mask follows the AND mask on the next 4 bytes aligned offset: 3508c2ecf20Sopenharmony_ci * u8 *xor = and + (and_len + 3) & ~3 3518c2ecf20Sopenharmony_ci * Bytes in the gap between the AND and the XOR mask are undefined. 3528c2ecf20Sopenharmony_ci * XOR mask scanlines have no gap between them and size of XOR mask is: 3538c2ecf20Sopenharmony_ci * xor_len = width * 4 * height. 3548c2ecf20Sopenharmony_ci * 3558c2ecf20Sopenharmony_ci * Preallocate 4 bytes for accessing actual data as p->data. 3568c2ecf20Sopenharmony_ci */ 3578c2ecf20Sopenharmony_ci u8 data[4]; 3588c2ecf20Sopenharmony_ci} __packed; 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_ci/* pointer is visible */ 3618c2ecf20Sopenharmony_ci#define VBOX_MOUSE_POINTER_VISIBLE 0x0001 3628c2ecf20Sopenharmony_ci/* pointer has alpha channel */ 3638c2ecf20Sopenharmony_ci#define VBOX_MOUSE_POINTER_ALPHA 0x0002 3648c2ecf20Sopenharmony_ci/* pointerData contains new pointer shape */ 3658c2ecf20Sopenharmony_ci#define VBOX_MOUSE_POINTER_SHAPE 0x0004 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci/* 3688c2ecf20Sopenharmony_ci * The guest driver can handle asynch guest cmd completion by reading the 3698c2ecf20Sopenharmony_ci * command offset from io port. 3708c2ecf20Sopenharmony_ci */ 3718c2ecf20Sopenharmony_ci#define VBVACAPS_COMPLETEGCMD_BY_IOREAD 0x00000001 3728c2ecf20Sopenharmony_ci/* the guest driver can handle video adapter IRQs */ 3738c2ecf20Sopenharmony_ci#define VBVACAPS_IRQ 0x00000002 3748c2ecf20Sopenharmony_ci/* The guest can read video mode hints sent via VBVA. */ 3758c2ecf20Sopenharmony_ci#define VBVACAPS_VIDEO_MODE_HINTS 0x00000004 3768c2ecf20Sopenharmony_ci/* The guest can switch to a software cursor on demand. */ 3778c2ecf20Sopenharmony_ci#define VBVACAPS_DISABLE_CURSOR_INTEGRATION 0x00000008 3788c2ecf20Sopenharmony_ci/* The guest does not depend on host handling the VBE registers. */ 3798c2ecf20Sopenharmony_ci#define VBVACAPS_USE_VBVA_ONLY 0x00000010 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_cistruct vbva_caps { 3828c2ecf20Sopenharmony_ci s32 rc; 3838c2ecf20Sopenharmony_ci u32 caps; 3848c2ecf20Sopenharmony_ci} __packed; 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_ci/* Query the most recent mode hints received from the host. */ 3878c2ecf20Sopenharmony_cistruct vbva_query_mode_hints { 3888c2ecf20Sopenharmony_ci /* The maximum number of screens to return hints for. */ 3898c2ecf20Sopenharmony_ci u16 hints_queried_count; 3908c2ecf20Sopenharmony_ci /* The size of the mode hint structures directly following this one. */ 3918c2ecf20Sopenharmony_ci u16 hint_structure_guest_size; 3928c2ecf20Sopenharmony_ci /* Return code for the operation. Initialise to VERR_NOT_SUPPORTED. */ 3938c2ecf20Sopenharmony_ci s32 rc; 3948c2ecf20Sopenharmony_ci} __packed; 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_ci/* 3978c2ecf20Sopenharmony_ci * Structure in which a mode hint is returned. The guest allocates an array 3988c2ecf20Sopenharmony_ci * of these immediately after the vbva_query_mode_hints structure. 3998c2ecf20Sopenharmony_ci * To accommodate future extensions, the vbva_query_mode_hints structure 4008c2ecf20Sopenharmony_ci * specifies the size of the vbva_modehint structures allocated by the guest, 4018c2ecf20Sopenharmony_ci * and the host only fills out structure elements which fit into that size. The 4028c2ecf20Sopenharmony_ci * host should fill any unused members (e.g. dx, dy) or structure space on the 4038c2ecf20Sopenharmony_ci * end with ~0. The whole structure can legally be set to ~0 to skip a screen. 4048c2ecf20Sopenharmony_ci */ 4058c2ecf20Sopenharmony_cistruct vbva_modehint { 4068c2ecf20Sopenharmony_ci u32 magic; 4078c2ecf20Sopenharmony_ci u32 cx; 4088c2ecf20Sopenharmony_ci u32 cy; 4098c2ecf20Sopenharmony_ci u32 bpp; /* Which has never been used... */ 4108c2ecf20Sopenharmony_ci u32 display; 4118c2ecf20Sopenharmony_ci u32 dx; /* X offset into the virtual frame-buffer. */ 4128c2ecf20Sopenharmony_ci u32 dy; /* Y offset into the virtual frame-buffer. */ 4138c2ecf20Sopenharmony_ci u32 enabled; /* Not flags. Add new members for new flags. */ 4148c2ecf20Sopenharmony_ci} __packed; 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_ci#define VBVAMODEHINT_MAGIC 0x0801add9u 4178c2ecf20Sopenharmony_ci 4188c2ecf20Sopenharmony_ci/* 4198c2ecf20Sopenharmony_ci * Report the rectangle relative to which absolute pointer events should be 4208c2ecf20Sopenharmony_ci * expressed. This information remains valid until the next VBVA resize event 4218c2ecf20Sopenharmony_ci * for any screen, at which time it is reset to the bounding rectangle of all 4228c2ecf20Sopenharmony_ci * virtual screens and must be re-set. 4238c2ecf20Sopenharmony_ci */ 4248c2ecf20Sopenharmony_cistruct vbva_report_input_mapping { 4258c2ecf20Sopenharmony_ci s32 x; /* Upper left X co-ordinate relative to the first screen. */ 4268c2ecf20Sopenharmony_ci s32 y; /* Upper left Y co-ordinate relative to the first screen. */ 4278c2ecf20Sopenharmony_ci u32 cx; /* Rectangle width. */ 4288c2ecf20Sopenharmony_ci u32 cy; /* Rectangle height. */ 4298c2ecf20Sopenharmony_ci} __packed; 4308c2ecf20Sopenharmony_ci 4318c2ecf20Sopenharmony_ci/* 4328c2ecf20Sopenharmony_ci * Report the guest cursor position and query the host one. The host may wish 4338c2ecf20Sopenharmony_ci * to use the guest information to re-position its own cursor (though this is 4348c2ecf20Sopenharmony_ci * currently unlikely). 4358c2ecf20Sopenharmony_ci */ 4368c2ecf20Sopenharmony_cistruct vbva_cursor_position { 4378c2ecf20Sopenharmony_ci u32 report_position; /* Are we reporting a position? */ 4388c2ecf20Sopenharmony_ci u32 x; /* Guest cursor X position */ 4398c2ecf20Sopenharmony_ci u32 y; /* Guest cursor Y position */ 4408c2ecf20Sopenharmony_ci} __packed; 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_ci#endif 443