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