~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/xen/interface/io/displif.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/xen/interface/io/displif.h (Version linux-6.12-rc7) and /include/xen/interface/io/displif.h (Version linux-5.8.18)


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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php