Home | History | Annotate | Line # | Download | only in qxl
      1  1.2  riastrad /*	$NetBSD: qxl_dev.h,v 1.3 2021/12/18 23:45:42 riastradh Exp $	*/
      2  1.2  riastrad 
      3  1.1  riastrad /*
      4  1.1  riastrad    Copyright (C) 2009 Red Hat, Inc.
      5  1.1  riastrad 
      6  1.1  riastrad    Redistribution and use in source and binary forms, with or without
      7  1.1  riastrad    modification, are permitted provided that the following conditions are
      8  1.1  riastrad    met:
      9  1.1  riastrad 
     10  1.1  riastrad        * Redistributions of source code must retain the above copyright
     11  1.1  riastrad 	 notice, this list of conditions and the following disclaimer.
     12  1.1  riastrad        * Redistributions in binary form must reproduce the above copyright
     13  1.1  riastrad 	 notice, this list of conditions and the following disclaimer in
     14  1.1  riastrad 	 the documentation and/or other materials provided with the
     15  1.1  riastrad 	 distribution.
     16  1.1  riastrad        * Neither the name of the copyright holder nor the names of its
     17  1.1  riastrad 	 contributors may be used to endorse or promote products derived
     18  1.1  riastrad 	 from this software without specific prior written permission.
     19  1.1  riastrad 
     20  1.1  riastrad    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
     21  1.1  riastrad    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     22  1.1  riastrad    TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     23  1.1  riastrad    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     24  1.1  riastrad    HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     25  1.1  riastrad    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     26  1.1  riastrad    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.1  riastrad    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  1.1  riastrad    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  1.1  riastrad    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     30  1.1  riastrad    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  1.1  riastrad */
     32  1.1  riastrad 
     33  1.1  riastrad #ifndef H_QXL_DEV
     34  1.1  riastrad #define H_QXL_DEV
     35  1.1  riastrad 
     36  1.1  riastrad #include <linux/types.h>
     37  1.1  riastrad 
     38  1.1  riastrad /*
     39  1.1  riastrad  * from spice-protocol
     40  1.1  riastrad  * Release 0.10.0
     41  1.1  riastrad  */
     42  1.1  riastrad 
     43  1.1  riastrad /* enums.h */
     44  1.1  riastrad 
     45  1.1  riastrad enum SpiceImageType {
     46  1.1  riastrad 	SPICE_IMAGE_TYPE_BITMAP,
     47  1.1  riastrad 	SPICE_IMAGE_TYPE_QUIC,
     48  1.1  riastrad 	SPICE_IMAGE_TYPE_RESERVED,
     49  1.1  riastrad 	SPICE_IMAGE_TYPE_LZ_PLT = 100,
     50  1.1  riastrad 	SPICE_IMAGE_TYPE_LZ_RGB,
     51  1.1  riastrad 	SPICE_IMAGE_TYPE_GLZ_RGB,
     52  1.1  riastrad 	SPICE_IMAGE_TYPE_FROM_CACHE,
     53  1.1  riastrad 	SPICE_IMAGE_TYPE_SURFACE,
     54  1.1  riastrad 	SPICE_IMAGE_TYPE_JPEG,
     55  1.1  riastrad 	SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS,
     56  1.1  riastrad 	SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB,
     57  1.1  riastrad 	SPICE_IMAGE_TYPE_JPEG_ALPHA,
     58  1.1  riastrad 
     59  1.1  riastrad 	SPICE_IMAGE_TYPE_ENUM_END
     60  1.1  riastrad };
     61  1.1  riastrad 
     62  1.1  riastrad enum SpiceBitmapFmt {
     63  1.1  riastrad 	SPICE_BITMAP_FMT_INVALID,
     64  1.1  riastrad 	SPICE_BITMAP_FMT_1BIT_LE,
     65  1.1  riastrad 	SPICE_BITMAP_FMT_1BIT_BE,
     66  1.1  riastrad 	SPICE_BITMAP_FMT_4BIT_LE,
     67  1.1  riastrad 	SPICE_BITMAP_FMT_4BIT_BE,
     68  1.1  riastrad 	SPICE_BITMAP_FMT_8BIT,
     69  1.1  riastrad 	SPICE_BITMAP_FMT_16BIT,
     70  1.1  riastrad 	SPICE_BITMAP_FMT_24BIT,
     71  1.1  riastrad 	SPICE_BITMAP_FMT_32BIT,
     72  1.1  riastrad 	SPICE_BITMAP_FMT_RGBA,
     73  1.1  riastrad 
     74  1.1  riastrad 	SPICE_BITMAP_FMT_ENUM_END
     75  1.1  riastrad };
     76  1.1  riastrad 
     77  1.1  riastrad enum SpiceSurfaceFmt {
     78  1.1  riastrad 	SPICE_SURFACE_FMT_INVALID,
     79  1.1  riastrad 	SPICE_SURFACE_FMT_1_A,
     80  1.1  riastrad 	SPICE_SURFACE_FMT_8_A = 8,
     81  1.1  riastrad 	SPICE_SURFACE_FMT_16_555 = 16,
     82  1.1  riastrad 	SPICE_SURFACE_FMT_32_xRGB = 32,
     83  1.1  riastrad 	SPICE_SURFACE_FMT_16_565 = 80,
     84  1.1  riastrad 	SPICE_SURFACE_FMT_32_ARGB = 96,
     85  1.1  riastrad 
     86  1.1  riastrad 	SPICE_SURFACE_FMT_ENUM_END
     87  1.1  riastrad };
     88  1.1  riastrad 
     89  1.1  riastrad enum SpiceClipType {
     90  1.1  riastrad 	SPICE_CLIP_TYPE_NONE,
     91  1.1  riastrad 	SPICE_CLIP_TYPE_RECTS,
     92  1.1  riastrad 
     93  1.1  riastrad 	SPICE_CLIP_TYPE_ENUM_END
     94  1.1  riastrad };
     95  1.1  riastrad 
     96  1.1  riastrad enum SpiceRopd {
     97  1.1  riastrad 	SPICE_ROPD_INVERS_SRC = (1 << 0),
     98  1.1  riastrad 	SPICE_ROPD_INVERS_BRUSH = (1 << 1),
     99  1.1  riastrad 	SPICE_ROPD_INVERS_DEST = (1 << 2),
    100  1.1  riastrad 	SPICE_ROPD_OP_PUT = (1 << 3),
    101  1.1  riastrad 	SPICE_ROPD_OP_OR = (1 << 4),
    102  1.1  riastrad 	SPICE_ROPD_OP_AND = (1 << 5),
    103  1.1  riastrad 	SPICE_ROPD_OP_XOR = (1 << 6),
    104  1.1  riastrad 	SPICE_ROPD_OP_BLACKNESS = (1 << 7),
    105  1.1  riastrad 	SPICE_ROPD_OP_WHITENESS = (1 << 8),
    106  1.1  riastrad 	SPICE_ROPD_OP_INVERS = (1 << 9),
    107  1.1  riastrad 	SPICE_ROPD_INVERS_RES = (1 << 10),
    108  1.1  riastrad 
    109  1.1  riastrad 	SPICE_ROPD_MASK = 0x7ff
    110  1.1  riastrad };
    111  1.1  riastrad 
    112  1.1  riastrad enum SpiceBrushType {
    113  1.1  riastrad 	SPICE_BRUSH_TYPE_NONE,
    114  1.1  riastrad 	SPICE_BRUSH_TYPE_SOLID,
    115  1.1  riastrad 	SPICE_BRUSH_TYPE_PATTERN,
    116  1.1  riastrad 
    117  1.1  riastrad 	SPICE_BRUSH_TYPE_ENUM_END
    118  1.1  riastrad };
    119  1.1  riastrad 
    120  1.1  riastrad enum SpiceCursorType {
    121  1.1  riastrad 	SPICE_CURSOR_TYPE_ALPHA,
    122  1.1  riastrad 	SPICE_CURSOR_TYPE_MONO,
    123  1.1  riastrad 	SPICE_CURSOR_TYPE_COLOR4,
    124  1.1  riastrad 	SPICE_CURSOR_TYPE_COLOR8,
    125  1.1  riastrad 	SPICE_CURSOR_TYPE_COLOR16,
    126  1.1  riastrad 	SPICE_CURSOR_TYPE_COLOR24,
    127  1.1  riastrad 	SPICE_CURSOR_TYPE_COLOR32,
    128  1.1  riastrad 
    129  1.1  riastrad 	SPICE_CURSOR_TYPE_ENUM_END
    130  1.1  riastrad };
    131  1.1  riastrad 
    132  1.1  riastrad /* qxl_dev.h */
    133  1.1  riastrad 
    134  1.1  riastrad #pragma pack(push, 1)
    135  1.1  riastrad 
    136  1.1  riastrad #define REDHAT_PCI_VENDOR_ID 0x1b36
    137  1.1  riastrad 
    138  1.1  riastrad /* 0x100-0x11f reserved for spice, 0x1ff used for unstable work */
    139  1.1  riastrad #define QXL_DEVICE_ID_STABLE 0x0100
    140  1.1  riastrad 
    141  1.1  riastrad enum {
    142  1.1  riastrad 	QXL_REVISION_STABLE_V04 = 0x01,
    143  1.1  riastrad 	QXL_REVISION_STABLE_V06 = 0x02,
    144  1.1  riastrad 	QXL_REVISION_STABLE_V10 = 0x03,
    145  1.1  riastrad 	QXL_REVISION_STABLE_V12 = 0x04,
    146  1.1  riastrad };
    147  1.1  riastrad 
    148  1.1  riastrad #define QXL_DEVICE_ID_DEVEL 0x01ff
    149  1.1  riastrad #define QXL_REVISION_DEVEL 0x01
    150  1.1  riastrad 
    151  1.1  riastrad #define QXL_ROM_MAGIC (*(uint32_t *)"QXRO")
    152  1.1  riastrad #define QXL_RAM_MAGIC (*(uint32_t *)"QXRA")
    153  1.1  riastrad 
    154  1.1  riastrad enum {
    155  1.1  riastrad 	QXL_RAM_RANGE_INDEX,
    156  1.1  riastrad 	QXL_VRAM_RANGE_INDEX,
    157  1.1  riastrad 	QXL_ROM_RANGE_INDEX,
    158  1.1  riastrad 	QXL_IO_RANGE_INDEX,
    159  1.1  riastrad 
    160  1.1  riastrad 	QXL_PCI_RANGES
    161  1.1  riastrad };
    162  1.1  riastrad 
    163  1.1  riastrad /* qxl-1 compat: append only */
    164  1.1  riastrad enum {
    165  1.1  riastrad 	QXL_IO_NOTIFY_CMD,
    166  1.1  riastrad 	QXL_IO_NOTIFY_CURSOR,
    167  1.1  riastrad 	QXL_IO_UPDATE_AREA,
    168  1.1  riastrad 	QXL_IO_UPDATE_IRQ,
    169  1.1  riastrad 	QXL_IO_NOTIFY_OOM,
    170  1.1  riastrad 	QXL_IO_RESET,
    171  1.1  riastrad 	QXL_IO_SET_MODE,                  /* qxl-1 */
    172  1.1  riastrad 	QXL_IO_LOG,
    173  1.1  riastrad 	/* appended for qxl-2 */
    174  1.1  riastrad 	QXL_IO_MEMSLOT_ADD,
    175  1.1  riastrad 	QXL_IO_MEMSLOT_DEL,
    176  1.1  riastrad 	QXL_IO_DETACH_PRIMARY,
    177  1.1  riastrad 	QXL_IO_ATTACH_PRIMARY,
    178  1.1  riastrad 	QXL_IO_CREATE_PRIMARY,
    179  1.1  riastrad 	QXL_IO_DESTROY_PRIMARY,
    180  1.1  riastrad 	QXL_IO_DESTROY_SURFACE_WAIT,
    181  1.1  riastrad 	QXL_IO_DESTROY_ALL_SURFACES,
    182  1.1  riastrad 	/* appended for qxl-3 */
    183  1.1  riastrad 	QXL_IO_UPDATE_AREA_ASYNC,
    184  1.1  riastrad 	QXL_IO_MEMSLOT_ADD_ASYNC,
    185  1.1  riastrad 	QXL_IO_CREATE_PRIMARY_ASYNC,
    186  1.1  riastrad 	QXL_IO_DESTROY_PRIMARY_ASYNC,
    187  1.1  riastrad 	QXL_IO_DESTROY_SURFACE_ASYNC,
    188  1.1  riastrad 	QXL_IO_DESTROY_ALL_SURFACES_ASYNC,
    189  1.1  riastrad 	QXL_IO_FLUSH_SURFACES_ASYNC,
    190  1.1  riastrad 	QXL_IO_FLUSH_RELEASE,
    191  1.1  riastrad 	/* appended for qxl-4 */
    192  1.1  riastrad 	QXL_IO_MONITORS_CONFIG_ASYNC,
    193  1.1  riastrad 
    194  1.1  riastrad 	QXL_IO_RANGE_SIZE
    195  1.1  riastrad };
    196  1.1  riastrad 
    197  1.1  riastrad typedef uint64_t QXLPHYSICAL;
    198  1.1  riastrad typedef int32_t QXLFIXED; /* fixed 28.4 */
    199  1.1  riastrad 
    200  1.1  riastrad struct qxl_point_fix {
    201  1.1  riastrad 	QXLFIXED x;
    202  1.1  riastrad 	QXLFIXED y;
    203  1.1  riastrad };
    204  1.1  riastrad 
    205  1.1  riastrad struct qxl_point {
    206  1.1  riastrad 	int32_t x;
    207  1.1  riastrad 	int32_t y;
    208  1.1  riastrad };
    209  1.1  riastrad 
    210  1.1  riastrad struct qxl_point_1_6 {
    211  1.1  riastrad 	int16_t x;
    212  1.1  riastrad 	int16_t y;
    213  1.1  riastrad };
    214  1.1  riastrad 
    215  1.1  riastrad struct qxl_rect {
    216  1.1  riastrad 	int32_t top;
    217  1.1  riastrad 	int32_t left;
    218  1.1  riastrad 	int32_t bottom;
    219  1.1  riastrad 	int32_t right;
    220  1.1  riastrad };
    221  1.1  riastrad 
    222  1.1  riastrad struct qxl_urect {
    223  1.1  riastrad 	uint32_t top;
    224  1.1  riastrad 	uint32_t left;
    225  1.1  riastrad 	uint32_t bottom;
    226  1.1  riastrad 	uint32_t right;
    227  1.1  riastrad };
    228  1.1  riastrad 
    229  1.1  riastrad /* qxl-1 compat: append only */
    230  1.1  riastrad struct qxl_rom {
    231  1.1  riastrad 	uint32_t magic;
    232  1.1  riastrad 	uint32_t id;
    233  1.1  riastrad 	uint32_t update_id;
    234  1.1  riastrad 	uint32_t compression_level;
    235  1.1  riastrad 	uint32_t log_level;
    236  1.1  riastrad 	uint32_t mode;			  /* qxl-1 */
    237  1.1  riastrad 	uint32_t modes_offset;
    238  1.1  riastrad 	uint32_t num_io_pages;
    239  1.1  riastrad 	uint32_t pages_offset;		  /* qxl-1 */
    240  1.1  riastrad 	uint32_t draw_area_offset;	  /* qxl-1 */
    241  1.1  riastrad 	uint32_t surface0_area_size;	  /* qxl-1 name: draw_area_size */
    242  1.1  riastrad 	uint32_t ram_header_offset;
    243  1.1  riastrad 	uint32_t mm_clock;
    244  1.1  riastrad 	/* appended for qxl-2 */
    245  1.1  riastrad 	uint32_t n_surfaces;
    246  1.1  riastrad 	uint64_t flags;
    247  1.1  riastrad 	uint8_t slots_start;
    248  1.1  riastrad 	uint8_t slots_end;
    249  1.1  riastrad 	uint8_t slot_gen_bits;
    250  1.1  riastrad 	uint8_t slot_id_bits;
    251  1.1  riastrad 	uint8_t slot_generation;
    252  1.1  riastrad 	/* appended for qxl-4 */
    253  1.1  riastrad 	uint8_t client_present;
    254  1.1  riastrad 	uint8_t client_capabilities[58];
    255  1.1  riastrad 	uint32_t client_monitors_config_crc;
    256  1.1  riastrad 	struct {
    257  1.1  riastrad 		uint16_t count;
    258  1.1  riastrad 	uint16_t padding;
    259  1.1  riastrad 		struct qxl_urect heads[64];
    260  1.1  riastrad 	} client_monitors_config;
    261  1.1  riastrad };
    262  1.1  riastrad 
    263  1.1  riastrad /* qxl-1 compat: fixed */
    264  1.1  riastrad struct qxl_mode {
    265  1.1  riastrad 	uint32_t id;
    266  1.1  riastrad 	uint32_t x_res;
    267  1.1  riastrad 	uint32_t y_res;
    268  1.1  riastrad 	uint32_t bits;
    269  1.1  riastrad 	uint32_t stride;
    270  1.1  riastrad 	uint32_t x_mili;
    271  1.1  riastrad 	uint32_t y_mili;
    272  1.1  riastrad 	uint32_t orientation;
    273  1.1  riastrad };
    274  1.1  riastrad 
    275  1.1  riastrad /* qxl-1 compat: fixed */
    276  1.1  riastrad struct qxl_modes {
    277  1.1  riastrad 	uint32_t n_modes;
    278  1.1  riastrad 	struct qxl_mode modes[0];
    279  1.1  riastrad };
    280  1.1  riastrad 
    281  1.1  riastrad /* qxl-1 compat: append only */
    282  1.1  riastrad enum qxl_cmd_type {
    283  1.1  riastrad 	QXL_CMD_NOP,
    284  1.1  riastrad 	QXL_CMD_DRAW,
    285  1.1  riastrad 	QXL_CMD_UPDATE,
    286  1.1  riastrad 	QXL_CMD_CURSOR,
    287  1.1  riastrad 	QXL_CMD_MESSAGE,
    288  1.1  riastrad 	QXL_CMD_SURFACE,
    289  1.1  riastrad };
    290  1.1  riastrad 
    291  1.1  riastrad /* qxl-1 compat: fixed */
    292  1.1  riastrad struct qxl_command {
    293  1.1  riastrad 	QXLPHYSICAL data;
    294  1.1  riastrad 	uint32_t type;
    295  1.1  riastrad 	uint32_t padding;
    296  1.1  riastrad };
    297  1.1  riastrad 
    298  1.1  riastrad #define QXL_COMMAND_FLAG_COMPAT		(1<<0)
    299  1.1  riastrad #define QXL_COMMAND_FLAG_COMPAT_16BPP	(2<<0)
    300  1.1  riastrad 
    301  1.1  riastrad struct qxl_command_ext {
    302  1.1  riastrad 	struct qxl_command cmd;
    303  1.1  riastrad 	uint32_t group_id;
    304  1.1  riastrad 	uint32_t flags;
    305  1.1  riastrad };
    306  1.1  riastrad 
    307  1.1  riastrad struct qxl_mem_slot {
    308  1.1  riastrad 	uint64_t mem_start;
    309  1.1  riastrad 	uint64_t mem_end;
    310  1.1  riastrad };
    311  1.1  riastrad 
    312  1.1  riastrad #define QXL_SURF_TYPE_PRIMARY	   0
    313  1.1  riastrad 
    314  1.1  riastrad #define QXL_SURF_FLAG_KEEP_DATA	   (1 << 0)
    315  1.1  riastrad 
    316  1.1  riastrad struct qxl_surface_create {
    317  1.1  riastrad 	uint32_t width;
    318  1.1  riastrad 	uint32_t height;
    319  1.1  riastrad 	int32_t stride;
    320  1.1  riastrad 	uint32_t format;
    321  1.1  riastrad 	uint32_t position;
    322  1.1  riastrad 	uint32_t mouse_mode;
    323  1.1  riastrad 	uint32_t flags;
    324  1.1  riastrad 	uint32_t type;
    325  1.1  riastrad 	QXLPHYSICAL mem;
    326  1.1  riastrad };
    327  1.1  riastrad 
    328  1.1  riastrad #define QXL_COMMAND_RING_SIZE 32
    329  1.1  riastrad #define QXL_CURSOR_RING_SIZE 32
    330  1.1  riastrad #define QXL_RELEASE_RING_SIZE 8
    331  1.1  riastrad 
    332  1.1  riastrad #define QXL_LOG_BUF_SIZE 4096
    333  1.1  riastrad 
    334  1.1  riastrad #define QXL_INTERRUPT_DISPLAY (1 << 0)
    335  1.1  riastrad #define QXL_INTERRUPT_CURSOR (1 << 1)
    336  1.1  riastrad #define QXL_INTERRUPT_IO_CMD (1 << 2)
    337  1.1  riastrad #define QXL_INTERRUPT_ERROR  (1 << 3)
    338  1.1  riastrad #define QXL_INTERRUPT_CLIENT (1 << 4)
    339  1.1  riastrad #define QXL_INTERRUPT_CLIENT_MONITORS_CONFIG  (1 << 5)
    340  1.1  riastrad 
    341  1.1  riastrad struct qxl_ring_header {
    342  1.1  riastrad 	uint32_t num_items;
    343  1.1  riastrad 	uint32_t prod;
    344  1.1  riastrad 	uint32_t notify_on_prod;
    345  1.1  riastrad 	uint32_t cons;
    346  1.1  riastrad 	uint32_t notify_on_cons;
    347  1.1  riastrad };
    348  1.1  riastrad 
    349  1.1  riastrad /* qxl-1 compat: append only */
    350  1.1  riastrad struct qxl_ram_header {
    351  1.1  riastrad 	uint32_t magic;
    352  1.1  riastrad 	uint32_t int_pending;
    353  1.1  riastrad 	uint32_t int_mask;
    354  1.1  riastrad 	uint8_t log_buf[QXL_LOG_BUF_SIZE];
    355  1.1  riastrad 	struct qxl_ring_header  cmd_ring_hdr;
    356  1.1  riastrad 	struct qxl_command	cmd_ring[QXL_COMMAND_RING_SIZE];
    357  1.1  riastrad 	struct qxl_ring_header  cursor_ring_hdr;
    358  1.1  riastrad 	struct qxl_command	cursor_ring[QXL_CURSOR_RING_SIZE];
    359  1.1  riastrad 	struct qxl_ring_header  release_ring_hdr;
    360  1.1  riastrad 	uint64_t		release_ring[QXL_RELEASE_RING_SIZE];
    361  1.1  riastrad 	struct qxl_rect update_area;
    362  1.1  riastrad 	/* appended for qxl-2 */
    363  1.1  riastrad 	uint32_t update_surface;
    364  1.1  riastrad 	struct qxl_mem_slot mem_slot;
    365  1.1  riastrad 	struct qxl_surface_create create_surface;
    366  1.1  riastrad 	uint64_t flags;
    367  1.1  riastrad 
    368  1.1  riastrad 	/* appended for qxl-4 */
    369  1.1  riastrad 
    370  1.1  riastrad 	/* used by QXL_IO_MONITORS_CONFIG_ASYNC */
    371  1.1  riastrad 	QXLPHYSICAL monitors_config;
    372  1.1  riastrad 	uint8_t guest_capabilities[64];
    373  1.1  riastrad };
    374  1.1  riastrad 
    375  1.1  riastrad union qxl_release_info {
    376  1.1  riastrad 	uint64_t id;	  /* in  */
    377  1.1  riastrad 	uint64_t next;	  /* out */
    378  1.1  riastrad };
    379  1.1  riastrad 
    380  1.1  riastrad struct qxl_release_info_ext {
    381  1.1  riastrad 	union qxl_release_info *info;
    382  1.1  riastrad 	uint32_t group_id;
    383  1.1  riastrad };
    384  1.1  riastrad 
    385  1.1  riastrad struct qxl_data_chunk {
    386  1.1  riastrad 	uint32_t data_size;
    387  1.1  riastrad 	QXLPHYSICAL prev_chunk;
    388  1.1  riastrad 	QXLPHYSICAL next_chunk;
    389  1.1  riastrad 	uint8_t data[0];
    390  1.1  riastrad };
    391  1.1  riastrad 
    392  1.1  riastrad struct qxl_message {
    393  1.1  riastrad 	union qxl_release_info release_info;
    394  1.1  riastrad 	uint8_t data[0];
    395  1.1  riastrad };
    396  1.1  riastrad 
    397  1.1  riastrad struct qxl_compat_update_cmd {
    398  1.1  riastrad 	union qxl_release_info release_info;
    399  1.1  riastrad 	struct qxl_rect area;
    400  1.1  riastrad 	uint32_t update_id;
    401  1.1  riastrad };
    402  1.1  riastrad 
    403  1.1  riastrad struct qxl_update_cmd {
    404  1.1  riastrad 	union qxl_release_info release_info;
    405  1.1  riastrad 	struct qxl_rect area;
    406  1.1  riastrad 	uint32_t update_id;
    407  1.1  riastrad 	uint32_t surface_id;
    408  1.1  riastrad };
    409  1.1  riastrad 
    410  1.1  riastrad struct qxl_cursor_header {
    411  1.1  riastrad 	uint64_t unique;
    412  1.1  riastrad 	uint16_t type;
    413  1.1  riastrad 	uint16_t width;
    414  1.1  riastrad 	uint16_t height;
    415  1.1  riastrad 	uint16_t hot_spot_x;
    416  1.1  riastrad 	uint16_t hot_spot_y;
    417  1.1  riastrad };
    418  1.1  riastrad 
    419  1.1  riastrad struct qxl_cursor {
    420  1.1  riastrad 	struct qxl_cursor_header header;
    421  1.1  riastrad 	uint32_t data_size;
    422  1.1  riastrad 	struct qxl_data_chunk chunk;
    423  1.1  riastrad };
    424  1.1  riastrad 
    425  1.1  riastrad enum {
    426  1.1  riastrad 	QXL_CURSOR_SET,
    427  1.1  riastrad 	QXL_CURSOR_MOVE,
    428  1.1  riastrad 	QXL_CURSOR_HIDE,
    429  1.1  riastrad 	QXL_CURSOR_TRAIL,
    430  1.1  riastrad };
    431  1.1  riastrad 
    432  1.1  riastrad #define QXL_CURSOR_DEVICE_DATA_SIZE 128
    433  1.1  riastrad 
    434  1.1  riastrad struct qxl_cursor_cmd {
    435  1.1  riastrad 	union qxl_release_info release_info;
    436  1.1  riastrad 	uint8_t type;
    437  1.1  riastrad 	union {
    438  1.1  riastrad 		struct {
    439  1.1  riastrad 			struct qxl_point_1_6 position;
    440  1.1  riastrad 			uint8_t visible;
    441  1.1  riastrad 			QXLPHYSICAL shape;
    442  1.1  riastrad 		} set;
    443  1.1  riastrad 		struct {
    444  1.1  riastrad 			uint16_t length;
    445  1.1  riastrad 			uint16_t frequency;
    446  1.1  riastrad 		} trail;
    447  1.1  riastrad 		struct qxl_point_1_6 position;
    448  1.1  riastrad 	} u;
    449  1.1  riastrad 	/* todo: dynamic size from rom */
    450  1.1  riastrad 	uint8_t device_data[QXL_CURSOR_DEVICE_DATA_SIZE];
    451  1.1  riastrad };
    452  1.1  riastrad 
    453  1.1  riastrad enum {
    454  1.1  riastrad 	QXL_DRAW_NOP,
    455  1.1  riastrad 	QXL_DRAW_FILL,
    456  1.1  riastrad 	QXL_DRAW_OPAQUE,
    457  1.1  riastrad 	QXL_DRAW_COPY,
    458  1.1  riastrad 	QXL_COPY_BITS,
    459  1.1  riastrad 	QXL_DRAW_BLEND,
    460  1.1  riastrad 	QXL_DRAW_BLACKNESS,
    461  1.1  riastrad 	QXL_DRAW_WHITENESS,
    462  1.1  riastrad 	QXL_DRAW_INVERS,
    463  1.1  riastrad 	QXL_DRAW_ROP3,
    464  1.1  riastrad 	QXL_DRAW_STROKE,
    465  1.1  riastrad 	QXL_DRAW_TEXT,
    466  1.1  riastrad 	QXL_DRAW_TRANSPARENT,
    467  1.1  riastrad 	QXL_DRAW_ALPHA_BLEND,
    468  1.1  riastrad 	QXL_DRAW_COMPOSITE
    469  1.1  riastrad };
    470  1.1  riastrad 
    471  1.1  riastrad struct qxl_raster_glyph {
    472  1.1  riastrad 	struct qxl_point render_pos;
    473  1.1  riastrad 	struct qxl_point glyph_origin;
    474  1.1  riastrad 	uint16_t width;
    475  1.1  riastrad 	uint16_t height;
    476  1.1  riastrad 	uint8_t data[0];
    477  1.1  riastrad };
    478  1.1  riastrad 
    479  1.1  riastrad struct qxl_string {
    480  1.1  riastrad 	uint32_t data_size;
    481  1.1  riastrad 	uint16_t length;
    482  1.1  riastrad 	uint16_t flags;
    483  1.1  riastrad 	struct qxl_data_chunk chunk;
    484  1.1  riastrad };
    485  1.1  riastrad 
    486  1.1  riastrad struct qxl_copy_bits {
    487  1.1  riastrad 	struct qxl_point src_pos;
    488  1.1  riastrad };
    489  1.1  riastrad 
    490  1.1  riastrad enum qxl_effect_type {
    491  1.1  riastrad 	QXL_EFFECT_BLEND = 0,
    492  1.1  riastrad 	QXL_EFFECT_OPAQUE = 1,
    493  1.1  riastrad 	QXL_EFFECT_REVERT_ON_DUP = 2,
    494  1.1  riastrad 	QXL_EFFECT_BLACKNESS_ON_DUP = 3,
    495  1.1  riastrad 	QXL_EFFECT_WHITENESS_ON_DUP = 4,
    496  1.1  riastrad 	QXL_EFFECT_NOP_ON_DUP = 5,
    497  1.1  riastrad 	QXL_EFFECT_NOP = 6,
    498  1.1  riastrad 	QXL_EFFECT_OPAQUE_BRUSH = 7
    499  1.1  riastrad };
    500  1.1  riastrad 
    501  1.1  riastrad struct qxl_pattern {
    502  1.1  riastrad 	QXLPHYSICAL pat;
    503  1.1  riastrad 	struct qxl_point pos;
    504  1.1  riastrad };
    505  1.1  riastrad 
    506  1.1  riastrad struct qxl_brush {
    507  1.1  riastrad 	uint32_t type;
    508  1.1  riastrad 	union {
    509  1.1  riastrad 		uint32_t color;
    510  1.1  riastrad 		struct qxl_pattern pattern;
    511  1.1  riastrad 	} u;
    512  1.1  riastrad };
    513  1.1  riastrad 
    514  1.1  riastrad struct qxl_q_mask {
    515  1.1  riastrad 	uint8_t flags;
    516  1.1  riastrad 	struct qxl_point pos;
    517  1.1  riastrad 	QXLPHYSICAL bitmap;
    518  1.1  riastrad };
    519  1.1  riastrad 
    520  1.1  riastrad struct qxl_fill {
    521  1.1  riastrad 	struct qxl_brush brush;
    522  1.1  riastrad 	uint16_t rop_descriptor;
    523  1.1  riastrad 	struct qxl_q_mask mask;
    524  1.1  riastrad };
    525  1.1  riastrad 
    526  1.1  riastrad struct qxl_opaque {
    527  1.1  riastrad 	QXLPHYSICAL src_bitmap;
    528  1.1  riastrad 	struct qxl_rect src_area;
    529  1.1  riastrad 	struct qxl_brush brush;
    530  1.1  riastrad 	uint16_t rop_descriptor;
    531  1.1  riastrad 	uint8_t scale_mode;
    532  1.1  riastrad 	struct qxl_q_mask mask;
    533  1.1  riastrad };
    534  1.1  riastrad 
    535  1.1  riastrad struct qxl_copy {
    536  1.1  riastrad 	QXLPHYSICAL src_bitmap;
    537  1.1  riastrad 	struct qxl_rect src_area;
    538  1.1  riastrad 	uint16_t rop_descriptor;
    539  1.1  riastrad 	uint8_t scale_mode;
    540  1.1  riastrad 	struct qxl_q_mask mask;
    541  1.1  riastrad };
    542  1.1  riastrad 
    543  1.1  riastrad struct qxl_transparent {
    544  1.1  riastrad 	QXLPHYSICAL src_bitmap;
    545  1.1  riastrad 	struct qxl_rect src_area;
    546  1.1  riastrad 	uint32_t src_color;
    547  1.1  riastrad 	uint32_t true_color;
    548  1.1  riastrad };
    549  1.1  riastrad 
    550  1.1  riastrad struct qxl_alpha_blend {
    551  1.1  riastrad 	uint16_t alpha_flags;
    552  1.1  riastrad 	uint8_t alpha;
    553  1.1  riastrad 	QXLPHYSICAL src_bitmap;
    554  1.1  riastrad 	struct qxl_rect src_area;
    555  1.1  riastrad };
    556  1.1  riastrad 
    557  1.1  riastrad struct qxl_compat_alpha_blend {
    558  1.1  riastrad 	uint8_t alpha;
    559  1.1  riastrad 	QXLPHYSICAL src_bitmap;
    560  1.1  riastrad 	struct qxl_rect src_area;
    561  1.1  riastrad };
    562  1.1  riastrad 
    563  1.1  riastrad struct qxl_rop_3 {
    564  1.1  riastrad 	QXLPHYSICAL src_bitmap;
    565  1.1  riastrad 	struct qxl_rect src_area;
    566  1.1  riastrad 	struct qxl_brush brush;
    567  1.1  riastrad 	uint8_t rop3;
    568  1.1  riastrad 	uint8_t scale_mode;
    569  1.1  riastrad 	struct qxl_q_mask mask;
    570  1.1  riastrad };
    571  1.1  riastrad 
    572  1.1  riastrad struct qxl_line_attr {
    573  1.1  riastrad 	uint8_t flags;
    574  1.1  riastrad 	uint8_t join_style;
    575  1.1  riastrad 	uint8_t end_style;
    576  1.1  riastrad 	uint8_t style_nseg;
    577  1.1  riastrad 	QXLFIXED width;
    578  1.1  riastrad 	QXLFIXED miter_limit;
    579  1.1  riastrad 	QXLPHYSICAL style;
    580  1.1  riastrad };
    581  1.1  riastrad 
    582  1.1  riastrad struct qxl_stroke {
    583  1.1  riastrad 	QXLPHYSICAL path;
    584  1.1  riastrad 	struct qxl_line_attr attr;
    585  1.1  riastrad 	struct qxl_brush brush;
    586  1.1  riastrad 	uint16_t fore_mode;
    587  1.1  riastrad 	uint16_t back_mode;
    588  1.1  riastrad };
    589  1.1  riastrad 
    590  1.1  riastrad struct qxl_text {
    591  1.1  riastrad 	QXLPHYSICAL str;
    592  1.1  riastrad 	struct qxl_rect back_area;
    593  1.1  riastrad 	struct qxl_brush fore_brush;
    594  1.1  riastrad 	struct qxl_brush back_brush;
    595  1.1  riastrad 	uint16_t fore_mode;
    596  1.1  riastrad 	uint16_t back_mode;
    597  1.1  riastrad };
    598  1.1  riastrad 
    599  1.1  riastrad struct qxl_mask {
    600  1.1  riastrad 	struct qxl_q_mask mask;
    601  1.1  riastrad };
    602  1.1  riastrad 
    603  1.1  riastrad struct qxl_clip {
    604  1.1  riastrad 	uint32_t type;
    605  1.1  riastrad 	QXLPHYSICAL data;
    606  1.1  riastrad };
    607  1.1  riastrad 
    608  1.1  riastrad enum qxl_operator {
    609  1.1  riastrad 	QXL_OP_CLEAR			 = 0x00,
    610  1.1  riastrad 	QXL_OP_SOURCE			 = 0x01,
    611  1.1  riastrad 	QXL_OP_DST			 = 0x02,
    612  1.1  riastrad 	QXL_OP_OVER			 = 0x03,
    613  1.1  riastrad 	QXL_OP_OVER_REVERSE		 = 0x04,
    614  1.1  riastrad 	QXL_OP_IN			 = 0x05,
    615  1.1  riastrad 	QXL_OP_IN_REVERSE		 = 0x06,
    616  1.1  riastrad 	QXL_OP_OUT			 = 0x07,
    617  1.1  riastrad 	QXL_OP_OUT_REVERSE		 = 0x08,
    618  1.1  riastrad 	QXL_OP_ATOP			 = 0x09,
    619  1.1  riastrad 	QXL_OP_ATOP_REVERSE		 = 0x0a,
    620  1.1  riastrad 	QXL_OP_XOR			 = 0x0b,
    621  1.1  riastrad 	QXL_OP_ADD			 = 0x0c,
    622  1.1  riastrad 	QXL_OP_SATURATE			 = 0x0d,
    623  1.1  riastrad 	/* Note the jump here from 0x0d to 0x30 */
    624  1.1  riastrad 	QXL_OP_MULTIPLY			 = 0x30,
    625  1.1  riastrad 	QXL_OP_SCREEN			 = 0x31,
    626  1.1  riastrad 	QXL_OP_OVERLAY			 = 0x32,
    627  1.1  riastrad 	QXL_OP_DARKEN			 = 0x33,
    628  1.1  riastrad 	QXL_OP_LIGHTEN			 = 0x34,
    629  1.1  riastrad 	QXL_OP_COLOR_DODGE		 = 0x35,
    630  1.1  riastrad 	QXL_OP_COLOR_BURN		 = 0x36,
    631  1.1  riastrad 	QXL_OP_HARD_LIGHT		 = 0x37,
    632  1.1  riastrad 	QXL_OP_SOFT_LIGHT		 = 0x38,
    633  1.1  riastrad 	QXL_OP_DIFFERENCE		 = 0x39,
    634  1.1  riastrad 	QXL_OP_EXCLUSION		 = 0x3a,
    635  1.1  riastrad 	QXL_OP_HSL_HUE			 = 0x3b,
    636  1.1  riastrad 	QXL_OP_HSL_SATURATION		 = 0x3c,
    637  1.1  riastrad 	QXL_OP_HSL_COLOR		 = 0x3d,
    638  1.1  riastrad 	QXL_OP_HSL_LUMINOSITY		 = 0x3e
    639  1.1  riastrad };
    640  1.1  riastrad 
    641  1.1  riastrad struct qxl_transform {
    642  1.1  riastrad 	uint32_t	t00;
    643  1.1  riastrad 	uint32_t	t01;
    644  1.1  riastrad 	uint32_t	t02;
    645  1.1  riastrad 	uint32_t	t10;
    646  1.1  riastrad 	uint32_t	t11;
    647  1.1  riastrad 	uint32_t	t12;
    648  1.1  riastrad };
    649  1.1  riastrad 
    650  1.1  riastrad /* The flags field has the following bit fields:
    651  1.1  riastrad  *
    652  1.1  riastrad  *     operator:		[  0 -  7 ]
    653  1.1  riastrad  *     src_filter:		[  8 - 10 ]
    654  1.1  riastrad  *     mask_filter:		[ 11 - 13 ]
    655  1.1  riastrad  *     src_repeat:		[ 14 - 15 ]
    656  1.1  riastrad  *     mask_repeat:		[ 16 - 17 ]
    657  1.1  riastrad  *     component_alpha:		[ 18 - 18 ]
    658  1.1  riastrad  *     reserved:		[ 19 - 31 ]
    659  1.1  riastrad  *
    660  1.1  riastrad  * The repeat and filter values are those of pixman:
    661  1.1  riastrad  *		REPEAT_NONE =		0
    662  1.1  riastrad  *              REPEAT_NORMAL =		1
    663  1.1  riastrad  *		REPEAT_PAD =		2
    664  1.1  riastrad  *		REPEAT_REFLECT =	3
    665  1.1  riastrad  *
    666  1.1  riastrad  * The filter values are:
    667  1.1  riastrad  *		FILTER_NEAREST =	0
    668  1.1  riastrad  *		FILTER_BILINEAR	=	1
    669  1.1  riastrad  */
    670  1.1  riastrad struct qxl_composite {
    671  1.1  riastrad 	uint32_t		flags;
    672  1.1  riastrad 
    673  1.1  riastrad 	QXLPHYSICAL			src;
    674  1.1  riastrad 	QXLPHYSICAL			src_transform;	/* May be NULL */
    675  1.1  riastrad 	QXLPHYSICAL			mask;		/* May be NULL */
    676  1.1  riastrad 	QXLPHYSICAL			mask_transform;	/* May be NULL */
    677  1.1  riastrad 	struct qxl_point_1_6	src_origin;
    678  1.1  riastrad 	struct qxl_point_1_6	mask_origin;
    679  1.1  riastrad };
    680  1.1  riastrad 
    681  1.1  riastrad struct qxl_compat_drawable {
    682  1.1  riastrad 	union qxl_release_info release_info;
    683  1.1  riastrad 	uint8_t effect;
    684  1.1  riastrad 	uint8_t type;
    685  1.1  riastrad 	uint16_t bitmap_offset;
    686  1.1  riastrad 	struct qxl_rect bitmap_area;
    687  1.1  riastrad 	struct qxl_rect bbox;
    688  1.1  riastrad 	struct qxl_clip clip;
    689  1.1  riastrad 	uint32_t mm_time;
    690  1.1  riastrad 	union {
    691  1.1  riastrad 		struct qxl_fill fill;
    692  1.1  riastrad 		struct qxl_opaque opaque;
    693  1.1  riastrad 		struct qxl_copy copy;
    694  1.1  riastrad 		struct qxl_transparent transparent;
    695  1.1  riastrad 		struct qxl_compat_alpha_blend alpha_blend;
    696  1.1  riastrad 		struct qxl_copy_bits copy_bits;
    697  1.1  riastrad 		struct qxl_copy blend;
    698  1.1  riastrad 		struct qxl_rop_3 rop3;
    699  1.1  riastrad 		struct qxl_stroke stroke;
    700  1.1  riastrad 		struct qxl_text text;
    701  1.1  riastrad 		struct qxl_mask blackness;
    702  1.1  riastrad 		struct qxl_mask invers;
    703  1.1  riastrad 		struct qxl_mask whiteness;
    704  1.1  riastrad 	} u;
    705  1.1  riastrad };
    706  1.1  riastrad 
    707  1.1  riastrad struct qxl_drawable {
    708  1.1  riastrad 	union qxl_release_info release_info;
    709  1.1  riastrad 	uint32_t surface_id;
    710  1.1  riastrad 	uint8_t effect;
    711  1.1  riastrad 	uint8_t type;
    712  1.1  riastrad 	uint8_t self_bitmap;
    713  1.1  riastrad 	struct qxl_rect self_bitmap_area;
    714  1.1  riastrad 	struct qxl_rect bbox;
    715  1.1  riastrad 	struct qxl_clip clip;
    716  1.1  riastrad 	uint32_t mm_time;
    717  1.1  riastrad 	int32_t surfaces_dest[3];
    718  1.1  riastrad 	struct qxl_rect surfaces_rects[3];
    719  1.1  riastrad 	union {
    720  1.1  riastrad 		struct qxl_fill fill;
    721  1.1  riastrad 		struct qxl_opaque opaque;
    722  1.1  riastrad 		struct qxl_copy copy;
    723  1.1  riastrad 		struct qxl_transparent transparent;
    724  1.1  riastrad 		struct qxl_alpha_blend alpha_blend;
    725  1.1  riastrad 		struct qxl_copy_bits copy_bits;
    726  1.1  riastrad 		struct qxl_copy blend;
    727  1.1  riastrad 		struct qxl_rop_3 rop3;
    728  1.1  riastrad 		struct qxl_stroke stroke;
    729  1.1  riastrad 		struct qxl_text text;
    730  1.1  riastrad 		struct qxl_mask blackness;
    731  1.1  riastrad 		struct qxl_mask invers;
    732  1.1  riastrad 		struct qxl_mask whiteness;
    733  1.1  riastrad 		struct qxl_composite composite;
    734  1.1  riastrad 	} u;
    735  1.1  riastrad };
    736  1.1  riastrad 
    737  1.1  riastrad enum qxl_surface_cmd_type {
    738  1.1  riastrad 	QXL_SURFACE_CMD_CREATE,
    739  1.1  riastrad 	QXL_SURFACE_CMD_DESTROY,
    740  1.1  riastrad };
    741  1.1  riastrad 
    742  1.1  riastrad struct qxl_surface {
    743  1.1  riastrad 	uint32_t format;
    744  1.1  riastrad 	uint32_t width;
    745  1.1  riastrad 	uint32_t height;
    746  1.1  riastrad 	int32_t stride;
    747  1.1  riastrad 	QXLPHYSICAL data;
    748  1.1  riastrad };
    749  1.1  riastrad 
    750  1.1  riastrad struct qxl_surface_cmd {
    751  1.1  riastrad 	union qxl_release_info release_info;
    752  1.1  riastrad 	uint32_t surface_id;
    753  1.1  riastrad 	uint8_t type;
    754  1.1  riastrad 	uint32_t flags;
    755  1.1  riastrad 	union {
    756  1.1  riastrad 		struct qxl_surface surface_create;
    757  1.1  riastrad 	} u;
    758  1.1  riastrad };
    759  1.1  riastrad 
    760  1.1  riastrad struct qxl_clip_rects {
    761  1.1  riastrad 	uint32_t num_rects;
    762  1.1  riastrad 	struct qxl_data_chunk chunk;
    763  1.1  riastrad };
    764  1.1  riastrad 
    765  1.1  riastrad enum {
    766  1.1  riastrad 	QXL_PATH_BEGIN = (1 << 0),
    767  1.1  riastrad 	QXL_PATH_END = (1 << 1),
    768  1.1  riastrad 	QXL_PATH_CLOSE = (1 << 3),
    769  1.1  riastrad 	QXL_PATH_BEZIER = (1 << 4),
    770  1.1  riastrad };
    771  1.1  riastrad 
    772  1.1  riastrad struct qxl_path_seg {
    773  1.1  riastrad 	uint32_t flags;
    774  1.1  riastrad 	uint32_t count;
    775  1.1  riastrad 	struct qxl_point_fix points[0];
    776  1.1  riastrad };
    777  1.1  riastrad 
    778  1.1  riastrad struct qxl_path {
    779  1.1  riastrad 	uint32_t data_size;
    780  1.1  riastrad 	struct qxl_data_chunk chunk;
    781  1.1  riastrad };
    782  1.1  riastrad 
    783  1.1  riastrad enum {
    784  1.1  riastrad 	QXL_IMAGE_GROUP_DRIVER,
    785  1.1  riastrad 	QXL_IMAGE_GROUP_DEVICE,
    786  1.1  riastrad 	QXL_IMAGE_GROUP_RED,
    787  1.1  riastrad 	QXL_IMAGE_GROUP_DRIVER_DONT_CACHE,
    788  1.1  riastrad };
    789  1.1  riastrad 
    790  1.1  riastrad struct qxl_image_id {
    791  1.1  riastrad 	uint32_t group;
    792  1.1  riastrad 	uint32_t unique;
    793  1.1  riastrad };
    794  1.1  riastrad 
    795  1.1  riastrad union qxl_image_id_union {
    796  1.1  riastrad 	struct qxl_image_id id;
    797  1.1  riastrad 	uint64_t value;
    798  1.1  riastrad };
    799  1.1  riastrad 
    800  1.1  riastrad enum qxl_image_flags {
    801  1.1  riastrad 	QXL_IMAGE_CACHE = (1 << 0),
    802  1.1  riastrad 	QXL_IMAGE_HIGH_BITS_SET = (1 << 1),
    803  1.1  riastrad };
    804  1.1  riastrad 
    805  1.1  riastrad enum qxl_bitmap_flags {
    806  1.1  riastrad 	QXL_BITMAP_DIRECT = (1 << 0),
    807  1.1  riastrad 	QXL_BITMAP_UNSTABLE = (1 << 1),
    808  1.1  riastrad 	QXL_BITMAP_TOP_DOWN = (1 << 2), /* == SPICE_BITMAP_FLAGS_TOP_DOWN */
    809  1.1  riastrad };
    810  1.1  riastrad 
    811  1.1  riastrad #define QXL_SET_IMAGE_ID(image, _group, _unique) {              \
    812  1.1  riastrad 	(image)->descriptor.id = (((uint64_t)_unique) << 32) | _group;	\
    813  1.1  riastrad }
    814  1.1  riastrad 
    815  1.1  riastrad struct qxl_image_descriptor {
    816  1.1  riastrad 	uint64_t id;
    817  1.1  riastrad 	uint8_t type;
    818  1.1  riastrad 	uint8_t flags;
    819  1.1  riastrad 	uint32_t width;
    820  1.1  riastrad 	uint32_t height;
    821  1.1  riastrad };
    822  1.1  riastrad 
    823  1.1  riastrad struct qxl_palette {
    824  1.1  riastrad 	uint64_t unique;
    825  1.1  riastrad 	uint16_t num_ents;
    826  1.1  riastrad 	uint32_t ents[0];
    827  1.1  riastrad };
    828  1.1  riastrad 
    829  1.1  riastrad struct qxl_bitmap {
    830  1.1  riastrad 	uint8_t format;
    831  1.1  riastrad 	uint8_t flags;
    832  1.1  riastrad 	uint32_t x;
    833  1.1  riastrad 	uint32_t y;
    834  1.1  riastrad 	uint32_t stride;
    835  1.1  riastrad 	QXLPHYSICAL palette;
    836  1.1  riastrad 	QXLPHYSICAL data; /* data[0] ? */
    837  1.1  riastrad };
    838  1.1  riastrad 
    839  1.1  riastrad struct qxl_surface_id {
    840  1.1  riastrad 	uint32_t surface_id;
    841  1.1  riastrad };
    842  1.1  riastrad 
    843  1.1  riastrad struct qxl_encoder_data {
    844  1.1  riastrad 	uint32_t data_size;
    845  1.1  riastrad 	uint8_t data[0];
    846  1.1  riastrad };
    847  1.1  riastrad 
    848  1.1  riastrad struct qxl_image {
    849  1.1  riastrad 	struct qxl_image_descriptor descriptor;
    850  1.1  riastrad 	union { /* variable length */
    851  1.1  riastrad 		struct qxl_bitmap bitmap;
    852  1.1  riastrad 		struct qxl_encoder_data quic;
    853  1.1  riastrad 		struct qxl_surface_id surface_image;
    854  1.1  riastrad 	} u;
    855  1.1  riastrad };
    856  1.1  riastrad 
    857  1.1  riastrad /* A QXLHead is a single monitor output backed by a QXLSurface.
    858  1.1  riastrad  * x and y offsets are unsigned since they are used in relation to
    859  1.1  riastrad  * the given surface, not the same as the x, y coordinates in the guest
    860  1.1  riastrad  * screen reference frame. */
    861  1.1  riastrad struct qxl_head {
    862  1.1  riastrad 	uint32_t id;
    863  1.1  riastrad 	uint32_t surface_id;
    864  1.1  riastrad 	uint32_t width;
    865  1.1  riastrad 	uint32_t height;
    866  1.1  riastrad 	uint32_t x;
    867  1.1  riastrad 	uint32_t y;
    868  1.1  riastrad 	uint32_t flags;
    869  1.1  riastrad };
    870  1.1  riastrad 
    871  1.1  riastrad struct qxl_monitors_config {
    872  1.1  riastrad 	uint16_t count;
    873  1.1  riastrad 	uint16_t max_allowed; /* If it is 0 no fixed limit is given by the
    874  1.1  riastrad 				 driver */
    875  1.1  riastrad 	struct qxl_head heads[0];
    876  1.1  riastrad };
    877  1.1  riastrad 
    878  1.1  riastrad #pragma pack(pop)
    879  1.1  riastrad 
    880  1.1  riastrad #endif /* _H_QXL_DEV */
    881