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