Back to home page

OSCL-LXR

 
 

    


0001 /*
0002    Copyright (C) 2009 Red Hat, Inc.
0003 
0004    Redistribution and use in source and binary forms, with or without
0005    modification, are permitted provided that the following conditions are
0006    met:
0007 
0008        * Redistributions of source code must retain the above copyright
0009      notice, this list of conditions and the following disclaimer.
0010        * Redistributions in binary form must reproduce the above copyright
0011      notice, this list of conditions and the following disclaimer in
0012      the documentation and/or other materials provided with the
0013      distribution.
0014        * Neither the name of the copyright holder nor the names of its
0015      contributors may be used to endorse or promote products derived
0016      from this software without specific prior written permission.
0017 
0018    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
0019    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
0020    TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
0021    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0022    HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0023    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0024    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0025    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0026    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0027    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0028    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0029 */
0030 
0031 #ifndef H_QXL_DEV
0032 #define H_QXL_DEV
0033 
0034 #include <linux/types.h>
0035 
0036 /*
0037  * from spice-protocol
0038  * Release 0.10.0
0039  */
0040 
0041 /* enums.h */
0042 
0043 enum SpiceImageType {
0044     SPICE_IMAGE_TYPE_BITMAP,
0045     SPICE_IMAGE_TYPE_QUIC,
0046     SPICE_IMAGE_TYPE_RESERVED,
0047     SPICE_IMAGE_TYPE_LZ_PLT = 100,
0048     SPICE_IMAGE_TYPE_LZ_RGB,
0049     SPICE_IMAGE_TYPE_GLZ_RGB,
0050     SPICE_IMAGE_TYPE_FROM_CACHE,
0051     SPICE_IMAGE_TYPE_SURFACE,
0052     SPICE_IMAGE_TYPE_JPEG,
0053     SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS,
0054     SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB,
0055     SPICE_IMAGE_TYPE_JPEG_ALPHA,
0056 
0057     SPICE_IMAGE_TYPE_ENUM_END
0058 };
0059 
0060 enum SpiceBitmapFmt {
0061     SPICE_BITMAP_FMT_INVALID,
0062     SPICE_BITMAP_FMT_1BIT_LE,
0063     SPICE_BITMAP_FMT_1BIT_BE,
0064     SPICE_BITMAP_FMT_4BIT_LE,
0065     SPICE_BITMAP_FMT_4BIT_BE,
0066     SPICE_BITMAP_FMT_8BIT,
0067     SPICE_BITMAP_FMT_16BIT,
0068     SPICE_BITMAP_FMT_24BIT,
0069     SPICE_BITMAP_FMT_32BIT,
0070     SPICE_BITMAP_FMT_RGBA,
0071 
0072     SPICE_BITMAP_FMT_ENUM_END
0073 };
0074 
0075 enum SpiceSurfaceFmt {
0076     SPICE_SURFACE_FMT_INVALID,
0077     SPICE_SURFACE_FMT_1_A,
0078     SPICE_SURFACE_FMT_8_A = 8,
0079     SPICE_SURFACE_FMT_16_555 = 16,
0080     SPICE_SURFACE_FMT_32_xRGB = 32,
0081     SPICE_SURFACE_FMT_16_565 = 80,
0082     SPICE_SURFACE_FMT_32_ARGB = 96,
0083 
0084     SPICE_SURFACE_FMT_ENUM_END
0085 };
0086 
0087 enum SpiceClipType {
0088     SPICE_CLIP_TYPE_NONE,
0089     SPICE_CLIP_TYPE_RECTS,
0090 
0091     SPICE_CLIP_TYPE_ENUM_END
0092 };
0093 
0094 enum SpiceRopd {
0095     SPICE_ROPD_INVERS_SRC = (1 << 0),
0096     SPICE_ROPD_INVERS_BRUSH = (1 << 1),
0097     SPICE_ROPD_INVERS_DEST = (1 << 2),
0098     SPICE_ROPD_OP_PUT = (1 << 3),
0099     SPICE_ROPD_OP_OR = (1 << 4),
0100     SPICE_ROPD_OP_AND = (1 << 5),
0101     SPICE_ROPD_OP_XOR = (1 << 6),
0102     SPICE_ROPD_OP_BLACKNESS = (1 << 7),
0103     SPICE_ROPD_OP_WHITENESS = (1 << 8),
0104     SPICE_ROPD_OP_INVERS = (1 << 9),
0105     SPICE_ROPD_INVERS_RES = (1 << 10),
0106 
0107     SPICE_ROPD_MASK = 0x7ff
0108 };
0109 
0110 enum SpiceBrushType {
0111     SPICE_BRUSH_TYPE_NONE,
0112     SPICE_BRUSH_TYPE_SOLID,
0113     SPICE_BRUSH_TYPE_PATTERN,
0114 
0115     SPICE_BRUSH_TYPE_ENUM_END
0116 };
0117 
0118 enum SpiceCursorType {
0119     SPICE_CURSOR_TYPE_ALPHA,
0120     SPICE_CURSOR_TYPE_MONO,
0121     SPICE_CURSOR_TYPE_COLOR4,
0122     SPICE_CURSOR_TYPE_COLOR8,
0123     SPICE_CURSOR_TYPE_COLOR16,
0124     SPICE_CURSOR_TYPE_COLOR24,
0125     SPICE_CURSOR_TYPE_COLOR32,
0126 
0127     SPICE_CURSOR_TYPE_ENUM_END
0128 };
0129 
0130 /* qxl_dev.h */
0131 
0132 #pragma pack(push, 1)
0133 
0134 /* 0x100-0x11f reserved for spice, 0x1ff used for unstable work */
0135 #define QXL_DEVICE_ID_STABLE 0x0100
0136 
0137 enum {
0138     QXL_REVISION_STABLE_V04 = 0x01,
0139     QXL_REVISION_STABLE_V06 = 0x02,
0140     QXL_REVISION_STABLE_V10 = 0x03,
0141     QXL_REVISION_STABLE_V12 = 0x04,
0142 };
0143 
0144 #define QXL_DEVICE_ID_DEVEL 0x01ff
0145 #define QXL_REVISION_DEVEL 0x01
0146 
0147 #define QXL_ROM_MAGIC (*(uint32_t *)"QXRO")
0148 #define QXL_RAM_MAGIC (*(uint32_t *)"QXRA")
0149 
0150 enum {
0151     QXL_RAM_RANGE_INDEX,
0152     QXL_VRAM_RANGE_INDEX,
0153     QXL_ROM_RANGE_INDEX,
0154     QXL_IO_RANGE_INDEX,
0155 
0156     QXL_PCI_RANGES
0157 };
0158 
0159 /* qxl-1 compat: append only */
0160 enum {
0161     QXL_IO_NOTIFY_CMD,
0162     QXL_IO_NOTIFY_CURSOR,
0163     QXL_IO_UPDATE_AREA,
0164     QXL_IO_UPDATE_IRQ,
0165     QXL_IO_NOTIFY_OOM,
0166     QXL_IO_RESET,
0167     QXL_IO_SET_MODE,                  /* qxl-1 */
0168     QXL_IO_LOG,
0169     /* appended for qxl-2 */
0170     QXL_IO_MEMSLOT_ADD,
0171     QXL_IO_MEMSLOT_DEL,
0172     QXL_IO_DETACH_PRIMARY,
0173     QXL_IO_ATTACH_PRIMARY,
0174     QXL_IO_CREATE_PRIMARY,
0175     QXL_IO_DESTROY_PRIMARY,
0176     QXL_IO_DESTROY_SURFACE_WAIT,
0177     QXL_IO_DESTROY_ALL_SURFACES,
0178     /* appended for qxl-3 */
0179     QXL_IO_UPDATE_AREA_ASYNC,
0180     QXL_IO_MEMSLOT_ADD_ASYNC,
0181     QXL_IO_CREATE_PRIMARY_ASYNC,
0182     QXL_IO_DESTROY_PRIMARY_ASYNC,
0183     QXL_IO_DESTROY_SURFACE_ASYNC,
0184     QXL_IO_DESTROY_ALL_SURFACES_ASYNC,
0185     QXL_IO_FLUSH_SURFACES_ASYNC,
0186     QXL_IO_FLUSH_RELEASE,
0187     /* appended for qxl-4 */
0188     QXL_IO_MONITORS_CONFIG_ASYNC,
0189 
0190     QXL_IO_RANGE_SIZE
0191 };
0192 
0193 typedef uint64_t QXLPHYSICAL;
0194 typedef int32_t QXLFIXED; /* fixed 28.4 */
0195 
0196 struct qxl_point_fix {
0197     QXLFIXED x;
0198     QXLFIXED y;
0199 };
0200 
0201 struct qxl_point {
0202     int32_t x;
0203     int32_t y;
0204 };
0205 
0206 struct qxl_point_1_6 {
0207     int16_t x;
0208     int16_t y;
0209 };
0210 
0211 struct qxl_rect {
0212     int32_t top;
0213     int32_t left;
0214     int32_t bottom;
0215     int32_t right;
0216 };
0217 
0218 struct qxl_urect {
0219     uint32_t top;
0220     uint32_t left;
0221     uint32_t bottom;
0222     uint32_t right;
0223 };
0224 
0225 /* qxl-1 compat: append only */
0226 struct qxl_rom {
0227     uint32_t magic;
0228     uint32_t id;
0229     uint32_t update_id;
0230     uint32_t compression_level;
0231     uint32_t log_level;
0232     uint32_t mode;            /* qxl-1 */
0233     uint32_t modes_offset;
0234     uint32_t num_io_pages;
0235     uint32_t pages_offset;        /* qxl-1 */
0236     uint32_t draw_area_offset;    /* qxl-1 */
0237     uint32_t surface0_area_size;      /* qxl-1 name: draw_area_size */
0238     uint32_t ram_header_offset;
0239     uint32_t mm_clock;
0240     /* appended for qxl-2 */
0241     uint32_t n_surfaces;
0242     uint64_t flags;
0243     uint8_t slots_start;
0244     uint8_t slots_end;
0245     uint8_t slot_gen_bits;
0246     uint8_t slot_id_bits;
0247     uint8_t slot_generation;
0248     /* appended for qxl-4 */
0249     uint8_t client_present;
0250     uint8_t client_capabilities[58];
0251     uint32_t client_monitors_config_crc;
0252     struct {
0253         uint16_t count;
0254     uint16_t padding;
0255         struct qxl_urect heads[64];
0256     } client_monitors_config;
0257 };
0258 
0259 /* qxl-1 compat: fixed */
0260 struct qxl_mode {
0261     uint32_t id;
0262     uint32_t x_res;
0263     uint32_t y_res;
0264     uint32_t bits;
0265     uint32_t stride;
0266     uint32_t x_mili;
0267     uint32_t y_mili;
0268     uint32_t orientation;
0269 };
0270 
0271 /* qxl-1 compat: fixed */
0272 struct qxl_modes {
0273     uint32_t n_modes;
0274     struct qxl_mode modes[];
0275 };
0276 
0277 /* qxl-1 compat: append only */
0278 enum qxl_cmd_type {
0279     QXL_CMD_NOP,
0280     QXL_CMD_DRAW,
0281     QXL_CMD_UPDATE,
0282     QXL_CMD_CURSOR,
0283     QXL_CMD_MESSAGE,
0284     QXL_CMD_SURFACE,
0285 };
0286 
0287 /* qxl-1 compat: fixed */
0288 struct qxl_command {
0289     QXLPHYSICAL data;
0290     uint32_t type;
0291     uint32_t padding;
0292 };
0293 
0294 #define QXL_COMMAND_FLAG_COMPAT     (1<<0)
0295 #define QXL_COMMAND_FLAG_COMPAT_16BPP   (2<<0)
0296 
0297 struct qxl_command_ext {
0298     struct qxl_command cmd;
0299     uint32_t group_id;
0300     uint32_t flags;
0301 };
0302 
0303 struct qxl_mem_slot {
0304     uint64_t mem_start;
0305     uint64_t mem_end;
0306 };
0307 
0308 #define QXL_SURF_TYPE_PRIMARY      0
0309 
0310 #define QXL_SURF_FLAG_KEEP_DATA    (1 << 0)
0311 
0312 struct qxl_surface_create {
0313     uint32_t width;
0314     uint32_t height;
0315     int32_t stride;
0316     uint32_t format;
0317     uint32_t position;
0318     uint32_t mouse_mode;
0319     uint32_t flags;
0320     uint32_t type;
0321     QXLPHYSICAL mem;
0322 };
0323 
0324 #define QXL_COMMAND_RING_SIZE 32
0325 #define QXL_CURSOR_RING_SIZE 32
0326 #define QXL_RELEASE_RING_SIZE 8
0327 
0328 #define QXL_LOG_BUF_SIZE 4096
0329 
0330 #define QXL_INTERRUPT_DISPLAY (1 << 0)
0331 #define QXL_INTERRUPT_CURSOR (1 << 1)
0332 #define QXL_INTERRUPT_IO_CMD (1 << 2)
0333 #define QXL_INTERRUPT_ERROR  (1 << 3)
0334 #define QXL_INTERRUPT_CLIENT (1 << 4)
0335 #define QXL_INTERRUPT_CLIENT_MONITORS_CONFIG  (1 << 5)
0336 
0337 struct qxl_ring_header {
0338     uint32_t num_items;
0339     uint32_t prod;
0340     uint32_t notify_on_prod;
0341     uint32_t cons;
0342     uint32_t notify_on_cons;
0343 };
0344 
0345 /* qxl-1 compat: append only */
0346 struct qxl_ram_header {
0347     uint32_t magic;
0348     uint32_t int_pending;
0349     uint32_t int_mask;
0350     uint8_t log_buf[QXL_LOG_BUF_SIZE];
0351     struct qxl_ring_header  cmd_ring_hdr;
0352     struct qxl_command  cmd_ring[QXL_COMMAND_RING_SIZE];
0353     struct qxl_ring_header  cursor_ring_hdr;
0354     struct qxl_command  cursor_ring[QXL_CURSOR_RING_SIZE];
0355     struct qxl_ring_header  release_ring_hdr;
0356     uint64_t        release_ring[QXL_RELEASE_RING_SIZE];
0357     struct qxl_rect update_area;
0358     /* appended for qxl-2 */
0359     uint32_t update_surface;
0360     struct qxl_mem_slot mem_slot;
0361     struct qxl_surface_create create_surface;
0362     uint64_t flags;
0363 
0364     /* appended for qxl-4 */
0365 
0366     /* used by QXL_IO_MONITORS_CONFIG_ASYNC */
0367     QXLPHYSICAL monitors_config;
0368     uint8_t guest_capabilities[64];
0369 };
0370 
0371 union qxl_release_info {
0372     uint64_t id;      /* in  */
0373     uint64_t next;    /* out */
0374 };
0375 
0376 struct qxl_release_info_ext {
0377     union qxl_release_info *info;
0378     uint32_t group_id;
0379 };
0380 
0381 struct qxl_data_chunk {
0382     uint32_t data_size;
0383     QXLPHYSICAL prev_chunk;
0384     QXLPHYSICAL next_chunk;
0385     uint8_t data[];
0386 };
0387 
0388 struct qxl_message {
0389     union qxl_release_info release_info;
0390     uint8_t data[];
0391 };
0392 
0393 struct qxl_compat_update_cmd {
0394     union qxl_release_info release_info;
0395     struct qxl_rect area;
0396     uint32_t update_id;
0397 };
0398 
0399 struct qxl_update_cmd {
0400     union qxl_release_info release_info;
0401     struct qxl_rect area;
0402     uint32_t update_id;
0403     uint32_t surface_id;
0404 };
0405 
0406 struct qxl_cursor_header {
0407     uint64_t unique;
0408     uint16_t type;
0409     uint16_t width;
0410     uint16_t height;
0411     uint16_t hot_spot_x;
0412     uint16_t hot_spot_y;
0413 };
0414 
0415 struct qxl_cursor {
0416     struct qxl_cursor_header header;
0417     uint32_t data_size;
0418     struct qxl_data_chunk chunk;
0419 };
0420 
0421 enum {
0422     QXL_CURSOR_SET,
0423     QXL_CURSOR_MOVE,
0424     QXL_CURSOR_HIDE,
0425     QXL_CURSOR_TRAIL,
0426 };
0427 
0428 #define QXL_CURSOR_DEVICE_DATA_SIZE 128
0429 
0430 struct qxl_cursor_cmd {
0431     union qxl_release_info release_info;
0432     uint8_t type;
0433     union {
0434         struct {
0435             struct qxl_point_1_6 position;
0436             uint8_t visible;
0437             QXLPHYSICAL shape;
0438         } set;
0439         struct {
0440             uint16_t length;
0441             uint16_t frequency;
0442         } trail;
0443         struct qxl_point_1_6 position;
0444     } u;
0445     /* todo: dynamic size from rom */
0446     uint8_t device_data[QXL_CURSOR_DEVICE_DATA_SIZE];
0447 };
0448 
0449 enum {
0450     QXL_DRAW_NOP,
0451     QXL_DRAW_FILL,
0452     QXL_DRAW_OPAQUE,
0453     QXL_DRAW_COPY,
0454     QXL_COPY_BITS,
0455     QXL_DRAW_BLEND,
0456     QXL_DRAW_BLACKNESS,
0457     QXL_DRAW_WHITENESS,
0458     QXL_DRAW_INVERS,
0459     QXL_DRAW_ROP3,
0460     QXL_DRAW_STROKE,
0461     QXL_DRAW_TEXT,
0462     QXL_DRAW_TRANSPARENT,
0463     QXL_DRAW_ALPHA_BLEND,
0464     QXL_DRAW_COMPOSITE
0465 };
0466 
0467 struct qxl_raster_glyph {
0468     struct qxl_point render_pos;
0469     struct qxl_point glyph_origin;
0470     uint16_t width;
0471     uint16_t height;
0472     uint8_t data[];
0473 };
0474 
0475 struct qxl_string {
0476     uint32_t data_size;
0477     uint16_t length;
0478     uint16_t flags;
0479     struct qxl_data_chunk chunk;
0480 };
0481 
0482 struct qxl_copy_bits {
0483     struct qxl_point src_pos;
0484 };
0485 
0486 enum qxl_effect_type {
0487     QXL_EFFECT_BLEND = 0,
0488     QXL_EFFECT_OPAQUE = 1,
0489     QXL_EFFECT_REVERT_ON_DUP = 2,
0490     QXL_EFFECT_BLACKNESS_ON_DUP = 3,
0491     QXL_EFFECT_WHITENESS_ON_DUP = 4,
0492     QXL_EFFECT_NOP_ON_DUP = 5,
0493     QXL_EFFECT_NOP = 6,
0494     QXL_EFFECT_OPAQUE_BRUSH = 7
0495 };
0496 
0497 struct qxl_pattern {
0498     QXLPHYSICAL pat;
0499     struct qxl_point pos;
0500 };
0501 
0502 struct qxl_brush {
0503     uint32_t type;
0504     union {
0505         uint32_t color;
0506         struct qxl_pattern pattern;
0507     } u;
0508 };
0509 
0510 struct qxl_q_mask {
0511     uint8_t flags;
0512     struct qxl_point pos;
0513     QXLPHYSICAL bitmap;
0514 };
0515 
0516 struct qxl_fill {
0517     struct qxl_brush brush;
0518     uint16_t rop_descriptor;
0519     struct qxl_q_mask mask;
0520 };
0521 
0522 struct qxl_opaque {
0523     QXLPHYSICAL src_bitmap;
0524     struct qxl_rect src_area;
0525     struct qxl_brush brush;
0526     uint16_t rop_descriptor;
0527     uint8_t scale_mode;
0528     struct qxl_q_mask mask;
0529 };
0530 
0531 struct qxl_copy {
0532     QXLPHYSICAL src_bitmap;
0533     struct qxl_rect src_area;
0534     uint16_t rop_descriptor;
0535     uint8_t scale_mode;
0536     struct qxl_q_mask mask;
0537 };
0538 
0539 struct qxl_transparent {
0540     QXLPHYSICAL src_bitmap;
0541     struct qxl_rect src_area;
0542     uint32_t src_color;
0543     uint32_t true_color;
0544 };
0545 
0546 struct qxl_alpha_blend {
0547     uint16_t alpha_flags;
0548     uint8_t alpha;
0549     QXLPHYSICAL src_bitmap;
0550     struct qxl_rect src_area;
0551 };
0552 
0553 struct qxl_compat_alpha_blend {
0554     uint8_t alpha;
0555     QXLPHYSICAL src_bitmap;
0556     struct qxl_rect src_area;
0557 };
0558 
0559 struct qxl_rop_3 {
0560     QXLPHYSICAL src_bitmap;
0561     struct qxl_rect src_area;
0562     struct qxl_brush brush;
0563     uint8_t rop3;
0564     uint8_t scale_mode;
0565     struct qxl_q_mask mask;
0566 };
0567 
0568 struct qxl_line_attr {
0569     uint8_t flags;
0570     uint8_t join_style;
0571     uint8_t end_style;
0572     uint8_t style_nseg;
0573     QXLFIXED width;
0574     QXLFIXED miter_limit;
0575     QXLPHYSICAL style;
0576 };
0577 
0578 struct qxl_stroke {
0579     QXLPHYSICAL path;
0580     struct qxl_line_attr attr;
0581     struct qxl_brush brush;
0582     uint16_t fore_mode;
0583     uint16_t back_mode;
0584 };
0585 
0586 struct qxl_text {
0587     QXLPHYSICAL str;
0588     struct qxl_rect back_area;
0589     struct qxl_brush fore_brush;
0590     struct qxl_brush back_brush;
0591     uint16_t fore_mode;
0592     uint16_t back_mode;
0593 };
0594 
0595 struct qxl_mask {
0596     struct qxl_q_mask mask;
0597 };
0598 
0599 struct qxl_clip {
0600     uint32_t type;
0601     QXLPHYSICAL data;
0602 };
0603 
0604 enum qxl_operator {
0605     QXL_OP_CLEAR             = 0x00,
0606     QXL_OP_SOURCE            = 0x01,
0607     QXL_OP_DST           = 0x02,
0608     QXL_OP_OVER          = 0x03,
0609     QXL_OP_OVER_REVERSE      = 0x04,
0610     QXL_OP_IN            = 0x05,
0611     QXL_OP_IN_REVERSE        = 0x06,
0612     QXL_OP_OUT           = 0x07,
0613     QXL_OP_OUT_REVERSE       = 0x08,
0614     QXL_OP_ATOP          = 0x09,
0615     QXL_OP_ATOP_REVERSE      = 0x0a,
0616     QXL_OP_XOR           = 0x0b,
0617     QXL_OP_ADD           = 0x0c,
0618     QXL_OP_SATURATE          = 0x0d,
0619     /* Note the jump here from 0x0d to 0x30 */
0620     QXL_OP_MULTIPLY          = 0x30,
0621     QXL_OP_SCREEN            = 0x31,
0622     QXL_OP_OVERLAY           = 0x32,
0623     QXL_OP_DARKEN            = 0x33,
0624     QXL_OP_LIGHTEN           = 0x34,
0625     QXL_OP_COLOR_DODGE       = 0x35,
0626     QXL_OP_COLOR_BURN        = 0x36,
0627     QXL_OP_HARD_LIGHT        = 0x37,
0628     QXL_OP_SOFT_LIGHT        = 0x38,
0629     QXL_OP_DIFFERENCE        = 0x39,
0630     QXL_OP_EXCLUSION         = 0x3a,
0631     QXL_OP_HSL_HUE           = 0x3b,
0632     QXL_OP_HSL_SATURATION        = 0x3c,
0633     QXL_OP_HSL_COLOR         = 0x3d,
0634     QXL_OP_HSL_LUMINOSITY        = 0x3e
0635 };
0636 
0637 struct qxl_transform {
0638     uint32_t    t00;
0639     uint32_t    t01;
0640     uint32_t    t02;
0641     uint32_t    t10;
0642     uint32_t    t11;
0643     uint32_t    t12;
0644 };
0645 
0646 /* The flags field has the following bit fields:
0647  *
0648  *     operator:        [  0 -  7 ]
0649  *     src_filter:      [  8 - 10 ]
0650  *     mask_filter:     [ 11 - 13 ]
0651  *     src_repeat:      [ 14 - 15 ]
0652  *     mask_repeat:     [ 16 - 17 ]
0653  *     component_alpha:     [ 18 - 18 ]
0654  *     reserved:        [ 19 - 31 ]
0655  *
0656  * The repeat and filter values are those of pixman:
0657  *      REPEAT_NONE =       0
0658  *              REPEAT_NORMAL =     1
0659  *      REPEAT_PAD =        2
0660  *      REPEAT_REFLECT =    3
0661  *
0662  * The filter values are:
0663  *      FILTER_NEAREST =    0
0664  *      FILTER_BILINEAR =   1
0665  */
0666 struct qxl_composite {
0667     uint32_t        flags;
0668 
0669     QXLPHYSICAL         src;
0670     QXLPHYSICAL         src_transform;  /* May be NULL */
0671     QXLPHYSICAL         mask;       /* May be NULL */
0672     QXLPHYSICAL         mask_transform; /* May be NULL */
0673     struct qxl_point_1_6    src_origin;
0674     struct qxl_point_1_6    mask_origin;
0675 };
0676 
0677 struct qxl_compat_drawable {
0678     union qxl_release_info release_info;
0679     uint8_t effect;
0680     uint8_t type;
0681     uint16_t bitmap_offset;
0682     struct qxl_rect bitmap_area;
0683     struct qxl_rect bbox;
0684     struct qxl_clip clip;
0685     uint32_t mm_time;
0686     union {
0687         struct qxl_fill fill;
0688         struct qxl_opaque opaque;
0689         struct qxl_copy copy;
0690         struct qxl_transparent transparent;
0691         struct qxl_compat_alpha_blend alpha_blend;
0692         struct qxl_copy_bits copy_bits;
0693         struct qxl_copy blend;
0694         struct qxl_rop_3 rop3;
0695         struct qxl_stroke stroke;
0696         struct qxl_text text;
0697         struct qxl_mask blackness;
0698         struct qxl_mask invers;
0699         struct qxl_mask whiteness;
0700     } u;
0701 };
0702 
0703 struct qxl_drawable {
0704     union qxl_release_info release_info;
0705     uint32_t surface_id;
0706     uint8_t effect;
0707     uint8_t type;
0708     uint8_t self_bitmap;
0709     struct qxl_rect self_bitmap_area;
0710     struct qxl_rect bbox;
0711     struct qxl_clip clip;
0712     uint32_t mm_time;
0713     int32_t surfaces_dest[3];
0714     struct qxl_rect surfaces_rects[3];
0715     union {
0716         struct qxl_fill fill;
0717         struct qxl_opaque opaque;
0718         struct qxl_copy copy;
0719         struct qxl_transparent transparent;
0720         struct qxl_alpha_blend alpha_blend;
0721         struct qxl_copy_bits copy_bits;
0722         struct qxl_copy blend;
0723         struct qxl_rop_3 rop3;
0724         struct qxl_stroke stroke;
0725         struct qxl_text text;
0726         struct qxl_mask blackness;
0727         struct qxl_mask invers;
0728         struct qxl_mask whiteness;
0729         struct qxl_composite composite;
0730     } u;
0731 };
0732 
0733 enum qxl_surface_cmd_type {
0734     QXL_SURFACE_CMD_CREATE,
0735     QXL_SURFACE_CMD_DESTROY,
0736 };
0737 
0738 struct qxl_surface {
0739     uint32_t format;
0740     uint32_t width;
0741     uint32_t height;
0742     int32_t stride;
0743     QXLPHYSICAL data;
0744 };
0745 
0746 struct qxl_surface_cmd {
0747     union qxl_release_info release_info;
0748     uint32_t surface_id;
0749     uint8_t type;
0750     uint32_t flags;
0751     union {
0752         struct qxl_surface surface_create;
0753     } u;
0754 };
0755 
0756 struct qxl_clip_rects {
0757     uint32_t num_rects;
0758     struct qxl_data_chunk chunk;
0759 };
0760 
0761 enum {
0762     QXL_PATH_BEGIN = (1 << 0),
0763     QXL_PATH_END = (1 << 1),
0764     QXL_PATH_CLOSE = (1 << 3),
0765     QXL_PATH_BEZIER = (1 << 4),
0766 };
0767 
0768 struct qxl_path_seg {
0769     uint32_t flags;
0770     uint32_t count;
0771     struct qxl_point_fix points[];
0772 };
0773 
0774 struct qxl_path {
0775     uint32_t data_size;
0776     struct qxl_data_chunk chunk;
0777 };
0778 
0779 enum {
0780     QXL_IMAGE_GROUP_DRIVER,
0781     QXL_IMAGE_GROUP_DEVICE,
0782     QXL_IMAGE_GROUP_RED,
0783     QXL_IMAGE_GROUP_DRIVER_DONT_CACHE,
0784 };
0785 
0786 struct qxl_image_id {
0787     uint32_t group;
0788     uint32_t unique;
0789 };
0790 
0791 union qxl_image_id_union {
0792     struct qxl_image_id id;
0793     uint64_t value;
0794 };
0795 
0796 enum qxl_image_flags {
0797     QXL_IMAGE_CACHE = (1 << 0),
0798     QXL_IMAGE_HIGH_BITS_SET = (1 << 1),
0799 };
0800 
0801 enum qxl_bitmap_flags {
0802     QXL_BITMAP_DIRECT = (1 << 0),
0803     QXL_BITMAP_UNSTABLE = (1 << 1),
0804     QXL_BITMAP_TOP_DOWN = (1 << 2), /* == SPICE_BITMAP_FLAGS_TOP_DOWN */
0805 };
0806 
0807 #define QXL_SET_IMAGE_ID(image, _group, _unique) {              \
0808     (image)->descriptor.id = (((uint64_t)_unique) << 32) | _group;  \
0809 }
0810 
0811 struct qxl_image_descriptor {
0812     uint64_t id;
0813     uint8_t type;
0814     uint8_t flags;
0815     uint32_t width;
0816     uint32_t height;
0817 };
0818 
0819 struct qxl_palette {
0820     uint64_t unique;
0821     uint16_t num_ents;
0822     uint32_t ents[];
0823 };
0824 
0825 struct qxl_bitmap {
0826     uint8_t format;
0827     uint8_t flags;
0828     uint32_t x;
0829     uint32_t y;
0830     uint32_t stride;
0831     QXLPHYSICAL palette;
0832     QXLPHYSICAL data; /* data[0] ? */
0833 };
0834 
0835 struct qxl_surface_id {
0836     uint32_t surface_id;
0837 };
0838 
0839 struct qxl_encoder_data {
0840     uint32_t data_size;
0841     uint8_t data[];
0842 };
0843 
0844 struct qxl_image {
0845     struct qxl_image_descriptor descriptor;
0846     union { /* variable length */
0847         struct qxl_bitmap bitmap;
0848         struct qxl_encoder_data quic;
0849         struct qxl_surface_id surface_image;
0850     } u;
0851 };
0852 
0853 /* A QXLHead is a single monitor output backed by a QXLSurface.
0854  * x and y offsets are unsigned since they are used in relation to
0855  * the given surface, not the same as the x, y coordinates in the guest
0856  * screen reference frame. */
0857 struct qxl_head {
0858     uint32_t id;
0859     uint32_t surface_id;
0860     uint32_t width;
0861     uint32_t height;
0862     uint32_t x;
0863     uint32_t y;
0864     uint32_t flags;
0865 };
0866 
0867 struct qxl_monitors_config {
0868     uint16_t count;
0869     uint16_t max_allowed; /* If it is 0 no fixed limit is given by the
0870                  driver */
0871     struct qxl_head heads[];
0872 };
0873 
0874 #pragma pack(pop)
0875 
0876 #endif /* _H_QXL_DEV */