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