Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * displif.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Unified display device I/O interface for Xen guest OSes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Permission is hereby granted, free of charge, to any person obtaining a copy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * of this software and associated documentation files (the "Software"), to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * deal in the Software without restriction, including without limitation the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * sell copies of the Software, and to permit persons to whom the Software is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * furnished to do so, subject to the following conditions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * The above copyright notice and this permission notice shall be included in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * all copies or substantial portions of the Software.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * DEALINGS IN THE SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * Copyright (C) 2016-2017 EPAM Systems Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * Authors: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  *          Oleksandr Grytsov <oleksandr_grytsov@epam.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #ifndef __XEN_PUBLIC_IO_DISPLIF_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define __XEN_PUBLIC_IO_DISPLIF_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include "ring.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include "../grant_table.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  *                           Protocol version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define XENDISPL_PROTOCOL_VERSION	"2"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define XENDISPL_PROTOCOL_VERSION_INT	 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  *                  Main features provided by the protocol
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * This protocol aims to provide a unified protocol which fits more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  * sophisticated use-cases than a framebuffer device can handle. At the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  * moment basic functionality is supported with the intention to be extended:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  *  o multiple dynamically allocated/destroyed framebuffers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)  *  o buffers of arbitrary sizes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  *  o buffer allocation at either back or front end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  *  o better configuration options including multiple display support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  * Note: existing fbif can be used together with displif running at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * same time, e.g. on Linux one provides framebuffer and another DRM/KMS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  * Note: display resolution (XenStore's "resolution" property) defines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  * visible area of the virtual display. At the same time resolution of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  * the display and frame buffers may differ: buffers can be smaller, equal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  * or bigger than the visible area. This is to enable use-cases, where backend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  * may do some post-processing of the display and frame buffers supplied,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  * e.g. those buffers can be just a part of the final composition.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  *                        Direction of improvements
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  * Future extensions to the existing protocol may include:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  *  o display/connector cloning
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  *  o allocation of objects other than display buffers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  *  o plane/overlay support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  *  o scaling support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  *  o rotation support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)  *                  Feature and Parameter Negotiation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  * Front->back notifications: when enqueuing a new request, sending a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  * notification can be made conditional on xendispl_req (i.e., the generic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  * hold-off mechanism provided by the ring macros). Backends must set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  * xendispl_req appropriately (e.g., using RING_FINAL_CHECK_FOR_REQUESTS()).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * Back->front notifications: when enqueuing a new response, sending a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  * notification can be made conditional on xendispl_resp (i.e., the generic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * hold-off mechanism provided by the ring macros). Frontends must set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  * xendispl_resp appropriately (e.g., using RING_FINAL_CHECK_FOR_RESPONSES()).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  * The two halves of a para-virtual display driver utilize nodes within
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  * XenStore to communicate capabilities and to negotiate operating parameters.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  * This section enumerates these nodes which reside in the respective front and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  * backend portions of XenStore, following the XenBus convention.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  * All data in XenStore is stored as strings. Nodes specifying numeric
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)  * values are encoded in decimal. Integer value ranges listed below are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  * expressed as fixed sized integer types capable of storing the conversion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)  * of a properly formated node string, without loss of information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  *                        Example configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)  * Note: depending on the use-case backend can expose more display connectors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)  * than the underlying HW physically has by employing SW graphics compositors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)  * This is an example of backend and frontend configuration:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  *--------------------------------- Backend -----------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)  * /local/domain/0/backend/vdispl/1/0/frontend-id = "1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)  * /local/domain/0/backend/vdispl/1/0/frontend = "/local/domain/1/device/vdispl/0"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)  * /local/domain/0/backend/vdispl/1/0/state = "4"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)  * /local/domain/0/backend/vdispl/1/0/versions = "1,2"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)  *--------------------------------- Frontend ----------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)  * /local/domain/1/device/vdispl/0/backend-id = "0"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)  * /local/domain/1/device/vdispl/0/backend = "/local/domain/0/backend/vdispl/1/0"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)  * /local/domain/1/device/vdispl/0/state = "4"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  * /local/domain/1/device/vdispl/0/version = "1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  * /local/domain/1/device/vdispl/0/be-alloc = "1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  *-------------------------- Connector 0 configuration ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  * /local/domain/1/device/vdispl/0/0/resolution = "1920x1080"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)  * /local/domain/1/device/vdispl/0/0/req-ring-ref = "2832"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)  * /local/domain/1/device/vdispl/0/0/req-event-channel = "15"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)  * /local/domain/1/device/vdispl/0/0/evt-ring-ref = "387"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)  * /local/domain/1/device/vdispl/0/0/evt-event-channel = "16"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)  *-------------------------- Connector 1 configuration ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  * /local/domain/1/device/vdispl/0/1/resolution = "800x600"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  * /local/domain/1/device/vdispl/0/1/req-ring-ref = "2833"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * /local/domain/1/device/vdispl/0/1/req-event-channel = "17"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  * /local/domain/1/device/vdispl/0/1/evt-ring-ref = "388"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)  * /local/domain/1/device/vdispl/0/1/evt-event-channel = "18"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  *                            Backend XenBus Nodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)  *----------------------------- Protocol version ------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  * versions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  *      Values:         <string>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  *      List of XENDISPL_LIST_SEPARATOR separated protocol versions supported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)  *      by the backend. For example "1,2,3".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)  *                            Frontend XenBus Nodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)  *-------------------------------- Addressing ---------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  * dom-id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  *      Values:         <uint16_t>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  *      Domain identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  * dev-id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)  *      Values:         <uint16_t>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  *      Device identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  * conn-idx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  *      Values:         <uint8_t>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)  *      Zero based contigous index of the connector.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)  *      /local/domain/<dom-id>/device/vdispl/<dev-id>/<conn-idx>/...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)  *----------------------------- Protocol version ------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)  * version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)  *      Values:         <string>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)  *      Protocol version, chosen among the ones supported by the backend.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)  *------------------------- Backend buffer allocation -------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)  * be-alloc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  *      Values:         "0", "1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  *      If value is set to "1", then backend can be a buffer provider/allocator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)  *      for this domain during XENDISPL_OP_DBUF_CREATE operation (see below
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)  *      for negotiation).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)  *      If value is not "1" or omitted frontend must allocate buffers itself.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)  *----------------------------- Connector settings ----------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  * unique-id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)  *      Values:         <string>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)  *      After device instance initialization each connector is assigned a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)  *      unique ID, so it can be identified by the backend by this ID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  *      This can be UUID or such.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)  * resolution
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)  *      Values:         <width, uint32_t>x<height, uint32_t>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)  *      Width and height of the connector in pixels separated by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)  *      XENDISPL_RESOLUTION_SEPARATOR. This defines visible area of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  *      display.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)  *      If backend provides extended display identification data (EDID) with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  *      XENDISPL_OP_GET_EDID request then EDID values must take precedence
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  *      over the resolutions defined here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  *------------------ Connector Request Transport Parameters -------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  * This communication path is used to deliver requests from frontend to backend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)  * and get the corresponding responses from backend to frontend,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)  * set up per connector.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)  * req-event-channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)  *      Values:         <uint32_t>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)  *      The identifier of the Xen connector's control event channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)  *      used to signal activity in the ring buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)  * req-ring-ref
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)  *      Values:         <uint32_t>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  *      The Xen grant reference granting permission for the backend to map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)  *      a sole page of connector's control ring buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)  *------------------- Connector Event Transport Parameters --------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)  * This communication path is used to deliver asynchronous events from backend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)  * to frontend, set up per connector.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  * evt-event-channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  *      Values:         <uint32_t>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)  *      The identifier of the Xen connector's event channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)  *      used to signal activity in the ring buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)  * evt-ring-ref
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)  *      Values:         <uint32_t>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)  *      The Xen grant reference granting permission for the backend to map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)  *      a sole page of connector's event ring buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)  *                               STATE DIAGRAMS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)  * Tool stack creates front and back state nodes with initial state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)  * XenbusStateInitialising.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)  * Tool stack creates and sets up frontend display configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)  * nodes per domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)  *-------------------------------- Normal flow --------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)  * Front                                Back
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)  * =================================    =====================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)  * XenbusStateInitialising              XenbusStateInitialising
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)  *                                       o Query backend device identification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)  *                                         data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)  *                                       o Open and validate backend device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)  *                                                |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)  *                                                |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)  *                                                V
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)  *                                      XenbusStateInitWait
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)  * o Query frontend configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)  * o Allocate and initialize
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)  *   event channels per configured
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)  *   connector.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)  * o Publish transport parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)  *   that will be in effect during
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)  *   this connection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)  *              |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)  *              |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)  *              V
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)  * XenbusStateInitialised
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)  *                                       o Query frontend transport parameters.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)  *                                       o Connect to the event channels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)  *                                                |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)  *                                                |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)  *                                                V
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)  *                                      XenbusStateConnected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)  *  o Create and initialize OS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)  *    virtual display connectors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)  *    as per configuration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)  *              |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)  *              |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)  *              V
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)  * XenbusStateConnected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)  *                                      XenbusStateUnknown
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)  *                                      XenbusStateClosed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)  *                                      XenbusStateClosing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)  * o Remove virtual display device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)  * o Remove event channels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)  *              |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)  *              |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)  *              V
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)  * XenbusStateClosed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)  *------------------------------- Recovery flow -------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)  * In case of frontend unrecoverable errors backend handles that as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)  * if frontend goes into the XenbusStateClosed state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)  * In case of backend unrecoverable errors frontend tries removing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)  * the virtualized device. If this is possible at the moment of error,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)  * then frontend goes into the XenbusStateInitialising state and is ready for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)  * new connection with backend. If the virtualized device is still in use and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)  * cannot be removed, then frontend goes into the XenbusStateReconfiguring state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)  * until either the virtualized device is removed or backend initiates a new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)  * connection. On the virtualized device removal frontend goes into the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)  * XenbusStateInitialising state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)  * Note on XenbusStateReconfiguring state of the frontend: if backend has
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)  * unrecoverable errors then frontend cannot send requests to the backend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)  * and thus cannot provide functionality of the virtualized device anymore.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)  * After backend is back to normal the virtualized device may still hold some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)  * state: configuration in use, allocated buffers, client application state etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)  * In most cases, this will require frontend to implement complex recovery
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)  * reconnect logic. Instead, by going into XenbusStateReconfiguring state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)  * frontend will make sure no new clients of the virtualized device are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)  * accepted, allow existing client(s) to exit gracefully by signaling error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)  * state etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)  * Once all the clients are gone frontend can reinitialize the virtualized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)  * device and get into XenbusStateInitialising state again signaling the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)  * backend that a new connection can be made.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)  * There are multiple conditions possible under which frontend will go from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)  * XenbusStateReconfiguring into XenbusStateInitialising, some of them are OS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)  * specific. For example:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)  * 1. The underlying OS framework may provide callbacks to signal that the last
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)  *    client of the virtualized device has gone and the device can be removed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)  * 2. Frontend can schedule a deferred work (timer/tasklet/workqueue)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)  *    to periodically check if this is the right time to re-try removal of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)  *    the virtualized device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)  * 3. By any other means.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)  *                             REQUEST CODES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)  * Request codes [0; 15] are reserved and must not be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) #define XENDISPL_OP_DBUF_CREATE		0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) #define XENDISPL_OP_DBUF_DESTROY	0x11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) #define XENDISPL_OP_FB_ATTACH		0x12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) #define XENDISPL_OP_FB_DETACH		0x13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) #define XENDISPL_OP_SET_CONFIG		0x14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) #define XENDISPL_OP_PG_FLIP		0x15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) /* The below command is available in protocol version 2 and above. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) #define XENDISPL_OP_GET_EDID		0x16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)  *                                 EVENT CODES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) #define XENDISPL_EVT_PG_FLIP		0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)  *               XENSTORE FIELD AND PATH NAME STRINGS, HELPERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) #define XENDISPL_DRIVER_NAME		"vdispl"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) #define XENDISPL_LIST_SEPARATOR		","
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) #define XENDISPL_RESOLUTION_SEPARATOR	"x"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) #define XENDISPL_FIELD_BE_VERSIONS	"versions"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) #define XENDISPL_FIELD_FE_VERSION	"version"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) #define XENDISPL_FIELD_REQ_RING_REF	"req-ring-ref"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) #define XENDISPL_FIELD_REQ_CHANNEL	"req-event-channel"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) #define XENDISPL_FIELD_EVT_RING_REF	"evt-ring-ref"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) #define XENDISPL_FIELD_EVT_CHANNEL	"evt-event-channel"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) #define XENDISPL_FIELD_RESOLUTION	"resolution"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) #define XENDISPL_FIELD_BE_ALLOC		"be-alloc"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) #define XENDISPL_FIELD_UNIQUE_ID	"unique-id"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) #define XENDISPL_EDID_BLOCK_SIZE	128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) #define XENDISPL_EDID_BLOCK_COUNT	256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) #define XENDISPL_EDID_MAX_SIZE		(XENDISPL_EDID_BLOCK_SIZE * XENDISPL_EDID_BLOCK_COUNT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)  *                          STATUS RETURN CODES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)  * Status return code is zero on success and -XEN_EXX on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)  *                              Assumptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)  * o usage of grant reference 0 as invalid grant reference:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)  *   grant reference 0 is valid, but never exposed to a PV driver,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)  *   because of the fact it is already in use/reserved by the PV console.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)  * o all references in this document to page sizes must be treated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)  *   as pages of size XEN_PAGE_SIZE unless otherwise noted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)  *       Description of the protocol between frontend and backend driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)  * The two halves of a Para-virtual display driver communicate with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)  * each other using shared pages and event channels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412)  * Shared page contains a ring with request/response packets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)  * All reserved fields in the structures below must be 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415)  * Display buffers's cookie of value 0 is treated as invalid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)  * Framebuffer's cookie of value 0 is treated as invalid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)  * For all request/response/event packets that use cookies:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419)  *   dbuf_cookie - uint64_t, unique to guest domain value used by the backend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)  *     to map remote display buffer to its local one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)  *   fb_cookie - uint64_t, unique to guest domain value used by the backend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)  *     to map remote framebuffer to its local one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)  *---------------------------------- Requests ---------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)  * All requests/responses, which are not connector specific, must be sent over
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)  * control ring of the connector which has the index value of 0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)  *   /local/domain/<dom-id>/device/vdispl/<dev-id>/0/req-ring-ref
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)  * All request packets have the same length (64 octets)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)  * All request packets have common header:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)  *         0                1                 2               3        octet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434)  * |               id                |    operation   |   reserved     | 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)  * |                             reserved                              | 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)  *   id - uint16_t, private guest value, echoed in response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)  *   operation - uint8_t, operation code, XENDISPL_OP_???
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)  * Request dbuf creation - request creation of a display buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)  *         0                1                 2               3        octet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)  * |               id                |_OP_DBUF_CREATE |   reserved     | 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)  * |                             reserved                              | 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)  * |                       dbuf_cookie low 32-bit                      | 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)  * |                       dbuf_cookie high 32-bit                     | 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452)  * |                               width                               | 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)  * |                               height                              | 24
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)  * |                                bpp                                | 28
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)  * |                             buffer_sz                             | 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460)  * |                               flags                               | 36
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)  * |                           gref_directory                          | 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464)  * |                             data_ofs                              | 44
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466)  * |                             reserved                              | 48
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468)  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)  * |                             reserved                              | 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473)  * Must be sent over control ring of the connector which has the index
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474)  * value of 0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475)  *   /local/domain/<dom-id>/device/vdispl/<dev-id>/0/req-ring-ref
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476)  * All unused bits in flags field must be set to 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)  * An attempt to create multiple display buffers with the same dbuf_cookie is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)  * an error. dbuf_cookie can be re-used after destroying the corresponding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480)  * display buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)  * Width and height of the display buffers can be smaller, equal or bigger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483)  * than the connector's resolution. Depth/pixel format of the individual
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)  * buffers can differ as well.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486)  * width - uint32_t, width in pixels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487)  * height - uint32_t, height in pixels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)  * bpp - uint32_t, bits per pixel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)  * buffer_sz - uint32_t, buffer size to be allocated, octets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490)  * flags - uint32_t, flags of the operation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491)  *   o XENDISPL_DBUF_FLG_REQ_ALLOC - if set, then backend is requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492)  *     to allocate the buffer with the parameters provided in this request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)  *     Page directory is handled as follows:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494)  *       Frontend on request:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495)  *         o allocates pages for the directory (gref_directory,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)  *           gref_dir_next_page(s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497)  *         o grants permissions for the pages of the directory to the backend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498)  *         o sets gref_dir_next_page fields
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499)  *       Backend on response:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500)  *         o grants permissions for the pages of the buffer allocated to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501)  *           the frontend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502)  *         o fills in page directory with grant references
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503)  *           (gref[] in struct xendispl_page_directory)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504)  * gref_directory - grant_ref_t, a reference to the first shared page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505)  *   describing shared buffer references. At least one page exists. If shared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506)  *   buffer size (buffer_sz) exceeds what can be addressed by this single page,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507)  *   then reference to the next page must be supplied (see gref_dir_next_page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508)  *   below)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509)  * data_ofs - uint32_t, offset of the data in the buffer, octets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) #define XENDISPL_DBUF_FLG_REQ_ALLOC	(1 << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) struct xendispl_dbuf_create_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 	uint64_t dbuf_cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) 	uint32_t width;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 	uint32_t height;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 	uint32_t bpp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 	uint32_t buffer_sz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 	uint32_t flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 	grant_ref_t gref_directory;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 	uint32_t data_ofs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526)  * Shared page for XENDISPL_OP_DBUF_CREATE buffer descriptor (gref_directory in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527)  * the request) employs a list of pages, describing all pages of the shared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)  * data buffer:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529)  *         0                1                 2               3        octet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531)  * |                        gref_dir_next_page                         | 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)  * |                              gref[0]                              | 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535)  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537)  * |                              gref[i]                              | i*4+8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539)  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541)  * |                             gref[N - 1]                           | N*4+8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544)  * gref_dir_next_page - grant_ref_t, reference to the next page describing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)  *   page directory. Must be 0 if there are no more pages in the list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546)  * gref[i] - grant_ref_t, reference to a shared page of the buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547)  *   allocated at XENDISPL_OP_DBUF_CREATE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549)  * Number of grant_ref_t entries in the whole page directory is not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550)  * passed, but instead can be calculated as:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551)  *   num_grefs_total = (XENDISPL_OP_DBUF_CREATE.buffer_sz + XEN_PAGE_SIZE - 1) /
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552)  *       XEN_PAGE_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) struct xendispl_page_directory {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 	grant_ref_t gref_dir_next_page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 	grant_ref_t gref[1]; /* Variable length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561)  * Request dbuf destruction - destroy a previously allocated display buffer:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562)  *         0                1                 2               3        octet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564)  * |               id                |_OP_DBUF_DESTROY|   reserved     | 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566)  * |                             reserved                              | 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568)  * |                       dbuf_cookie low 32-bit                      | 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)  * |                       dbuf_cookie high 32-bit                     | 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572)  * |                             reserved                              | 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574)  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576)  * |                             reserved                              | 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579)  * Must be sent over control ring of the connector which has the index
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580)  * value of 0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581)  *   /local/domain/<dom-id>/device/vdispl/<dev-id>/0/req-ring-ref
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) struct xendispl_dbuf_destroy_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 	uint64_t dbuf_cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589)  * Request framebuffer attachment - request attachment of a framebuffer to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590)  * previously created display buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591)  *         0                1                 2               3        octet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593)  * |               id                | _OP_FB_ATTACH  |   reserved     | 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595)  * |                             reserved                              | 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597)  * |                       dbuf_cookie low 32-bit                      | 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599)  * |                       dbuf_cookie high 32-bit                     | 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601)  * |                        fb_cookie low 32-bit                       | 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603)  * |                        fb_cookie high 32-bit                      | 24
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605)  * |                               width                               | 28
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607)  * |                               height                              | 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609)  * |                            pixel_format                           | 36
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611)  * |                             reserved                              | 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613)  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615)  * |                             reserved                              | 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618)  * Must be sent over control ring of the connector which has the index
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619)  * value of 0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620)  *   /local/domain/<dom-id>/device/vdispl/<dev-id>/0/req-ring-ref
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621)  * Width and height can be smaller, equal or bigger than the connector's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622)  * resolution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624)  * An attempt to create multiple frame buffers with the same fb_cookie is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625)  * an error. fb_cookie can be re-used after destroying the corresponding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626)  * frame buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628)  * width - uint32_t, width in pixels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629)  * height - uint32_t, height in pixels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630)  * pixel_format - uint32_t, pixel format of the framebuffer, FOURCC code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) struct xendispl_fb_attach_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) 	uint64_t dbuf_cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) 	uint64_t fb_cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) 	uint32_t width;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) 	uint32_t height;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) 	uint32_t pixel_format;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642)  * Request framebuffer detach - detach a previously
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643)  * attached framebuffer from the display buffer in request:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644)  *         0                1                 2               3        octet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646)  * |               id                |  _OP_FB_DETACH |   reserved     | 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648)  * |                             reserved                              | 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650)  * |                        fb_cookie low 32-bit                       | 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652)  * |                        fb_cookie high 32-bit                      | 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654)  * |                             reserved                              | 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656)  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658)  * |                             reserved                              | 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661)  * Must be sent over control ring of the connector which has the index
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662)  * value of 0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663)  *   /local/domain/<dom-id>/device/vdispl/<dev-id>/0/req-ring-ref
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) struct xendispl_fb_detach_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) 	uint64_t fb_cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671)  * Request configuration set/reset - request to set or reset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672)  * the configuration/mode of the display:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673)  *         0                1                 2               3        octet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675)  * |               id                | _OP_SET_CONFIG |   reserved     | 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677)  * |                             reserved                              | 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679)  * |                        fb_cookie low 32-bit                       | 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681)  * |                        fb_cookie high 32-bit                      | 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683)  * |                                 x                                 | 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685)  * |                                 y                                 | 24
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687)  * |                               width                               | 28
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689)  * |                               height                              | 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691)  * |                                bpp                                | 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693)  * |                             reserved                              | 44
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695)  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697)  * |                             reserved                              | 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700)  * Pass all zeros to reset, otherwise command is treated as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701)  * configuration set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702)  * Framebuffer's cookie defines which framebuffer/dbuf must be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703)  * displayed while enabling display (applying configuration).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704)  * x, y, width and height are bound by the connector's resolution and must not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705)  * exceed it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707)  * x - uint32_t, starting position in pixels by X axis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708)  * y - uint32_t, starting position in pixels by Y axis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709)  * width - uint32_t, width in pixels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710)  * height - uint32_t, height in pixels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711)  * bpp - uint32_t, bits per pixel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) struct xendispl_set_config_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) 	uint64_t fb_cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) 	uint32_t x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) 	uint32_t y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) 	uint32_t width;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) 	uint32_t height;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) 	uint32_t bpp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724)  * Request page flip - request to flip a page identified by the framebuffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725)  * cookie:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726)  *         0                1                 2               3        octet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728)  * |               id                | _OP_PG_FLIP    |   reserved     | 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730)  * |                             reserved                              | 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732)  * |                        fb_cookie low 32-bit                       | 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734)  * |                        fb_cookie high 32-bit                      | 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736)  * |                             reserved                              | 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738)  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740)  * |                             reserved                              | 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) struct xendispl_page_flip_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) 	uint64_t fb_cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749)  * Request EDID - request EDID describing current connector:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750)  *         0                1                 2               3        octet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752)  * |               id                | _OP_GET_EDID   |   reserved     | 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754)  * |                             buffer_sz                             | 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756)  * |                          gref_directory                           | 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758)  * |                             reserved                              | 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760)  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762)  * |                             reserved                              | 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765)  * Notes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766)  *   - This command is not available in protocol version 1 and should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767)  *     ignored.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768)  *   - This request is optional and if not supported then visible area
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769)  *     is defined by the relevant XenStore's "resolution" property.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770)  *   - Shared buffer, allocated for EDID storage, must not be less then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771)  *     XENDISPL_EDID_MAX_SIZE octets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773)  * buffer_sz - uint32_t, buffer size to be allocated, octets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774)  * gref_directory - grant_ref_t, a reference to the first shared page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775)  *   describing EDID buffer references. See XENDISPL_OP_DBUF_CREATE for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776)  *   grant page directory structure (struct xendispl_page_directory).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778)  * See response format for this request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) struct xendispl_get_edid_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) 	uint32_t buffer_sz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) 	grant_ref_t gref_directory;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787)  *---------------------------------- Responses --------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789)  * All response packets have the same length (64 octets)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791)  * All response packets have common header:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792)  *         0                1                 2               3        octet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794)  * |               id                |            reserved             | 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796)  * |                              status                               | 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798)  * |                             reserved                              | 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800)  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802)  * |                             reserved                              | 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805)  * id - uint16_t, private guest value, echoed from request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806)  * status - int32_t, response status, zero on success and -XEN_EXX on failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809)  * Get EDID response - response for XENDISPL_OP_GET_EDID:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810)  *         0                1                 2               3        octet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812)  * |               id                |    operation   |    reserved    | 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814)  * |                              status                               | 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816)  * |                             edid_sz                               | 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818)  * |                             reserved                              | 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820)  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822)  * |                             reserved                              | 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825)  * Notes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826)  *   - This response is not available in protocol version 1 and should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827)  *     ignored.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829)  * edid_sz - uint32_t, size of the EDID, octets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) struct xendispl_get_edid_resp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) 	uint32_t edid_sz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837)  *----------------------------------- Events ----------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839)  * Events are sent via a shared page allocated by the front and propagated by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840)  *   evt-event-channel/evt-ring-ref XenStore entries
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841)  * All event packets have the same length (64 octets)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842)  * All event packets have common header:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843)  *         0                1                 2               3        octet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845)  * |               id                |      type      |   reserved     | 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847)  * |                             reserved                              | 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850)  * id - uint16_t, event id, may be used by front
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851)  * type - uint8_t, type of the event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854)  * Page flip complete event - event from back to front on page flip completed:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855)  *         0                1                 2               3        octet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857)  * |               id                |   _EVT_PG_FLIP |   reserved     | 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859)  * |                             reserved                              | 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861)  * |                        fb_cookie low 32-bit                       | 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863)  * |                        fb_cookie high 32-bit                      | 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 865)  * |                             reserved                              | 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 866)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 867)  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 868)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 869)  * |                             reserved                              | 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 870)  * +----------------+----------------+----------------+----------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 871)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 872) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 873) struct xendispl_pg_flip_evt {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 874) 	uint64_t fb_cookie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 875) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 876) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 877) struct xendispl_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 878) 	uint16_t id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 879) 	uint8_t operation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 880) 	uint8_t reserved[5];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 881) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 882) 		struct xendispl_dbuf_create_req dbuf_create;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 883) 		struct xendispl_dbuf_destroy_req dbuf_destroy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 884) 		struct xendispl_fb_attach_req fb_attach;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 885) 		struct xendispl_fb_detach_req fb_detach;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 886) 		struct xendispl_set_config_req set_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 887) 		struct xendispl_page_flip_req pg_flip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 888) 		struct xendispl_get_edid_req get_edid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 889) 		uint8_t reserved[56];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 890) 	} op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 891) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 892) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 893) struct xendispl_resp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 894) 	uint16_t id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 895) 	uint8_t operation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 896) 	uint8_t reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 897) 	int32_t status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 898) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 899) 		struct xendispl_get_edid_resp get_edid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 900) 		uint8_t reserved1[56];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 901) 	} op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 902) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 903) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 904) struct xendispl_evt {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 905) 	uint16_t id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 906) 	uint8_t type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 907) 	uint8_t reserved[5];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 908) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 909) 		struct xendispl_pg_flip_evt pg_flip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 910) 		uint8_t reserved[56];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 911) 	} op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 912) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 913) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 914) DEFINE_RING_TYPES(xen_displif, struct xendispl_req, struct xendispl_resp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 915) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 916) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 917)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 918)  *                        Back to front events delivery
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 919)  ******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 920)  * In order to deliver asynchronous events from back to front a shared page is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 921)  * allocated by front and its granted reference propagated to back via
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 922)  * XenStore entries (evt-ring-ref/evt-event-channel).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 923)  * This page has a common header used by both front and back to synchronize
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 924)  * access and control event's ring buffer, while back being a producer of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 925)  * events and front being a consumer. The rest of the page after the header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 926)  * is used for event packets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 927)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 928)  * Upon reception of an event(s) front may confirm its reception
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 929)  * for either each event, group of events or none.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 930)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 931) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 932) struct xendispl_event_page {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 933) 	uint32_t in_cons;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 934) 	uint32_t in_prod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 935) 	uint8_t reserved[56];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 936) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 937) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 938) #define XENDISPL_EVENT_PAGE_SIZE XEN_PAGE_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 939) #define XENDISPL_IN_RING_OFFS (sizeof(struct xendispl_event_page))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 940) #define XENDISPL_IN_RING_SIZE (XENDISPL_EVENT_PAGE_SIZE - XENDISPL_IN_RING_OFFS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 941) #define XENDISPL_IN_RING_LEN (XENDISPL_IN_RING_SIZE / sizeof(struct xendispl_evt))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 942) #define XENDISPL_IN_RING(page) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 943) 	((struct xendispl_evt *)((char *)(page) + XENDISPL_IN_RING_OFFS))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 944) #define XENDISPL_IN_RING_REF(page, idx) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 945) 	(XENDISPL_IN_RING((page))[(idx) % XENDISPL_IN_RING_LEN])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 946) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 947) #endif /* __XEN_PUBLIC_IO_DISPLIF_H__ */