Skip to content

Commit 6f92337

Browse files
Oleksandr Andrushchenkojgross1
authored andcommitted
xen: Sync up with the canonical protocol definition in Xen
This is the sync up with the canonical definition of the display protocol in Xen. 1. Add protocol version as an integer Version string, which is in fact an integer, is hard to handle in the code that supports different protocol versions. To simplify that also add the version as an integer. 2. Pass buffer offset with XENDISPL_OP_DBUF_CREATE There are cases when display data buffer is created with non-zero offset to the data start. Handle such cases and provide that offset while creating a display buffer. 3. Add XENDISPL_OP_GET_EDID command Add an optional request for reading Extended Display Identification Data (EDID) structure which allows better configuration of the display connectors over the configuration set in XenStore. With this change connectors may have multiple resolutions defined with respect to detailed timing definitions and additional properties normally provided by displays. If this request is not supported by the backend then visible area is defined by the relevant XenStore's "resolution" property. If backend provides extended display identification data (EDID) with XENDISPL_OP_GET_EDID request then EDID values must take precedence over the resolutions defined in XenStore. 4. Bump protocol version to 2. Signed-off-by: Oleksandr Andrushchenko <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Juergen Gross <[email protected]>
1 parent 1295729 commit 6f92337

File tree

1 file changed

+88
-3
lines changed

1 file changed

+88
-3
lines changed

include/xen/interface/io/displif.h

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
* Protocol version
3939
******************************************************************************
4040
*/
41-
#define XENDISPL_PROTOCOL_VERSION "1"
41+
#define XENDISPL_PROTOCOL_VERSION "2"
42+
#define XENDISPL_PROTOCOL_VERSION_INT 2
4243

4344
/*
4445
******************************************************************************
@@ -202,6 +203,9 @@
202203
* Width and height of the connector in pixels separated by
203204
* XENDISPL_RESOLUTION_SEPARATOR. This defines visible area of the
204205
* display.
206+
* If backend provides extended display identification data (EDID) with
207+
* XENDISPL_OP_GET_EDID request then EDID values must take precedence
208+
* over the resolutions defined here.
205209
*
206210
*------------------ Connector Request Transport Parameters -------------------
207211
*
@@ -349,6 +353,8 @@
349353
#define XENDISPL_OP_FB_DETACH 0x13
350354
#define XENDISPL_OP_SET_CONFIG 0x14
351355
#define XENDISPL_OP_PG_FLIP 0x15
356+
/* The below command is available in protocol version 2 and above. */
357+
#define XENDISPL_OP_GET_EDID 0x16
352358

353359
/*
354360
******************************************************************************
@@ -377,6 +383,10 @@
377383
#define XENDISPL_FIELD_BE_ALLOC "be-alloc"
378384
#define XENDISPL_FIELD_UNIQUE_ID "unique-id"
379385

386+
#define XENDISPL_EDID_BLOCK_SIZE 128
387+
#define XENDISPL_EDID_BLOCK_COUNT 256
388+
#define XENDISPL_EDID_MAX_SIZE (XENDISPL_EDID_BLOCK_SIZE * XENDISPL_EDID_BLOCK_COUNT)
389+
380390
/*
381391
******************************************************************************
382392
* STATUS RETURN CODES
@@ -451,7 +461,9 @@
451461
* +----------------+----------------+----------------+----------------+
452462
* | gref_directory | 40
453463
* +----------------+----------------+----------------+----------------+
454-
* | reserved | 44
464+
* | data_ofs | 44
465+
* +----------------+----------------+----------------+----------------+
466+
* | reserved | 48
455467
* +----------------+----------------+----------------+----------------+
456468
* |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
457469
* +----------------+----------------+----------------+----------------+
@@ -494,6 +506,7 @@
494506
* buffer size (buffer_sz) exceeds what can be addressed by this single page,
495507
* then reference to the next page must be supplied (see gref_dir_next_page
496508
* below)
509+
* data_ofs - uint32_t, offset of the data in the buffer, octets
497510
*/
498511

499512
#define XENDISPL_DBUF_FLG_REQ_ALLOC (1 << 0)
@@ -506,6 +519,7 @@ struct xendispl_dbuf_create_req {
506519
uint32_t buffer_sz;
507520
uint32_t flags;
508521
grant_ref_t gref_directory;
522+
uint32_t data_ofs;
509523
};
510524

511525
/*
@@ -731,6 +745,44 @@ struct xendispl_page_flip_req {
731745
uint64_t fb_cookie;
732746
};
733747

748+
/*
749+
* Request EDID - request EDID describing current connector:
750+
* 0 1 2 3 octet
751+
* +----------------+----------------+----------------+----------------+
752+
* | id | _OP_GET_EDID | reserved | 4
753+
* +----------------+----------------+----------------+----------------+
754+
* | buffer_sz | 8
755+
* +----------------+----------------+----------------+----------------+
756+
* | gref_directory | 12
757+
* +----------------+----------------+----------------+----------------+
758+
* | reserved | 16
759+
* +----------------+----------------+----------------+----------------+
760+
* |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
761+
* +----------------+----------------+----------------+----------------+
762+
* | reserved | 64
763+
* +----------------+----------------+----------------+----------------+
764+
*
765+
* Notes:
766+
* - This command is not available in protocol version 1 and should be
767+
* ignored.
768+
* - This request is optional and if not supported then visible area
769+
* is defined by the relevant XenStore's "resolution" property.
770+
* - Shared buffer, allocated for EDID storage, must not be less then
771+
* XENDISPL_EDID_MAX_SIZE octets.
772+
*
773+
* buffer_sz - uint32_t, buffer size to be allocated, octets
774+
* gref_directory - grant_ref_t, a reference to the first shared page
775+
* describing EDID buffer references. See XENDISPL_OP_DBUF_CREATE for
776+
* grant page directory structure (struct xendispl_page_directory).
777+
*
778+
* See response format for this request.
779+
*/
780+
781+
struct xendispl_get_edid_req {
782+
uint32_t buffer_sz;
783+
grant_ref_t gref_directory;
784+
};
785+
734786
/*
735787
*---------------------------------- Responses --------------------------------
736788
*
@@ -753,6 +805,35 @@ struct xendispl_page_flip_req {
753805
* id - uint16_t, private guest value, echoed from request
754806
* status - int32_t, response status, zero on success and -XEN_EXX on failure
755807
*
808+
*
809+
* Get EDID response - response for XENDISPL_OP_GET_EDID:
810+
* 0 1 2 3 octet
811+
* +----------------+----------------+----------------+----------------+
812+
* | id | operation | reserved | 4
813+
* +----------------+----------------+----------------+----------------+
814+
* | status | 8
815+
* +----------------+----------------+----------------+----------------+
816+
* | edid_sz | 12
817+
* +----------------+----------------+----------------+----------------+
818+
* | reserved | 16
819+
* +----------------+----------------+----------------+----------------+
820+
* |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
821+
* +----------------+----------------+----------------+----------------+
822+
* | reserved | 64
823+
* +----------------+----------------+----------------+----------------+
824+
*
825+
* Notes:
826+
* - This response is not available in protocol version 1 and should be
827+
* ignored.
828+
*
829+
* edid_sz - uint32_t, size of the EDID, octets
830+
*/
831+
832+
struct xendispl_get_edid_resp {
833+
uint32_t edid_sz;
834+
};
835+
836+
/*
756837
*----------------------------------- Events ----------------------------------
757838
*
758839
* Events are sent via a shared page allocated by the front and propagated by
@@ -804,6 +885,7 @@ struct xendispl_req {
804885
struct xendispl_fb_detach_req fb_detach;
805886
struct xendispl_set_config_req set_config;
806887
struct xendispl_page_flip_req pg_flip;
888+
struct xendispl_get_edid_req get_edid;
807889
uint8_t reserved[56];
808890
} op;
809891
};
@@ -813,7 +895,10 @@ struct xendispl_resp {
813895
uint8_t operation;
814896
uint8_t reserved;
815897
int32_t status;
816-
uint8_t reserved1[56];
898+
union {
899+
struct xendispl_get_edid_resp get_edid;
900+
uint8_t reserved1[56];
901+
} op;
817902
};
818903

819904
struct xendispl_evt {

0 commit comments

Comments
 (0)