hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/xen/interface/io/displif.h
....@@ -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 ******************************************************************************
....@@ -376,6 +382,10 @@
376382 #define XENDISPL_FIELD_RESOLUTION "resolution"
377383 #define XENDISPL_FIELD_BE_ALLOC "be-alloc"
378384 #define XENDISPL_FIELD_UNIQUE_ID "unique-id"
385
+
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)
379389
380390 /*
381391 ******************************************************************************
....@@ -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 @@
506519 uint32_t buffer_sz;
507520 uint32_t flags;
508521 grant_ref_t gref_directory;
522
+ uint32_t data_ofs;
509523 };
510524
511525 /*
....@@ -732,6 +746,44 @@
732746 };
733747
734748 /*
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
+
786
+/*
735787 *---------------------------------- Responses --------------------------------
736788 *
737789 * All response packets have the same length (64 octets)
....@@ -753,6 +805,35 @@
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 @@
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 @@
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 {