1 /* SPDX-License-Identifier: MIT */
2 /******************************************************************************
5 * Unified display device I/O interface for Xen guest OSes.
7 * Copyright (C) 2016-2017 EPAM Systems Inc.
9 * Authors: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
10 * Oleksandr Grytsov <oleksandr_grytsov@epam.com>
13 #ifndef __XEN_PUBLIC_IO_DISPLIF_H__
14 #define __XEN_PUBLIC_IO_DISPLIF_H__
17 #include "../grant_table.h"
20 ******************************************************************************
22 ******************************************************************************
24 #define XENDISPL_PROTOCOL_VERSION "2"
25 #define XENDISPL_PROTOCOL_VERSION_INT 2
28 ******************************************************************************
29 * Main features provided by the protocol
30 ******************************************************************************
31 * This protocol aims to provide a unified protocol which fits more
32 * sophisticated use-cases than a framebuffer device can handle. At the
33 * moment basic functionality is supported with the intention to be extended:
34 * o multiple dynamically allocated/destroyed framebuffers
35 * o buffers of arbitrary sizes
36 * o buffer allocation at either back or front end
37 * o better configuration options including multiple display support
39 * Note: existing fbif can be used together with displif running at the
40 * same time, e.g. on Linux one provides framebuffer and another DRM/KMS
42 * Note: display resolution (XenStore's "resolution" property) defines
43 * visible area of the virtual display. At the same time resolution of
44 * the display and frame buffers may differ: buffers can be smaller, equal
45 * or bigger than the visible area. This is to enable use-cases, where backend
46 * may do some post-processing of the display and frame buffers supplied,
47 * e.g. those buffers can be just a part of the final composition.
49 ******************************************************************************
50 * Direction of improvements
51 ******************************************************************************
52 * Future extensions to the existing protocol may include:
53 * o display/connector cloning
54 * o allocation of objects other than display buffers
55 * o plane/overlay support
59 ******************************************************************************
60 * Feature and Parameter Negotiation
61 ******************************************************************************
63 * Front->back notifications: when enqueuing a new request, sending a
64 * notification can be made conditional on xendispl_req (i.e., the generic
65 * hold-off mechanism provided by the ring macros). Backends must set
66 * xendispl_req appropriately (e.g., using RING_FINAL_CHECK_FOR_REQUESTS()).
68 * Back->front notifications: when enqueuing a new response, sending a
69 * notification can be made conditional on xendispl_resp (i.e., the generic
70 * hold-off mechanism provided by the ring macros). Frontends must set
71 * xendispl_resp appropriately (e.g., using RING_FINAL_CHECK_FOR_RESPONSES()).
73 * The two halves of a para-virtual display driver utilize nodes within
74 * XenStore to communicate capabilities and to negotiate operating parameters.
75 * This section enumerates these nodes which reside in the respective front and
76 * backend portions of XenStore, following the XenBus convention.
78 * All data in XenStore is stored as strings. Nodes specifying numeric
79 * values are encoded in decimal. Integer value ranges listed below are
80 * expressed as fixed sized integer types capable of storing the conversion
81 * of a properly formated node string, without loss of information.
83 ******************************************************************************
84 * Example configuration
85 ******************************************************************************
87 * Note: depending on the use-case backend can expose more display connectors
88 * than the underlying HW physically has by employing SW graphics compositors
90 * This is an example of backend and frontend configuration:
92 *--------------------------------- Backend -----------------------------------
94 * /local/domain/0/backend/vdispl/1/0/frontend-id = "1"
95 * /local/domain/0/backend/vdispl/1/0/frontend = "/local/domain/1/device/vdispl/0"
96 * /local/domain/0/backend/vdispl/1/0/state = "4"
97 * /local/domain/0/backend/vdispl/1/0/versions = "1,2"
99 *--------------------------------- Frontend ----------------------------------
101 * /local/domain/1/device/vdispl/0/backend-id = "0"
102 * /local/domain/1/device/vdispl/0/backend = "/local/domain/0/backend/vdispl/1/0"
103 * /local/domain/1/device/vdispl/0/state = "4"
104 * /local/domain/1/device/vdispl/0/version = "1"
105 * /local/domain/1/device/vdispl/0/be-alloc = "1"
107 *-------------------------- Connector 0 configuration ------------------------
109 * /local/domain/1/device/vdispl/0/0/resolution = "1920x1080"
110 * /local/domain/1/device/vdispl/0/0/req-ring-ref = "2832"
111 * /local/domain/1/device/vdispl/0/0/req-event-channel = "15"
112 * /local/domain/1/device/vdispl/0/0/evt-ring-ref = "387"
113 * /local/domain/1/device/vdispl/0/0/evt-event-channel = "16"
115 *-------------------------- Connector 1 configuration ------------------------
117 * /local/domain/1/device/vdispl/0/1/resolution = "800x600"
118 * /local/domain/1/device/vdispl/0/1/req-ring-ref = "2833"
119 * /local/domain/1/device/vdispl/0/1/req-event-channel = "17"
120 * /local/domain/1/device/vdispl/0/1/evt-ring-ref = "388"
121 * /local/domain/1/device/vdispl/0/1/evt-event-channel = "18"
123 ******************************************************************************
124 * Backend XenBus Nodes
125 ******************************************************************************
127 *----------------------------- Protocol version ------------------------------
132 * List of XENDISPL_LIST_SEPARATOR separated protocol versions supported
133 * by the backend. For example "1,2,3".
135 ******************************************************************************
136 * Frontend XenBus Nodes
137 ******************************************************************************
139 *-------------------------------- Addressing ---------------------------------
154 * Zero based contigous index of the connector.
155 * /local/domain/<dom-id>/device/vdispl/<dev-id>/<conn-idx>/...
157 *----------------------------- Protocol version ------------------------------
162 * Protocol version, chosen among the ones supported by the backend.
164 *------------------------- Backend buffer allocation -------------------------
169 * If value is set to "1", then backend can be a buffer provider/allocator
170 * for this domain during XENDISPL_OP_DBUF_CREATE operation (see below
172 * If value is not "1" or omitted frontend must allocate buffers itself.
174 *----------------------------- Connector settings ----------------------------
179 * After device instance initialization each connector is assigned a
180 * unique ID, so it can be identified by the backend by this ID.
181 * This can be UUID or such.
184 * Values: <width, uint32_t>x<height, uint32_t>
186 * Width and height of the connector in pixels separated by
187 * XENDISPL_RESOLUTION_SEPARATOR. This defines visible area of the
189 * If backend provides extended display identification data (EDID) with
190 * XENDISPL_OP_GET_EDID request then EDID values must take precedence
191 * over the resolutions defined here.
193 *------------------ Connector Request Transport Parameters -------------------
195 * This communication path is used to deliver requests from frontend to backend
196 * and get the corresponding responses from backend to frontend,
197 * set up per connector.
202 * The identifier of the Xen connector's control event channel
203 * used to signal activity in the ring buffer.
208 * The Xen grant reference granting permission for the backend to map
209 * a sole page of connector's control ring buffer.
211 *------------------- Connector Event Transport Parameters --------------------
213 * This communication path is used to deliver asynchronous events from backend
214 * to frontend, set up per connector.
219 * The identifier of the Xen connector's event channel
220 * used to signal activity in the ring buffer.
225 * The Xen grant reference granting permission for the backend to map
226 * a sole page of connector's event ring buffer.
230 ******************************************************************************
232 ******************************************************************************
234 * Tool stack creates front and back state nodes with initial state
235 * XenbusStateInitialising.
236 * Tool stack creates and sets up frontend display configuration
239 *-------------------------------- Normal flow --------------------------------
242 * ================================= =====================================
243 * XenbusStateInitialising XenbusStateInitialising
244 * o Query backend device identification
246 * o Open and validate backend device.
250 * XenbusStateInitWait
252 * o Query frontend configuration
253 * o Allocate and initialize
254 * event channels per configured
256 * o Publish transport parameters
257 * that will be in effect during
262 * XenbusStateInitialised
264 * o Query frontend transport parameters.
265 * o Connect to the event channels.
269 * XenbusStateConnected
271 * o Create and initialize OS
272 * virtual display connectors
273 * as per configuration.
277 * XenbusStateConnected
282 * o Remove virtual display device
283 * o Remove event channels
289 *------------------------------- Recovery flow -------------------------------
291 * In case of frontend unrecoverable errors backend handles that as
292 * if frontend goes into the XenbusStateClosed state.
294 * In case of backend unrecoverable errors frontend tries removing
295 * the virtualized device. If this is possible at the moment of error,
296 * then frontend goes into the XenbusStateInitialising state and is ready for
297 * new connection with backend. If the virtualized device is still in use and
298 * cannot be removed, then frontend goes into the XenbusStateReconfiguring state
299 * until either the virtualized device is removed or backend initiates a new
300 * connection. On the virtualized device removal frontend goes into the
301 * XenbusStateInitialising state.
303 * Note on XenbusStateReconfiguring state of the frontend: if backend has
304 * unrecoverable errors then frontend cannot send requests to the backend
305 * and thus cannot provide functionality of the virtualized device anymore.
306 * After backend is back to normal the virtualized device may still hold some
307 * state: configuration in use, allocated buffers, client application state etc.
308 * In most cases, this will require frontend to implement complex recovery
309 * reconnect logic. Instead, by going into XenbusStateReconfiguring state,
310 * frontend will make sure no new clients of the virtualized device are
311 * accepted, allow existing client(s) to exit gracefully by signaling error
313 * Once all the clients are gone frontend can reinitialize the virtualized
314 * device and get into XenbusStateInitialising state again signaling the
315 * backend that a new connection can be made.
317 * There are multiple conditions possible under which frontend will go from
318 * XenbusStateReconfiguring into XenbusStateInitialising, some of them are OS
319 * specific. For example:
320 * 1. The underlying OS framework may provide callbacks to signal that the last
321 * client of the virtualized device has gone and the device can be removed
322 * 2. Frontend can schedule a deferred work (timer/tasklet/workqueue)
323 * to periodically check if this is the right time to re-try removal of
324 * the virtualized device.
325 * 3. By any other means.
327 ******************************************************************************
329 ******************************************************************************
330 * Request codes [0; 15] are reserved and must not be used
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 version 2 and above. */
340 #define XENDISPL_OP_GET_EDID 0x16
343 ******************************************************************************
345 ******************************************************************************
347 #define XENDISPL_EVT_PG_FLIP 0x00
350 ******************************************************************************
351 * XENSTORE FIELD AND PATH NAME STRINGS, HELPERS
352 ******************************************************************************
354 #define XENDISPL_DRIVER_NAME "vdispl"
356 #define XENDISPL_LIST_SEPARATOR ","
357 #define XENDISPL_RESOLUTION_SEPARATOR "x"
359 #define XENDISPL_FIELD_BE_VERSIONS "versions"
360 #define XENDISPL_FIELD_FE_VERSION "version"
361 #define XENDISPL_FIELD_REQ_RING_REF "req-ring-ref"
362 #define XENDISPL_FIELD_REQ_CHANNEL "req-event-channel"
363 #define XENDISPL_FIELD_EVT_RING_REF "evt-ring-ref"
364 #define XENDISPL_FIELD_EVT_CHANNEL "evt-event-channel"
365 #define XENDISPL_FIELD_RESOLUTION "resolution"
366 #define XENDISPL_FIELD_BE_ALLOC "be-alloc"
367 #define XENDISPL_FIELD_UNIQUE_ID "unique-id"
369 #define XENDISPL_EDID_BLOCK_SIZE 128
370 #define XENDISPL_EDID_BLOCK_COUNT 256
371 #define XENDISPL_EDID_MAX_SIZE (XENDISPL_EDID_BLOCK_SIZE * XENDISPL_EDID_BLOCK_COUNT)
374 ******************************************************************************
375 * STATUS RETURN CODES
376 ******************************************************************************
378 * Status return code is zero on success and -XEN_EXX on failure.
380 ******************************************************************************
382 ******************************************************************************
383 * o usage of grant reference 0 as invalid grant reference:
384 * grant reference 0 is valid, but never exposed to a PV driver,
385 * because of the fact it is already in use/reserved by the PV console.
386 * o all references in this document to page sizes must be treated
387 * as pages of size XEN_PAGE_SIZE unless otherwise noted.
389 ******************************************************************************
390 * Description of the protocol between frontend and backend driver
391 ******************************************************************************
393 * The two halves of a Para-virtual display driver communicate with
394 * each other using shared pages and event channels.
395 * Shared page contains a ring with request/response packets.
397 * All reserved fields in the structures below must be 0.
398 * Display buffers's cookie of value 0 is treated as invalid.
399 * Framebuffer's cookie of value 0 is treated as invalid.
401 * For all request/response/event packets that use cookies:
402 * dbuf_cookie - uint64_t, unique to guest domain value used by the backend
403 * to map remote display buffer to its local one
404 * fb_cookie - uint64_t, unique to guest domain value used by the backend
405 * to map remote framebuffer to its local one
407 *---------------------------------- Requests ---------------------------------
409 * All requests/responses, which are not connector specific, must be sent over
410 * control ring of the connector which has the index value of 0:
411 * /local/domain/<dom-id>/device/vdispl/<dev-id>/0/req-ring-ref
413 * All request packets have the same length (64 octets)
414 * All request packets have common header:
416 * +----------------+----------------+----------------+----------------+
417 * | id | operation | reserved | 4
418 * +----------------+----------------+----------------+----------------+
420 * +----------------+----------------+----------------+----------------+
421 * id - uint16_t, private guest value, echoed in response
422 * operation - uint8_t, operation code, XENDISPL_OP_???
424 * Request dbuf creation - request creation of a display buffer.
426 * +----------------+----------------+----------------+----------------+
427 * | id |_OP_DBUF_CREATE | reserved | 4
428 * +----------------+----------------+----------------+----------------+
430 * +----------------+----------------+----------------+----------------+
431 * | dbuf_cookie low 32-bit | 12
432 * +----------------+----------------+----------------+----------------+
433 * | dbuf_cookie high 32-bit | 16
434 * +----------------+----------------+----------------+----------------+
436 * +----------------+----------------+----------------+----------------+
438 * +----------------+----------------+----------------+----------------+
440 * +----------------+----------------+----------------+----------------+
442 * +----------------+----------------+----------------+----------------+
444 * +----------------+----------------+----------------+----------------+
445 * | gref_directory | 40
446 * +----------------+----------------+----------------+----------------+
448 * +----------------+----------------+----------------+----------------+
450 * +----------------+----------------+----------------+----------------+
451 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
452 * +----------------+----------------+----------------+----------------+
454 * +----------------+----------------+----------------+----------------+
456 * Must be sent over control ring of the connector which has the index
458 * /local/domain/<dom-id>/device/vdispl/<dev-id>/0/req-ring-ref
459 * All unused bits in flags field must be set to 0.
461 * An attempt to create multiple display buffers with the same dbuf_cookie is
462 * an error. dbuf_cookie can be re-used after destroying the corresponding
465 * Width and height of the display buffers can be smaller, equal or bigger
466 * than the connector's resolution. Depth/pixel format of the individual
467 * buffers can differ as well.
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 allocated, octets
473 * flags - uint32_t, flags of the operation
474 * o XENDISPL_DBUF_FLG_REQ_ALLOC - if set, then backend is requested
475 * to allocate the buffer with the parameters provided in this request.
476 * Page directory is handled as follows:
477 * Frontend on request:
478 * o allocates pages for the directory (gref_directory,
479 * gref_dir_next_page(s)
480 * o grants permissions for the pages of the directory to the backend
481 * o sets gref_dir_next_page fields
482 * Backend on response:
483 * o grants permissions for the pages of the buffer allocated to
485 * o fills in page directory with grant references
486 * (gref[] in struct xendispl_page_directory)
487 * gref_directory - grant_ref_t, a reference to the first shared page
488 * describing shared buffer references. At least one page exists. If shared
489 * buffer size (buffer_sz) exceeds what can be addressed by this single page,
490 * then reference to the next page must be supplied (see gref_dir_next_page
492 * data_ofs - uint32_t, offset of the data in the buffer, octets
495 #define XENDISPL_DBUF_FLG_REQ_ALLOC (1 << 0)
497 struct xendispl_dbuf_create_req {
498 uint64_t dbuf_cookie;
504 grant_ref_t gref_directory;
509 * Shared page for XENDISPL_OP_DBUF_CREATE buffer descriptor (gref_directory in
510 * the request) employs a list of pages, describing all pages of the shared
513 * +----------------+----------------+----------------+----------------+
514 * | gref_dir_next_page | 4
515 * +----------------+----------------+----------------+----------------+
517 * +----------------+----------------+----------------+----------------+
518 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
519 * +----------------+----------------+----------------+----------------+
521 * +----------------+----------------+----------------+----------------+
522 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
523 * +----------------+----------------+----------------+----------------+
524 * | gref[N - 1] | N*4+8
525 * +----------------+----------------+----------------+----------------+
527 * gref_dir_next_page - grant_ref_t, reference to the next page describing
528 * page directory. Must be 0 if there are no more pages in the list.
529 * gref[i] - grant_ref_t, reference to a shared page of the buffer
530 * allocated at XENDISPL_OP_DBUF_CREATE
532 * Number of grant_ref_t entries in the whole page directory is not
533 * passed, but instead can be calculated as:
534 * num_grefs_total = (XENDISPL_OP_DBUF_CREATE.buffer_sz + XEN_PAGE_SIZE - 1) /
538 struct xendispl_page_directory {
539 grant_ref_t gref_dir_next_page;
540 grant_ref_t gref[1]; /* Variable length */
544 * Request dbuf destruction - destroy a previously allocated display buffer:
546 * +----------------+----------------+----------------+----------------+
547 * | id |_OP_DBUF_DESTROY| reserved | 4
548 * +----------------+----------------+----------------+----------------+
550 * +----------------+----------------+----------------+----------------+
551 * | dbuf_cookie low 32-bit | 12
552 * +----------------+----------------+----------------+----------------+
553 * | dbuf_cookie high 32-bit | 16
554 * +----------------+----------------+----------------+----------------+
556 * +----------------+----------------+----------------+----------------+
557 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
558 * +----------------+----------------+----------------+----------------+
560 * +----------------+----------------+----------------+----------------+
562 * Must be sent over control ring of the connector which has the index
564 * /local/domain/<dom-id>/device/vdispl/<dev-id>/0/req-ring-ref
567 struct xendispl_dbuf_destroy_req {
568 uint64_t dbuf_cookie;
572 * Request framebuffer attachment - request attachment of a framebuffer to
573 * previously created display buffer.
575 * +----------------+----------------+----------------+----------------+
576 * | id | _OP_FB_ATTACH | reserved | 4
577 * +----------------+----------------+----------------+----------------+
579 * +----------------+----------------+----------------+----------------+
580 * | dbuf_cookie low 32-bit | 12
581 * +----------------+----------------+----------------+----------------+
582 * | dbuf_cookie high 32-bit | 16
583 * +----------------+----------------+----------------+----------------+
584 * | fb_cookie low 32-bit | 20
585 * +----------------+----------------+----------------+----------------+
586 * | fb_cookie high 32-bit | 24
587 * +----------------+----------------+----------------+----------------+
589 * +----------------+----------------+----------------+----------------+
591 * +----------------+----------------+----------------+----------------+
592 * | pixel_format | 36
593 * +----------------+----------------+----------------+----------------+
595 * +----------------+----------------+----------------+----------------+
596 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
597 * +----------------+----------------+----------------+----------------+
599 * +----------------+----------------+----------------+----------------+
601 * Must be sent over control ring of the connector which has the index
603 * /local/domain/<dom-id>/device/vdispl/<dev-id>/0/req-ring-ref
604 * Width and height can be smaller, equal or bigger than the connector's
607 * An attempt to create multiple frame buffers with the same fb_cookie is
608 * an error. fb_cookie can be re-used after destroying the corresponding
611 * width - uint32_t, width in pixels
612 * height - uint32_t, height in pixels
613 * pixel_format - uint32_t, pixel format of the framebuffer, FOURCC code
616 struct xendispl_fb_attach_req {
617 uint64_t dbuf_cookie;
621 uint32_t pixel_format;
625 * Request framebuffer detach - detach a previously
626 * attached framebuffer from the display buffer in request:
628 * +----------------+----------------+----------------+----------------+
629 * | id | _OP_FB_DETACH | reserved | 4
630 * +----------------+----------------+----------------+----------------+
632 * +----------------+----------------+----------------+----------------+
633 * | fb_cookie low 32-bit | 12
634 * +----------------+----------------+----------------+----------------+
635 * | fb_cookie high 32-bit | 16
636 * +----------------+----------------+----------------+----------------+
638 * +----------------+----------------+----------------+----------------+
639 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
640 * +----------------+----------------+----------------+----------------+
642 * +----------------+----------------+----------------+----------------+
644 * Must be sent over control ring of the connector which has the index
646 * /local/domain/<dom-id>/device/vdispl/<dev-id>/0/req-ring-ref
649 struct xendispl_fb_detach_req {
654 * Request configuration set/reset - request to set or reset
655 * the configuration/mode of the display:
657 * +----------------+----------------+----------------+----------------+
658 * | id | _OP_SET_CONFIG | reserved | 4
659 * +----------------+----------------+----------------+----------------+
661 * +----------------+----------------+----------------+----------------+
662 * | fb_cookie low 32-bit | 12
663 * +----------------+----------------+----------------+----------------+
664 * | fb_cookie high 32-bit | 16
665 * +----------------+----------------+----------------+----------------+
667 * +----------------+----------------+----------------+----------------+
669 * +----------------+----------------+----------------+----------------+
671 * +----------------+----------------+----------------+----------------+
673 * +----------------+----------------+----------------+----------------+
675 * +----------------+----------------+----------------+----------------+
677 * +----------------+----------------+----------------+----------------+
678 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
679 * +----------------+----------------+----------------+----------------+
681 * +----------------+----------------+----------------+----------------+
683 * Pass all zeros to reset, otherwise command is treated as
685 * Framebuffer's cookie defines which framebuffer/dbuf must be
686 * displayed while enabling display (applying configuration).
687 * x, y, width and height are bound by the connector's resolution and must not
690 * x - uint32_t, starting position in pixels by X axis
691 * y - uint32_t, starting position in pixels by Y axis
692 * width - uint32_t, width in pixels
693 * height - uint32_t, height in pixels
694 * bpp - uint32_t, bits per pixel
697 struct xendispl_set_config_req {
707 * Request page flip - request to flip a page identified by the framebuffer
710 * +----------------+----------------+----------------+----------------+
711 * | id | _OP_PG_FLIP | reserved | 4
712 * +----------------+----------------+----------------+----------------+
714 * +----------------+----------------+----------------+----------------+
715 * | fb_cookie low 32-bit | 12
716 * +----------------+----------------+----------------+----------------+
717 * | fb_cookie high 32-bit | 16
718 * +----------------+----------------+----------------+----------------+
720 * +----------------+----------------+----------------+----------------+
721 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
722 * +----------------+----------------+----------------+----------------+
724 * +----------------+----------------+----------------+----------------+
727 struct xendispl_page_flip_req {
732 * Request EDID - request EDID describing current connector:
734 * +----------------+----------------+----------------+----------------+
735 * | id | _OP_GET_EDID | reserved | 4
736 * +----------------+----------------+----------------+----------------+
738 * +----------------+----------------+----------------+----------------+
739 * | gref_directory | 12
740 * +----------------+----------------+----------------+----------------+
742 * +----------------+----------------+----------------+----------------+
743 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
744 * +----------------+----------------+----------------+----------------+
746 * +----------------+----------------+----------------+----------------+
749 * - This command is not available in protocol version 1 and should be
751 * - This request is optional and if not supported then visible area
752 * is defined by the relevant XenStore's "resolution" property.
753 * - Shared buffer, allocated for EDID storage, must not be less then
754 * XENDISPL_EDID_MAX_SIZE octets.
756 * buffer_sz - uint32_t, buffer size to be allocated, octets
757 * gref_directory - grant_ref_t, a reference to the first shared page
758 * describing EDID buffer references. See XENDISPL_OP_DBUF_CREATE for
759 * grant page directory structure (struct xendispl_page_directory).
761 * See response format for this request.
764 struct xendispl_get_edid_req {
766 grant_ref_t gref_directory;
770 *---------------------------------- Responses --------------------------------
772 * All response packets have the same length (64 octets)
774 * All response packets have common header:
776 * +----------------+----------------+----------------+----------------+
777 * | id | reserved | 4
778 * +----------------+----------------+----------------+----------------+
780 * +----------------+----------------+----------------+----------------+
782 * +----------------+----------------+----------------+----------------+
783 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
784 * +----------------+----------------+----------------+----------------+
786 * +----------------+----------------+----------------+----------------+
788 * id - uint16_t, private guest value, echoed from request
789 * status - int32_t, response status, zero on success and -XEN_EXX on failure
792 * Get EDID response - response for XENDISPL_OP_GET_EDID:
794 * +----------------+----------------+----------------+----------------+
795 * | id | operation | reserved | 4
796 * +----------------+----------------+----------------+----------------+
798 * +----------------+----------------+----------------+----------------+
800 * +----------------+----------------+----------------+----------------+
802 * +----------------+----------------+----------------+----------------+
803 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
804 * +----------------+----------------+----------------+----------------+
806 * +----------------+----------------+----------------+----------------+
809 * - This response is not available in protocol version 1 and should be
812 * edid_sz - uint32_t, size of the EDID, octets
815 struct xendispl_get_edid_resp {
820 *----------------------------------- Events ----------------------------------
822 * Events are sent via a shared page allocated by the front and propagated by
823 * evt-event-channel/evt-ring-ref XenStore entries
824 * All event packets have the same length (64 octets)
825 * All event packets have common header:
827 * +----------------+----------------+----------------+----------------+
828 * | id | type | reserved | 4
829 * +----------------+----------------+----------------+----------------+
831 * +----------------+----------------+----------------+----------------+
833 * id - uint16_t, event id, may be used by front
834 * type - uint8_t, type of the event
837 * Page flip complete event - event from back to front on page flip completed:
839 * +----------------+----------------+----------------+----------------+
840 * | id | _EVT_PG_FLIP | reserved | 4
841 * +----------------+----------------+----------------+----------------+
843 * +----------------+----------------+----------------+----------------+
844 * | fb_cookie low 32-bit | 12
845 * +----------------+----------------+----------------+----------------+
846 * | fb_cookie high 32-bit | 16
847 * +----------------+----------------+----------------+----------------+
849 * +----------------+----------------+----------------+----------------+
850 * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
851 * +----------------+----------------+----------------+----------------+
853 * +----------------+----------------+----------------+----------------+
856 struct xendispl_pg_flip_evt {
860 struct xendispl_req {
865 struct xendispl_dbuf_create_req dbuf_create;
866 struct xendispl_dbuf_destroy_req dbuf_destroy;
867 struct xendispl_fb_attach_req fb_attach;
868 struct xendispl_fb_detach_req fb_detach;
869 struct xendispl_set_config_req set_config;
870 struct xendispl_page_flip_req pg_flip;
871 struct xendispl_get_edid_req get_edid;
872 uint8_t reserved[56];
876 struct xendispl_resp {
882 struct xendispl_get_edid_resp get_edid;
883 uint8_t reserved1[56];
887 struct xendispl_evt {
892 struct xendispl_pg_flip_evt pg_flip;
893 uint8_t reserved[56];
897 DEFINE_RING_TYPES(xen_displif, struct xendispl_req, struct xendispl_resp);
900 ******************************************************************************
901 * Back to front events delivery
902 ******************************************************************************
903 * In order to deliver asynchronous events from back to front a shared page is
904 * allocated by front and its granted reference propagated to back via
905 * XenStore entries (evt-ring-ref/evt-event-channel).
906 * This page has a common header used by both front and back to synchronize
907 * access and control event's ring buffer, while back being a producer of the
908 * events and front being a consumer. The rest of the page after the header
909 * is used for event packets.
911 * Upon reception of an event(s) front may confirm its reception
912 * for either each event, group of events or none.
915 struct xendispl_event_page {
918 uint8_t reserved[56];
921 #define XENDISPL_EVENT_PAGE_SIZE XEN_PAGE_SIZE
922 #define XENDISPL_IN_RING_OFFS (sizeof(struct xendispl_event_page))
923 #define XENDISPL_IN_RING_SIZE (XENDISPL_EVENT_PAGE_SIZE - XENDISPL_IN_RING_OFFS)
924 #define XENDISPL_IN_RING_LEN (XENDISPL_IN_RING_SIZE / sizeof(struct xendispl_evt))
925 #define XENDISPL_IN_RING(page) \
926 ((struct xendispl_evt *)((char *)(page) + XENDISPL_IN_RING_OFFS))
927 #define XENDISPL_IN_RING_REF(page, idx) \
928 (XENDISPL_IN_RING((page))[(idx) % XENDISPL_IN_RING_LEN])
930 #endif /* __XEN_PUBLIC_IO_DISPLIF_H__ */