Re: [PATCH v2] xen/displif: Protocol version 2

2020-07-27 Thread Oleksandr Andrushchenko
Ping

On 7/1/20 10:19 AM, Oleksandr Andrushchenko wrote:
> From: Oleksandr Andrushchenko 
>
> 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 
> ---
>   xen/include/public/io/displif.h | 91 +++--
>   1 file changed, 88 insertions(+), 3 deletions(-)
>
> diff --git a/xen/include/public/io/displif.h b/xen/include/public/io/displif.h
> index cc5de9cb1f35..0055895510f7 100644
> --- a/xen/include/public/io/displif.h
> +++ b/xen/include/public/io/displif.h
> @@ -38,7 +38,8 @@
>*   Protocol version
>
> **
>*/
> -#define XENDISPL_PROTOCOL_VERSION "1"
> +#define XENDISPL_PROTOCOL_VERSION "2"
> +#define XENDISPL_PROTOCOL_VERSION_INT  2
>   
>   /*
>
> **
> @@ -202,6 +203,9 @@
>*  Width and height of the connector in pixels separated by
>*  XENDISPL_RESOLUTION_SEPARATOR. This defines visible area of the
>*  display.
> + *  If backend provides extended display identification data (EDID) with
> + *  XENDISPL_OP_GET_EDID request then EDID values must take precedence
> + *  over the resolutions defined here.
>*
>*-- Connector Request Transport Parameters 
> ---
>*
> @@ -349,6 +353,8 @@
>   #define XENDISPL_OP_FB_DETACH 0x13
>   #define XENDISPL_OP_SET_CONFIG0x14
>   #define XENDISPL_OP_PG_FLIP   0x15
> +/* The below command is available in protocol version 2 and above. */
> +#define XENDISPL_OP_GET_EDID  0x16
>   
>   /*
>
> **
> @@ -377,6 +383,10 @@
>   #define XENDISPL_FIELD_BE_ALLOC   "be-alloc"
>   #define XENDISPL_FIELD_UNIQUE_ID  "unique-id"
>   
> +#define XENDISPL_EDID_BLOCK_SIZE  128
> +#define XENDISPL_EDID_BLOCK_COUNT 256
> +#define XENDISPL_EDID_MAX_SIZE(XENDISPL_EDID_BLOCK_SIZE * 
> XENDISPL_EDID_BLOCK_COUNT)
> +
>   /*
>
> **
>*  STATUS RETURN CODES
> @@ -451,7 +461,9 @@
>* +++++
>* |   gref_directory  | 40
>* +++++
> - * | reserved  | 44
> + * | data_ofs  | 44
> + * +++++
> + * | reserved  | 48
>* +++++
>* |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
>* +++++
> @@ -494,6 +506,7 @@
>*   buffer size (buffer_sz) exceeds what can be addressed by this single 
> page,
>*   then reference to the next page must be supplied (see 
> gref_dir_next_page
>*   below)
> + * data_ofs - uint32_t, offset of the data in the buffer, octets
>*/
>   
>   #define XENDISPL_DBUF_FLG_REQ_ALLOC   (1 << 0)
> @@ -506,6 +519,7 @@ struct xendispl_dbuf_create_req {
>   uint32_t buffer_sz;
>   uint32_t flags;
>   grant_ref_t gref_directory;
> +uint32_t data_ofs;
>   };
>   
>   /*
> @@ -731,6 +745,44 @@ struct xendispl_page_flip_req {
>   uint64_t fb_cookie;
>   };
>   
> +/*
> + * Request EDID - request EDID describing current connector:
> + * 01 2  

Re: [PATCH v2] xen/displif: Protocol version 2

2020-07-08 Thread Oleksandr Andrushchenko
Hi, Paul!

On 7/2/20 11:42 AM, Jürgen Groß wrote:
> On 02.07.20 09:59, Oleksandr Andrushchenko wrote:
>>
>> On 7/2/20 10:20 AM, Jürgen Groß wrote:
>>> On 01.07.20 14:07, Oleksandr Andrushchenko wrote:
 On 7/1/20 1:46 PM, Jürgen Groß wrote:
> On 01.07.20 09:19, Oleksandr Andrushchenko wrote:
>> From: Oleksandr Andrushchenko 
>>
>> 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 
>
> Reviewed-by: Juergen Gross 

 Thank you, do you want me to prepare the same for the kernel so

 you have it at hand when the time comes?
>>>
>>> It should be added to the kernel only when really needed (i.e. a user of
>>> the new functionality is showing up).
>>
>> We have a patch for that which adds EDID to the existing PV DRM frontend,
>>
>> so while upstreaming those changes I will also include changes to the 
>> protocol
>>
>> in the kernel series: for that we need the header in Xen tree first, right?
>
> Yes.
>
Is it possible that we have this change in the release please?

This is not used by any piece of code in Xen, so it won't hurt anything.

But I need this change in so I can proceed with the Linux kernel part:

we would like to upstream the relevant EDID change to the display

frontend driver and without the header in Xen tree we are stuck

Thank you in advance,

Oleksandr

>
> Juergen

Re: [PATCH v2] xen/displif: Protocol version 2

2020-07-02 Thread Jürgen Groß

On 02.07.20 09:59, Oleksandr Andrushchenko wrote:


On 7/2/20 10:20 AM, Jürgen Groß wrote:

On 01.07.20 14:07, Oleksandr Andrushchenko wrote:

On 7/1/20 1:46 PM, Jürgen Groß wrote:

On 01.07.20 09:19, Oleksandr Andrushchenko wrote:

From: Oleksandr Andrushchenko 

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 


Reviewed-by: Juergen Gross 


Thank you, do you want me to prepare the same for the kernel so

you have it at hand when the time comes?


It should be added to the kernel only when really needed (i.e. a user of
the new functionality is showing up).


We have a patch for that which adds EDID to the existing PV DRM frontend,

so while upstreaming those changes I will also include changes to the protocol

in the kernel series: for that we need the header in Xen tree first, right?


Yes.


Juergen



Re: [PATCH v2] xen/displif: Protocol version 2

2020-07-02 Thread Oleksandr Andrushchenko

On 7/2/20 10:20 AM, Jürgen Groß wrote:
> On 01.07.20 14:07, Oleksandr Andrushchenko wrote:
>> On 7/1/20 1:46 PM, Jürgen Groß wrote:
>>> On 01.07.20 09:19, Oleksandr Andrushchenko wrote:
 From: Oleksandr Andrushchenko 

 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 
>>>
>>> Reviewed-by: Juergen Gross 
>>
>> Thank you, do you want me to prepare the same for the kernel so
>>
>> you have it at hand when the time comes?
>
> It should be added to the kernel only when really needed (i.e. a user of
> the new functionality is showing up).

We have a patch for that which adds EDID to the existing PV DRM frontend,

so while upstreaming those changes I will also include changes to the protocol

in the kernel series: for that we need the header in Xen tree first, right?

>
>
> Juergen

Thank you,

Oleksandr


Re: [PATCH v2] xen/displif: Protocol version 2

2020-07-02 Thread Jürgen Groß

On 01.07.20 14:07, Oleksandr Andrushchenko wrote:

On 7/1/20 1:46 PM, Jürgen Groß wrote:

On 01.07.20 09:19, Oleksandr Andrushchenko wrote:

From: Oleksandr Andrushchenko 

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 


Reviewed-by: Juergen Gross 


Thank you, do you want me to prepare the same for the kernel so

you have it at hand when the time comes?


It should be added to the kernel only when really needed (i.e. a user of
the new functionality is showing up).


Juergen



Re: [PATCH v2] xen/displif: Protocol version 2

2020-07-01 Thread Oleksandr Andrushchenko
On 7/1/20 1:46 PM, Jürgen Groß wrote:
> On 01.07.20 09:19, Oleksandr Andrushchenko wrote:
>> From: Oleksandr Andrushchenko 
>>
>> 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 
>
> Reviewed-by: Juergen Gross 

Thank you, do you want me to prepare the same for the kernel so

you have it at hand when the time comes?

>
>
> Juergen

Re: [PATCH v2] xen/displif: Protocol version 2

2020-07-01 Thread Jürgen Groß

On 01.07.20 09:19, Oleksandr Andrushchenko wrote:

From: Oleksandr Andrushchenko 

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 


Reviewed-by: Juergen Gross 


Juergen



[PATCH v2] xen/displif: Protocol version 2

2020-07-01 Thread Oleksandr Andrushchenko
From: Oleksandr Andrushchenko 

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 
---
 xen/include/public/io/displif.h | 91 +++--
 1 file changed, 88 insertions(+), 3 deletions(-)

diff --git a/xen/include/public/io/displif.h b/xen/include/public/io/displif.h
index cc5de9cb1f35..0055895510f7 100644
--- a/xen/include/public/io/displif.h
+++ b/xen/include/public/io/displif.h
@@ -38,7 +38,8 @@
  *   Protocol version
  **
  */
-#define XENDISPL_PROTOCOL_VERSION "1"
+#define XENDISPL_PROTOCOL_VERSION "2"
+#define XENDISPL_PROTOCOL_VERSION_INT  2
 
 /*
  **
@@ -202,6 +203,9 @@
  *  Width and height of the connector in pixels separated by
  *  XENDISPL_RESOLUTION_SEPARATOR. This defines visible area of the
  *  display.
+ *  If backend provides extended display identification data (EDID) with
+ *  XENDISPL_OP_GET_EDID request then EDID values must take precedence
+ *  over the resolutions defined here.
  *
  *-- Connector Request Transport Parameters ---
  *
@@ -349,6 +353,8 @@
 #define XENDISPL_OP_FB_DETACH 0x13
 #define XENDISPL_OP_SET_CONFIG0x14
 #define XENDISPL_OP_PG_FLIP   0x15
+/* The below command is available in protocol version 2 and above. */
+#define XENDISPL_OP_GET_EDID  0x16
 
 /*
  **
@@ -377,6 +383,10 @@
 #define XENDISPL_FIELD_BE_ALLOC   "be-alloc"
 #define XENDISPL_FIELD_UNIQUE_ID  "unique-id"
 
+#define XENDISPL_EDID_BLOCK_SIZE  128
+#define XENDISPL_EDID_BLOCK_COUNT 256
+#define XENDISPL_EDID_MAX_SIZE(XENDISPL_EDID_BLOCK_SIZE * 
XENDISPL_EDID_BLOCK_COUNT)
+
 /*
  **
  *  STATUS RETURN CODES
@@ -451,7 +461,9 @@
  * +++++
  * |   gref_directory  | 40
  * +++++
- * | reserved  | 44
+ * | data_ofs  | 44
+ * +++++
+ * | reserved  | 48
  * +++++
  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
  * +++++
@@ -494,6 +506,7 @@
  *   buffer size (buffer_sz) exceeds what can be addressed by this single page,
  *   then reference to the next page must be supplied (see gref_dir_next_page
  *   below)
+ * data_ofs - uint32_t, offset of the data in the buffer, octets
  */
 
 #define XENDISPL_DBUF_FLG_REQ_ALLOC   (1 << 0)
@@ -506,6 +519,7 @@ struct xendispl_dbuf_create_req {
 uint32_t buffer_sz;
 uint32_t flags;
 grant_ref_t gref_directory;
+uint32_t data_ofs;
 };
 
 /*
@@ -731,6 +745,44 @@ struct xendispl_page_flip_req {
 uint64_t fb_cookie;
 };
 
+/*
+ * Request EDID - request EDID describing current connector:
+ * 01 2   3octet
+ * +++++
+ * |   id| _OP_GET_EDID   |   reserved | 4
+ * +++++
+ * | buffer_sz | 8
+ *