1 /* SPDX-License-Identifier: MIT */ 1 2 /********************************************* 3 * displif.h 4 * 5 * Unified display device I/O interface for Xe 6 * 7 * Copyright (C) 2016-2017 EPAM Systems Inc. 8 * 9 * Authors: Oleksandr Andrushchenko <oleksandr 10 * Oleksandr Grytsov <oleksandr_gryts 11 */ 12 13 #ifndef __XEN_PUBLIC_IO_DISPLIF_H__ 14 #define __XEN_PUBLIC_IO_DISPLIF_H__ 15 16 #include "ring.h" 17 #include "../grant_table.h" 18 19 /* 20 ********************************************* 21 * Protocol version 22 ********************************************* 23 */ 24 #define XENDISPL_PROTOCOL_VERSION "2" 25 #define XENDISPL_PROTOCOL_VERSION_INT 2 26 27 /* 28 ********************************************* 29 * Main features provided by 30 ********************************************* 31 * This protocol aims to provide a unified pro 32 * sophisticated use-cases than a framebuffer 33 * moment basic functionality is supported wit 34 * o multiple dynamically allocated/destroyed 35 * o buffers of arbitrary sizes 36 * o buffer allocation at either back or fron 37 * o better configuration options including m 38 * 39 * Note: existing fbif can be used together wi 40 * same time, e.g. on Linux one provides frame 41 * 42 * Note: display resolution (XenStore's "resol 43 * visible area of the virtual display. At the 44 * the display and frame buffers may differ: b 45 * or bigger than the visible area. This is to 46 * may do some post-processing of the display 47 * e.g. those buffers can be just a part of th 48 * 49 ********************************************* 50 * Direction of improve 51 ********************************************* 52 * Future extensions to the existing protocol 53 * o display/connector cloning 54 * o allocation of objects other than display 55 * o plane/overlay support 56 * o scaling support 57 * o rotation support 58 * 59 ********************************************* 60 * Feature and Parameter Nego 61 ********************************************* 62 * 63 * Front->back notifications: when enqueuing a 64 * notification can be made conditional on xen 65 * hold-off mechanism provided by the ring mac 66 * xendispl_req appropriately (e.g., using RIN 67 * 68 * Back->front notifications: when enqueuing a 69 * notification can be made conditional on xen 70 * hold-off mechanism provided by the ring mac 71 * xendispl_resp appropriately (e.g., using RI 72 * 73 * The two halves of a para-virtual display dr 74 * XenStore to communicate capabilities and to 75 * This section enumerates these nodes which r 76 * backend portions of XenStore, following the 77 * 78 * All data in XenStore is stored as strings. 79 * values are encoded in decimal. Integer valu 80 * expressed as fixed sized integer types capa 81 * of a properly formated node string, without 82 * 83 ********************************************* 84 * Example configuratio 85 ********************************************* 86 * 87 * Note: depending on the use-case backend can 88 * than the underlying HW physically has by em 89 * 90 * This is an example of backend and frontend 91 * 92 *--------------------------------- Backend -- 93 * 94 * /local/domain/0/backend/vdispl/1/0/frontend 95 * /local/domain/0/backend/vdispl/1/0/frontend 96 * /local/domain/0/backend/vdispl/1/0/state = 97 * /local/domain/0/backend/vdispl/1/0/versions 98 * 99 *--------------------------------- Frontend - 100 * 101 * /local/domain/1/device/vdispl/0/backend-id 102 * /local/domain/1/device/vdispl/0/backend = " 103 * /local/domain/1/device/vdispl/0/state = "4" 104 * /local/domain/1/device/vdispl/0/version = " 105 * /local/domain/1/device/vdispl/0/be-alloc = 106 * 107 *-------------------------- Connector 0 confi 108 * 109 * /local/domain/1/device/vdispl/0/0/resolutio 110 * /local/domain/1/device/vdispl/0/0/req-ring- 111 * /local/domain/1/device/vdispl/0/0/req-event 112 * /local/domain/1/device/vdispl/0/0/evt-ring- 113 * /local/domain/1/device/vdispl/0/0/evt-event 114 * 115 *-------------------------- Connector 1 confi 116 * 117 * /local/domain/1/device/vdispl/0/1/resolutio 118 * /local/domain/1/device/vdispl/0/1/req-ring- 119 * /local/domain/1/device/vdispl/0/1/req-event 120 * /local/domain/1/device/vdispl/0/1/evt-ring- 121 * /local/domain/1/device/vdispl/0/1/evt-event 122 * 123 ********************************************* 124 * Backend XenBus N 125 ********************************************* 126 * 127 *----------------------------- Protocol versi 128 * 129 * versions 130 * Values: <string> 131 * 132 * List of XENDISPL_LIST_SEPARATOR separa 133 * by the backend. For example "1,2,3". 134 * 135 ********************************************* 136 * Frontend XenBus 137 ********************************************* 138 * 139 *-------------------------------- Addressing 140 * 141 * dom-id 142 * Values: <uint16_t> 143 * 144 * Domain identifier. 145 * 146 * dev-id 147 * Values: <uint16_t> 148 * 149 * Device identifier. 150 * 151 * conn-idx 152 * Values: <uint8_t> 153 * 154 * Zero based contigous index of the conn 155 * /local/domain/<dom-id>/device/vdispl/< 156 * 157 *----------------------------- Protocol versi 158 * 159 * version 160 * Values: <string> 161 * 162 * Protocol version, chosen among the one 163 * 164 *------------------------- Backend buffer all 165 * 166 * be-alloc 167 * Values: "", "1" 168 * 169 * If value is set to "1", then backend c 170 * for this domain during XENDISPL_OP_DBU 171 * for negotiation). 172 * If value is not "1" or omitted fronten 173 * 174 *----------------------------- Connector sett 175 * 176 * unique-id 177 * Values: <string> 178 * 179 * After device instance initialization e 180 * unique ID, so it can be identified by 181 * This can be UUID or such. 182 * 183 * resolution 184 * Values: <width, uint32_t>x<hei 185 * 186 * Width and height of the connector in p 187 * XENDISPL_RESOLUTION_SEPARATOR. This de 188 * display. 189 * If backend provides extended display i 190 * XENDISPL_OP_GET_EDID request then EDID 191 * over the resolutions defined here. 192 * 193 *------------------ Connector Request Transpo 194 * 195 * This communication path is used to deliver 196 * and get the corresponding responses from ba 197 * set up per connector. 198 * 199 * req-event-channel 200 * Values: <uint32_t> 201 * 202 * The identifier of the Xen connector's 203 * used to signal activity in the ring bu 204 * 205 * req-ring-ref 206 * Values: <uint32_t> 207 * 208 * The Xen grant reference granting permi 209 * a sole page of connector's control rin 210 * 211 *------------------- Connector Event Transpor 212 * 213 * This communication path is used to deliver 214 * to frontend, set up per connector. 215 * 216 * evt-event-channel 217 * Values: <uint32_t> 218 * 219 * The identifier of the Xen connector's 220 * used to signal activity in the ring bu 221 * 222 * evt-ring-ref 223 * Values: <uint32_t> 224 * 225 * The Xen grant reference granting permi 226 * a sole page of connector's event ring 227 */ 228 229 /* 230 ********************************************* 231 * STATE DIAGRAM 232 ********************************************* 233 * 234 * Tool stack creates front and back state nod 235 * XenbusStateInitialising. 236 * Tool stack creates and sets up frontend dis 237 * nodes per domain. 238 * 239 *-------------------------------- Normal flow 240 * 241 * Front Back 242 * ================================= ====== 243 * XenbusStateInitialising Xenbus 244 * o Que 245 * dat 246 * o Ope 247 * 248 * 249 * 250 * Xenbus 251 * 252 * o Query frontend configuration 253 * o Allocate and initialize 254 * event channels per configured 255 * connector. 256 * o Publish transport parameters 257 * that will be in effect during 258 * this connection. 259 * | 260 * | 261 * V 262 * XenbusStateInitialised 263 * 264 * o Que 265 * o Con 266 * 267 * 268 * 269 * Xenbus 270 * 271 * o Create and initialize OS 272 * virtual display connectors 273 * as per configuration. 274 * | 275 * | 276 * V 277 * XenbusStateConnected 278 * 279 * Xenbus 280 * Xenbus 281 * Xenbus 282 * o Remove virtual display device 283 * o Remove event channels 284 * | 285 * | 286 * V 287 * XenbusStateClosed 288 * 289 *------------------------------- Recovery flo 290 * 291 * In case of frontend unrecoverable errors ba 292 * if frontend goes into the XenbusStateClosed 293 * 294 * In case of backend unrecoverable errors fro 295 * the virtualized device. If this is possible 296 * then frontend goes into the XenbusStateInit 297 * new connection with backend. If the virtual 298 * cannot be removed, then frontend goes into 299 * until either the virtualized device is remo 300 * connection. On the virtualized device remov 301 * XenbusStateInitialising state. 302 * 303 * Note on XenbusStateReconfiguring state of t 304 * unrecoverable errors then frontend cannot s 305 * and thus cannot provide functionality of th 306 * After backend is back to normal the virtual 307 * state: configuration in use, allocated buff 308 * In most cases, this will require frontend t 309 * reconnect logic. Instead, by going into Xen 310 * frontend will make sure no new clients of t 311 * accepted, allow existing client(s) to exit 312 * state etc. 313 * Once all the clients are gone frontend can 314 * device and get into XenbusStateInitialising 315 * backend that a new connection can be made. 316 * 317 * There are multiple conditions possible unde 318 * XenbusStateReconfiguring into XenbusStateIn 319 * specific. For example: 320 * 1. The underlying OS framework may provide 321 * client of the virtualized device has gon 322 * 2. Frontend can schedule a deferred work (t 323 * to periodically check if this is the rig 324 * the virtualized device. 325 * 3. By any other means. 326 * 327 ********************************************* 328 * REQUEST CODES 329 ********************************************* 330 * Request codes [0; 15] are reserved and must 331 */ 332 333 #define XENDISPL_OP_DBUF_CREATE 0x10 334 #define XENDISPL_OP_DBUF_DESTROY 0x11 335 #define XENDISPL_OP_FB_ATTACH 0x12 336 #define XENDISPL_OP_FB_DETACH 0x13 337 #define XENDISPL_OP_SET_CONFIG 0x14 338 #define XENDISPL_OP_PG_FLIP 0x15 339 /* The below command is available in protocol 340 #define XENDISPL_OP_GET_EDID 0x16 341 342 /* 343 ********************************************* 344 * EVENT CODES 345 ********************************************* 346 */ 347 #define XENDISPL_EVT_PG_FLIP 0x00 348 349 /* 350 ********************************************* 351 * XENSTORE FIELD AND PATH NAME 352 ********************************************* 353 */ 354 #define XENDISPL_DRIVER_NAME "vdisp 355 356 #define XENDISPL_LIST_SEPARATOR "," 357 #define XENDISPL_RESOLUTION_SEPARATOR "x" 358 359 #define XENDISPL_FIELD_BE_VERSIONS "versi 360 #define XENDISPL_FIELD_FE_VERSION "versi 361 #define XENDISPL_FIELD_REQ_RING_REF "req-r 362 #define XENDISPL_FIELD_REQ_CHANNEL "req-e 363 #define XENDISPL_FIELD_EVT_RING_REF "evt-r 364 #define XENDISPL_FIELD_EVT_CHANNEL "evt-e 365 #define XENDISPL_FIELD_RESOLUTION "resol 366 #define XENDISPL_FIELD_BE_ALLOC "be-al 367 #define XENDISPL_FIELD_UNIQUE_ID "uniqu 368 369 #define XENDISPL_EDID_BLOCK_SIZE 128 370 #define XENDISPL_EDID_BLOCK_COUNT 256 371 #define XENDISPL_EDID_MAX_SIZE (XENDI 372 373 /* 374 ********************************************* 375 * STATUS RETURN CODE 376 ********************************************* 377 * 378 * Status return code is zero on success and - 379 * 380 ********************************************* 381 * Assumptions 382 ********************************************* 383 * o usage of grant reference 0 as invalid gra 384 * grant reference 0 is valid, but never exp 385 * because of the fact it is already in use/ 386 * o all references in this document to page s 387 * as pages of size XEN_PAGE_SIZE unless oth 388 * 389 ********************************************* 390 * Description of the protocol between f 391 ********************************************* 392 * 393 * The two halves of a Para-virtual display dr 394 * each other using shared pages and event cha 395 * Shared page contains a ring with request/re 396 * 397 * All reserved fields in the structures below 398 * Display buffers's cookie of value 0 is trea 399 * Framebuffer's cookie of value 0 is treated 400 * 401 * For all request/response/event packets that 402 * dbuf_cookie - uint64_t, unique to guest d 403 * to map remote display buffer to its loc 404 * fb_cookie - uint64_t, unique to guest dom 405 * to map remote framebuffer to its local 406 * 407 *---------------------------------- Requests 408 * 409 * All requests/responses, which are not conne 410 * control ring of the connector which has the 411 * /local/domain/<dom-id>/device/vdispl/<dev 412 * 413 * All request packets have the same length (6 414 * All request packets have common header: 415 * 0 1 416 * +----------------+----------------+-------- 417 * | id | oper 418 * +----------------+----------------+-------- 419 * | reserved 420 * +----------------+----------------+-------- 421 * id - uint16_t, private guest value, echoe 422 * operation - uint8_t, operation code, XEND 423 * 424 * Request dbuf creation - request creation of 425 * 0 1 426 * +----------------+----------------+-------- 427 * | id |_OP_DBUF 428 * +----------------+----------------+-------- 429 * | reserved 430 * +----------------+----------------+-------- 431 * | dbuf_cookie low 32- 432 * +----------------+----------------+-------- 433 * | dbuf_cookie high 32 434 * +----------------+----------------+-------- 435 * | width 436 * +----------------+----------------+-------- 437 * | height 438 * +----------------+----------------+-------- 439 * | bpp 440 * +----------------+----------------+-------- 441 * | buffer_sz 442 * +----------------+----------------+-------- 443 * | flags 444 * +----------------+----------------+-------- 445 * | gref_directory 446 * +----------------+----------------+-------- 447 * | data_ofs 448 * +----------------+----------------+-------- 449 * | reserved 450 * +----------------+----------------+-------- 451 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 452 * +----------------+----------------+-------- 453 * | reserved 454 * +----------------+----------------+-------- 455 * 456 * Must be sent over control ring of the conne 457 * value of 0: 458 * /local/domain/<dom-id>/device/vdispl/<dev 459 * All unused bits in flags field must be set 460 * 461 * An attempt to create multiple display buffe 462 * an error. dbuf_cookie can be re-used after 463 * display buffer. 464 * 465 * Width and height of the display buffers can 466 * than the connector's resolution. Depth/pixe 467 * buffers can differ as well. 468 * 469 * width - uint32_t, width in pixels 470 * height - uint32_t, height in pixels 471 * bpp - uint32_t, bits per pixel 472 * buffer_sz - uint32_t, buffer size to be all 473 * flags - uint32_t, flags of the operation 474 * o XENDISPL_DBUF_FLG_REQ_ALLOC - if set, t 475 * to allocate the buffer with the paramet 476 * Page directory is handled as follows: 477 * Frontend on request: 478 * o allocates pages for the directory 479 * gref_dir_next_page(s) 480 * o grants permissions for the pages 481 * o sets gref_dir_next_page fields 482 * Backend on response: 483 * o grants permissions for the pages 484 * the frontend 485 * o fills in page directory with gran 486 * (gref[] in struct xendispl_page_d 487 * gref_directory - grant_ref_t, a reference t 488 * describing shared buffer references. At l 489 * buffer size (buffer_sz) exceeds what can 490 * then reference to the next page must be s 491 * below) 492 * data_ofs - uint32_t, offset of the data in 493 */ 494 495 #define XENDISPL_DBUF_FLG_REQ_ALLOC (1 << 496 497 struct xendispl_dbuf_create_req { 498 uint64_t dbuf_cookie; 499 uint32_t width; 500 uint32_t height; 501 uint32_t bpp; 502 uint32_t buffer_sz; 503 uint32_t flags; 504 grant_ref_t gref_directory; 505 uint32_t data_ofs; 506 }; 507 508 /* 509 * Shared page for XENDISPL_OP_DBUF_CREATE buf 510 * the request) employs a list of pages, descr 511 * data buffer: 512 * 0 1 513 * +----------------+----------------+-------- 514 * | gref_dir_next_page 515 * +----------------+----------------+-------- 516 * | gref[0] 517 * +----------------+----------------+-------- 518 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 519 * +----------------+----------------+-------- 520 * | gref[i] 521 * +----------------+----------------+-------- 522 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 523 * +----------------+----------------+-------- 524 * | gref[N - 1] 525 * +----------------+----------------+-------- 526 * 527 * gref_dir_next_page - grant_ref_t, reference 528 * page directory. Must be 0 if there are no 529 * gref[i] - grant_ref_t, reference to a share 530 * allocated at XENDISPL_OP_DBUF_CREATE 531 * 532 * Number of grant_ref_t entries in the whole 533 * passed, but instead can be calculated as: 534 * num_grefs_total = (XENDISPL_OP_DBUF_CREAT 535 * XEN_PAGE_SIZE 536 */ 537 538 struct xendispl_page_directory { 539 grant_ref_t gref_dir_next_page; 540 grant_ref_t gref[]; 541 }; 542 543 /* 544 * Request dbuf destruction - destroy a previo 545 * 0 1 546 * +----------------+----------------+-------- 547 * | id |_OP_DBUF 548 * +----------------+----------------+-------- 549 * | reserved 550 * +----------------+----------------+-------- 551 * | dbuf_cookie low 32- 552 * +----------------+----------------+-------- 553 * | dbuf_cookie high 32 554 * +----------------+----------------+-------- 555 * | reserved 556 * +----------------+----------------+-------- 557 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 558 * +----------------+----------------+-------- 559 * | reserved 560 * +----------------+----------------+-------- 561 * 562 * Must be sent over control ring of the conne 563 * value of 0: 564 * /local/domain/<dom-id>/device/vdispl/<dev 565 */ 566 567 struct xendispl_dbuf_destroy_req { 568 uint64_t dbuf_cookie; 569 }; 570 571 /* 572 * Request framebuffer attachment - request at 573 * previously created display buffer. 574 * 0 1 575 * +----------------+----------------+-------- 576 * | id | _OP_FB_ 577 * +----------------+----------------+-------- 578 * | reserved 579 * +----------------+----------------+-------- 580 * | dbuf_cookie low 32- 581 * +----------------+----------------+-------- 582 * | dbuf_cookie high 32 583 * +----------------+----------------+-------- 584 * | fb_cookie low 32-b 585 * +----------------+----------------+-------- 586 * | fb_cookie high 32- 587 * +----------------+----------------+-------- 588 * | width 589 * +----------------+----------------+-------- 590 * | height 591 * +----------------+----------------+-------- 592 * | pixel_format 593 * +----------------+----------------+-------- 594 * | reserved 595 * +----------------+----------------+-------- 596 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 597 * +----------------+----------------+-------- 598 * | reserved 599 * +----------------+----------------+-------- 600 * 601 * Must be sent over control ring of the conne 602 * value of 0: 603 * /local/domain/<dom-id>/device/vdispl/<dev 604 * Width and height can be smaller, equal or b 605 * resolution. 606 * 607 * An attempt to create multiple frame buffers 608 * an error. fb_cookie can be re-used after de 609 * frame buffer. 610 * 611 * width - uint32_t, width in pixels 612 * height - uint32_t, height in pixels 613 * pixel_format - uint32_t, pixel format of th 614 */ 615 616 struct xendispl_fb_attach_req { 617 uint64_t dbuf_cookie; 618 uint64_t fb_cookie; 619 uint32_t width; 620 uint32_t height; 621 uint32_t pixel_format; 622 }; 623 624 /* 625 * Request framebuffer detach - detach a previ 626 * attached framebuffer from the display buffe 627 * 0 1 628 * +----------------+----------------+-------- 629 * | id | _OP_FB 630 * +----------------+----------------+-------- 631 * | reserved 632 * +----------------+----------------+-------- 633 * | fb_cookie low 32-b 634 * +----------------+----------------+-------- 635 * | fb_cookie high 32- 636 * +----------------+----------------+-------- 637 * | reserved 638 * +----------------+----------------+-------- 639 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 640 * +----------------+----------------+-------- 641 * | reserved 642 * +----------------+----------------+-------- 643 * 644 * Must be sent over control ring of the conne 645 * value of 0: 646 * /local/domain/<dom-id>/device/vdispl/<dev 647 */ 648 649 struct xendispl_fb_detach_req { 650 uint64_t fb_cookie; 651 }; 652 653 /* 654 * Request configuration set/reset - request t 655 * the configuration/mode of the display: 656 * 0 1 657 * +----------------+----------------+-------- 658 * | id | _OP_SET 659 * +----------------+----------------+-------- 660 * | reserved 661 * +----------------+----------------+-------- 662 * | fb_cookie low 32-b 663 * +----------------+----------------+-------- 664 * | fb_cookie high 32- 665 * +----------------+----------------+-------- 666 * | x 667 * +----------------+----------------+-------- 668 * | y 669 * +----------------+----------------+-------- 670 * | width 671 * +----------------+----------------+-------- 672 * | height 673 * +----------------+----------------+-------- 674 * | bpp 675 * +----------------+----------------+-------- 676 * | reserved 677 * +----------------+----------------+-------- 678 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 679 * +----------------+----------------+-------- 680 * | reserved 681 * +----------------+----------------+-------- 682 * 683 * Pass all zeros to reset, otherwise command 684 * configuration set. 685 * Framebuffer's cookie defines which framebuf 686 * displayed while enabling display (applying 687 * x, y, width and height are bound by the con 688 * exceed it. 689 * 690 * x - uint32_t, starting position in pixels b 691 * y - uint32_t, starting position in pixels b 692 * width - uint32_t, width in pixels 693 * height - uint32_t, height in pixels 694 * bpp - uint32_t, bits per pixel 695 */ 696 697 struct xendispl_set_config_req { 698 uint64_t fb_cookie; 699 uint32_t x; 700 uint32_t y; 701 uint32_t width; 702 uint32_t height; 703 uint32_t bpp; 704 }; 705 706 /* 707 * Request page flip - request to flip a page 708 * cookie: 709 * 0 1 710 * +----------------+----------------+-------- 711 * | id | _OP_PG_ 712 * +----------------+----------------+-------- 713 * | reserved 714 * +----------------+----------------+-------- 715 * | fb_cookie low 32-b 716 * +----------------+----------------+-------- 717 * | fb_cookie high 32- 718 * +----------------+----------------+-------- 719 * | reserved 720 * +----------------+----------------+-------- 721 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 722 * +----------------+----------------+-------- 723 * | reserved 724 * +----------------+----------------+-------- 725 */ 726 727 struct xendispl_page_flip_req { 728 uint64_t fb_cookie; 729 }; 730 731 /* 732 * Request EDID - request EDID describing curr 733 * 0 1 734 * +----------------+----------------+-------- 735 * | id | _OP_GET 736 * +----------------+----------------+-------- 737 * | buffer_sz 738 * +----------------+----------------+-------- 739 * | gref_directory 740 * +----------------+----------------+-------- 741 * | reserved 742 * +----------------+----------------+-------- 743 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 744 * +----------------+----------------+-------- 745 * | reserved 746 * +----------------+----------------+-------- 747 * 748 * Notes: 749 * - This command is not available in protoc 750 * ignored. 751 * - This request is optional and if not sup 752 * is defined by the relevant XenStore's " 753 * - Shared buffer, allocated for EDID stora 754 * XENDISPL_EDID_MAX_SIZE octets. 755 * 756 * buffer_sz - uint32_t, buffer size to be all 757 * gref_directory - grant_ref_t, a reference t 758 * describing EDID buffer references. See XE 759 * grant page directory structure (struct xe 760 * 761 * See response format for this request. 762 */ 763 764 struct xendispl_get_edid_req { 765 uint32_t buffer_sz; 766 grant_ref_t gref_directory; 767 }; 768 769 /* 770 *---------------------------------- Responses 771 * 772 * All response packets have the same length ( 773 * 774 * All response packets have common header: 775 * 0 1 776 * +----------------+----------------+-------- 777 * | id | 778 * +----------------+----------------+-------- 779 * | status 780 * +----------------+----------------+-------- 781 * | reserved 782 * +----------------+----------------+-------- 783 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 784 * +----------------+----------------+-------- 785 * | reserved 786 * +----------------+----------------+-------- 787 * 788 * id - uint16_t, private guest value, echoed 789 * status - int32_t, response status, zero on 790 * 791 * 792 * Get EDID response - response for XENDISPL_O 793 * 0 1 794 * +----------------+----------------+-------- 795 * | id | oper 796 * +----------------+----------------+-------- 797 * | status 798 * +----------------+----------------+-------- 799 * | edid_sz 800 * +----------------+----------------+-------- 801 * | reserved 802 * +----------------+----------------+-------- 803 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 804 * +----------------+----------------+-------- 805 * | reserved 806 * +----------------+----------------+-------- 807 * 808 * Notes: 809 * - This response is not available in proto 810 * ignored. 811 * 812 * edid_sz - uint32_t, size of the EDID, octet 813 */ 814 815 struct xendispl_get_edid_resp { 816 uint32_t edid_sz; 817 }; 818 819 /* 820 *----------------------------------- Events - 821 * 822 * Events are sent via a shared page allocated 823 * evt-event-channel/evt-ring-ref XenStore e 824 * All event packets have the same length (64 825 * All event packets have common header: 826 * 0 1 827 * +----------------+----------------+-------- 828 * | id | ty 829 * +----------------+----------------+-------- 830 * | reserved 831 * +----------------+----------------+-------- 832 * 833 * id - uint16_t, event id, may be used by fro 834 * type - uint8_t, type of the event 835 * 836 * 837 * Page flip complete event - event from back 838 * 0 1 839 * +----------------+----------------+-------- 840 * | id | _EVT_ 841 * +----------------+----------------+-------- 842 * | reserved 843 * +----------------+----------------+-------- 844 * | fb_cookie low 32-b 845 * +----------------+----------------+-------- 846 * | fb_cookie high 32- 847 * +----------------+----------------+-------- 848 * | reserved 849 * +----------------+----------------+-------- 850 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 851 * +----------------+----------------+-------- 852 * | reserved 853 * +----------------+----------------+-------- 854 */ 855 856 struct xendispl_pg_flip_evt { 857 uint64_t fb_cookie; 858 }; 859 860 struct xendispl_req { 861 uint16_t id; 862 uint8_t operation; 863 uint8_t reserved[5]; 864 union { 865 struct xendispl_dbuf_create_re 866 struct xendispl_dbuf_destroy_r 867 struct xendispl_fb_attach_req 868 struct xendispl_fb_detach_req 869 struct xendispl_set_config_req 870 struct xendispl_page_flip_req 871 struct xendispl_get_edid_req g 872 uint8_t reserved[56]; 873 } op; 874 }; 875 876 struct xendispl_resp { 877 uint16_t id; 878 uint8_t operation; 879 uint8_t reserved; 880 int32_t status; 881 union { 882 struct xendispl_get_edid_resp 883 uint8_t reserved1[56]; 884 } op; 885 }; 886 887 struct xendispl_evt { 888 uint16_t id; 889 uint8_t type; 890 uint8_t reserved[5]; 891 union { 892 struct xendispl_pg_flip_evt pg 893 uint8_t reserved[56]; 894 } op; 895 }; 896 897 DEFINE_RING_TYPES(xen_displif, struct xendispl 898 899 /* 900 ********************************************* 901 * Back to front events 902 ********************************************* 903 * In order to deliver asynchronous events fro 904 * allocated by front and its granted referenc 905 * XenStore entries (evt-ring-ref/evt-event-ch 906 * This page has a common header used by both 907 * access and control event's ring buffer, whi 908 * events and front being a consumer. The rest 909 * is used for event packets. 910 * 911 * Upon reception of an event(s) front may con 912 * for either each event, group of events or n 913 */ 914 915 struct xendispl_event_page { 916 uint32_t in_cons; 917 uint32_t in_prod; 918 uint8_t reserved[56]; 919 }; 920 921 #define XENDISPL_EVENT_PAGE_SIZE XEN_PAGE_SIZE 922 #define XENDISPL_IN_RING_OFFS (sizeof(struct x 923 #define XENDISPL_IN_RING_SIZE (XENDISPL_EVENT_ 924 #define XENDISPL_IN_RING_LEN (XENDISPL_IN_RING 925 #define XENDISPL_IN_RING(page) \ 926 ((struct xendispl_evt *)((char *)(page 927 #define XENDISPL_IN_RING_REF(page, idx) \ 928 (XENDISPL_IN_RING((page))[(idx) % XEND 929 930 #endif /* __XEN_PUBLIC_IO_DISPLIF_H__ */ 931
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.