[PATCH v3 1/5] config_tools: refine virtio gpu device in the schema


Yang, Yu-chu
 

From: Kunhui-Li <kunhuix.li@...>

this patch refines virtio gpu device in the schema for new design.

v2->v3
1. change the monitor_id xpath
2. replace dimension(s) to resolution(s)
3. add default value of monitor_id, offsets and resolution
4. set the display type to optional

Tracked-On: #7970
Signed-off-by: Kunhui-Li <kunhuix.li@...>
Signed-off-by: Yang,Yu-chu <yu-chu.yang@...>
---
misc/config_tools/schema/VMtypes.xsd | 76 ++++++++++++++++++++++++++++
misc/config_tools/schema/config.xsd | 5 +-
2 files changed, 78 insertions(+), 3 deletions(-)

diff --git a/misc/config_tools/schema/VMtypes.xsd b/misc/config_tools/schema/VMtypes.xsd
index b8364f853..98da4022a 100644
--- a/misc/config_tools/schema/VMtypes.xsd
+++ b/misc/config_tools/schema/VMtypes.xsd
@@ -373,6 +373,82 @@ The size is a subset of the VM's total memory size specified on the Basic tab.</
</xs:restriction>
</xs:simpleType>

+<xs:simpleType name="VirtioGPUDisplayType">
+ <xs:annotation>
+ <xs:documentation>A string with value: ``Window`` and ``Full screen``.</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="Window" />
+ <xs:enumeration value="Full screen" />
+ </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="WindowResolutionsType">
+ <xs:annotation>
+ <xs:documentation>Values of display window resolutions.</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="1920x1080" />
+ <xs:enumeration value="1680x1050" />
+ <xs:enumeration value="1600x900" />
+ <xs:enumeration value="1440x900" />
+ <xs:enumeration value="1400x1050" />
+ <xs:enumeration value="1366x768" />
+ <xs:enumeration value="1360x768" />
+ <xs:enumeration value="1280x1024" />
+ <xs:enumeration value="1280x960" />
+ <xs:enumeration value="1280x800" />
+ <xs:enumeration value="1280x768" />
+ <xs:enumeration value="1280x720" />
+ <xs:enumeration value="1280x600" />
+ <xs:enumeration value="1152x864" />
+ <xs:enumeration value="1024x768" />
+ <xs:enumeration value="800x600" />
+ </xs:restriction>
+</xs:simpleType>
+
+<xs:complexType name="DisplayConfiguration">
+ <xs:all>
+ <xs:element name="monitor_id" type="xs:integer" default="0">
+ <xs:annotation acrn:title="Monitor ID" acrn:options="//display/text()" acrn:options-sorted-by="int">
+ <xs:documentation>Monitor id specifies which physical monitor the virtual display locates in full screen mode.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="window_resolutions" type="WindowResolutionsType" default="800x600">
+ <xs:annotation acrn:title="Window resolutions">
+ <xs:documentation>Windows resolution specifies the virtual window size of user vm.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="horizontal_offset" type="xs:integer" default="0">
+ <xs:annotation acrn:title="Horizontal offset (pixels)">
+ <xs:documentation>Horizontal offset specifies the coordinate of the left top of virtual window.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="vertical_offset" type="xs:integer" default="0">
+ <xs:annotation acrn:title="Vertical offset (pixels)">
+ <xs:documentation>Vertical offset specifies the coordinate of the left top of virtual window.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:all>
+</xs:complexType>
+
+<xs:complexType name="DisplaysConfiguration">
+ <xs:sequence>
+ <xs:element name="display" type="DisplayConfiguration" maxOccurs="unbounded"/>
+ </xs:sequence>
+</xs:complexType>
+
+<xs:complexType name="VirtioGPUConfiguration">
+ <xs:all>
+ <xs:element name="display_type" type="VirtioGPUDisplayType" minOccurs="0">
+ <xs:annotation acrn:title="Display type">
+ <xs:documentation>Display type provide virtual display for user vm with either full screen mode or virtual window mode.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="displays" type="DisplaysConfiguration"/>
+ </xs:all>
+</xs:complexType>
+
<xs:complexType name="VirtioConsoleConfiguration">
<xs:all>
<xs:element name="use_type" type="VirtioConsoleUseType" default="Virtio console">
diff --git a/misc/config_tools/schema/config.xsd b/misc/config_tools/schema/config.xsd
index 65226e7af..b2f3462a6 100644
--- a/misc/config_tools/schema/config.xsd
+++ b/misc/config_tools/schema/config.xsd
@@ -465,9 +465,8 @@ argument and memory.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
- <xs:element name="gpu" type="xs:string" minOccurs="0">
- <xs:annotation acrn:title="Virtio GPU device" acrn:views="basic"
- acrn:widget-options="'placeholder': 'fullscreen or geometry=[width]x[height]+[x offset]+[y offset], e.g. geometry=1280x720+0+0 specifies a 1280 x 720 pixels region at the top left corner of the screen'">
+ <xs:element name="gpu" type="VirtioGPUConfiguration" minOccurs="0">
+ <xs:annotation acrn:title="Virtio GPU device" acrn:views="basic">
<xs:documentation>The virtio GPU device presents a GPU device to the VM.
This feature enables you to view the VM's GPU output in the Service VM.</xs:documentation>
</xs:annotation>
--
2.25.1


Junjie Mao
 

-----Original Message-----
From: Yang, Yu-chu <yu-chu.yang@...>
Sent: Friday, October 7, 2022 5:01 AM
To: acrn-dev@...
Cc: Mao, Junjie <junjie.mao@...>
Subject: [PATCH v3 1/5] config_tools: refine virtio gpu device in the schema

From: Kunhui-Li <kunhuix.li@...>

this patch refines virtio gpu device in the schema for new design.

v2->v3
1. change the monitor_id xpath
2. replace dimension(s) to resolution(s)
3. add default value of monitor_id, offsets and resolution
4. set the display type to optional

Tracked-On: #7970
Signed-off-by: Kunhui-Li <kunhuix.li@...>
Signed-off-by: Yang,Yu-chu <yu-chu.yang@...>
---
misc/config_tools/schema/VMtypes.xsd | 76 ++++++++++++++++++++++++++++
misc/config_tools/schema/config.xsd | 5 +-
2 files changed, 78 insertions(+), 3 deletions(-)

diff --git a/misc/config_tools/schema/VMtypes.xsd b/misc/config_tools/schema/VMtypes.xsd
index b8364f853..98da4022a 100644
--- a/misc/config_tools/schema/VMtypes.xsd
+++ b/misc/config_tools/schema/VMtypes.xsd
@@ -373,6 +373,82 @@ The size is a subset of the VM's total memory size specified on the
Basic tab.</
</xs:restriction>
</xs:simpleType>

+<xs:simpleType name="VirtioGPUDisplayType">
+ <xs:annotation>
+ <xs:documentation>A string with value: ``Window`` and ``Full
screen``.</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="Window" />
+ <xs:enumeration value="Full screen" />
+ </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="WindowResolutionsType">
+ <xs:annotation>
+ <xs:documentation>Values of display window resolutions.</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="1920x1080" />
+ <xs:enumeration value="1680x1050" />
+ <xs:enumeration value="1600x900" />
+ <xs:enumeration value="1440x900" />
+ <xs:enumeration value="1400x1050" />
+ <xs:enumeration value="1366x768" />
+ <xs:enumeration value="1360x768" />
+ <xs:enumeration value="1280x1024" />
+ <xs:enumeration value="1280x960" />
+ <xs:enumeration value="1280x800" />
+ <xs:enumeration value="1280x768" />
+ <xs:enumeration value="1280x720" />
+ <xs:enumeration value="1280x600" />
+ <xs:enumeration value="1152x864" />
+ <xs:enumeration value="1024x768" />
+ <xs:enumeration value="800x600" />
+ </xs:restriction>
+</xs:simpleType>
+
+<xs:complexType name="DisplayConfiguration">
+ <xs:all>
+ <xs:element name="monitor_id" type="xs:integer" default="0">
I remember in the last thread Yakui ever mentioned that there is no proper default values for the monitor ID. Have I missed anything?

+ <xs:annotation acrn:title="Monitor ID" acrn:options="//display/text()"
acrn:options-sorted-by="int">
+ <xs:documentation>Monitor id specifies which physical monitor the virtual display
locates in full screen mode.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="window_resolutions" type="WindowResolutionsType" default="800x600">
+ <xs:annotation acrn:title="Window resolutions">
+ <xs:documentation>Windows resolution specifies the virtual window size of user
vm.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="horizontal_offset" type="xs:integer" default="0">
+ <xs:annotation acrn:title="Horizontal offset (pixels)">
+ <xs:documentation>Horizontal offset specifies the coordinate of the left top of
virtual window.</xs:documentation>
The doc does not read quite right. How about "The abscissa (x-axis coordinate) of the left top point of the virtual window."

+ </xs:annotation>
+ </xs:element>
+ <xs:element name="vertical_offset" type="xs:integer" default="0">
+ <xs:annotation acrn:title="Vertical offset (pixels)">
+ <xs:documentation>Vertical offset specifies the coordinate of the left top of
virtual window.</xs:documentation>
Ditto. How about "The ordinate (x-axis coordinate) of the left top point of the virtual window."

+ </xs:annotation>
+ </xs:element>
+ </xs:all>
+</xs:complexType>
+
+<xs:complexType name="DisplaysConfiguration">
+ <xs:sequence>
+ <xs:element name="display" type="DisplayConfiguration" maxOccurs="unbounded"/>
+ </xs:sequence>
+</xs:complexType>
+
+<xs:complexType name="VirtioGPUConfiguration">
+ <xs:all>
+ <xs:element name="display_type" type="VirtioGPUDisplayType" minOccurs="0">
I cannot recall exactly, but I think a display type is always needed in the implementation. So make it optional may not be the best option; instead give it a default value (which can be the value used in the launch script generator when you see `display_type` missing).

---
Best Regards
Junjie Mao

+ <xs:annotation acrn:title="Display type">
+ <xs:documentation>Display type provide virtual display for user vm with either
full screen mode or virtual window mode.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="displays" type="DisplaysConfiguration"/>
+ </xs:all>
+</xs:complexType>
+
<xs:complexType name="VirtioConsoleConfiguration">
<xs:all>
<xs:element name="use_type" type="VirtioConsoleUseType" default="Virtio console">
diff --git a/misc/config_tools/schema/config.xsd b/misc/config_tools/schema/config.xsd
index 65226e7af..b2f3462a6 100644
--- a/misc/config_tools/schema/config.xsd
+++ b/misc/config_tools/schema/config.xsd
@@ -465,9 +465,8 @@ argument and memory.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
- <xs:element name="gpu" type="xs:string" minOccurs="0">
- <xs:annotation acrn:title="Virtio GPU device" acrn:views="basic"
- acrn:widget-options="'placeholder': 'fullscreen or
geometry=[width]x[height]+[x offset]+[y offset], e.g. geometry=1280x720+0+0 specifies a
1280 x 720 pixels region at the top left corner of the screen'">
+ <xs:element name="gpu" type="VirtioGPUConfiguration" minOccurs="0">
+ <xs:annotation acrn:title="Virtio GPU device" acrn:views="basic">
<xs:documentation>The virtio GPU device presents a GPU device to the VM.
This feature enables you to view the VM's GPU output in the Service VM.</xs:documentation>
</xs:annotation>
--
2.25.1


Yang, Yu-chu
 

-----Original Message-----
From: Mao, Junjie <junjie.mao@...>
Sent: Friday, October 7, 2022 6:33 PM
To: Yang, Yu-chu <yu-chu.yang@...>; acrn-dev@...
Subject: RE: [PATCH v3 1/5] config_tools: refine virtio gpu device in the schema

-----Original Message-----
From: Yang, Yu-chu <yu-chu.yang@...>
Sent: Friday, October 7, 2022 5:01 AM
To: acrn-dev@...
Cc: Mao, Junjie <junjie.mao@...>
Subject: [PATCH v3 1/5] config_tools: refine virtio gpu device in the
schema

From: Kunhui-Li <kunhuix.li@...>

this patch refines virtio gpu device in the schema for new design.

v2->v3
1. change the monitor_id xpath
2. replace dimension(s) to resolution(s) 3. add default value of
monitor_id, offsets and resolution 4. set the display type to optional

Tracked-On: #7970
Signed-off-by: Kunhui-Li <kunhuix.li@...>
Signed-off-by: Yang,Yu-chu <yu-chu.yang@...>
---
misc/config_tools/schema/VMtypes.xsd | 76
++++++++++++++++++++++++++++ misc/config_tools/schema/config.xsd |
5 +-
2 files changed, 78 insertions(+), 3 deletions(-)

diff --git a/misc/config_tools/schema/VMtypes.xsd
b/misc/config_tools/schema/VMtypes.xsd
index b8364f853..98da4022a 100644
--- a/misc/config_tools/schema/VMtypes.xsd
+++ b/misc/config_tools/schema/VMtypes.xsd
@@ -373,6 +373,82 @@ The size is a subset of the VM's total memory
size specified on the Basic tab.</
</xs:restriction>
</xs:simpleType>

+<xs:simpleType name="VirtioGPUDisplayType">
+ <xs:annotation>
+ <xs:documentation>A string with value: ``Window`` and ``Full
screen``.</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="Window" />
+ <xs:enumeration value="Full screen" />
+ </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="WindowResolutionsType">
+ <xs:annotation>
+ <xs:documentation>Values of display window
+resolutions.</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="1920x1080" />
+ <xs:enumeration value="1680x1050" />
+ <xs:enumeration value="1600x900" />
+ <xs:enumeration value="1440x900" />
+ <xs:enumeration value="1400x1050" />
+ <xs:enumeration value="1366x768" />
+ <xs:enumeration value="1360x768" />
+ <xs:enumeration value="1280x1024" />
+ <xs:enumeration value="1280x960" />
+ <xs:enumeration value="1280x800" />
+ <xs:enumeration value="1280x768" />
+ <xs:enumeration value="1280x720" />
+ <xs:enumeration value="1280x600" />
+ <xs:enumeration value="1152x864" />
+ <xs:enumeration value="1024x768" />
+ <xs:enumeration value="800x600" />
+ </xs:restriction>
+</xs:simpleType>
+
+<xs:complexType name="DisplayConfiguration">
+ <xs:all>
+ <xs:element name="monitor_id" type="xs:integer" default="0">
I remember in the last thread Yakui ever mentioned that there is no proper default values for the monitor ID. Have I missed anything?
Since the "DisplayConfiguration" is required, any elements in this type would be required unless it sets to optional(minOccurs=0).
To avoid the validation failure, it'd be optional or have a default value.

Thanks,
Yu-chu

+ <xs:annotation acrn:title="Monitor ID" acrn:options="//display/text()"
acrn:options-sorted-by="int">
+ <xs:documentation>Monitor id specifies which physical monitor
+ the virtual display
locates in full screen mode.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="window_resolutions" type="WindowResolutionsType" default="800x600">
+ <xs:annotation acrn:title="Window resolutions">
+ <xs:documentation>Windows resolution specifies the virtual
+ window size of user
vm.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="horizontal_offset" type="xs:integer" default="0">
+ <xs:annotation acrn:title="Horizontal offset (pixels)">
+ <xs:documentation>Horizontal offset specifies the coordinate
+ of the left top of
virtual window.</xs:documentation>
The doc does not read quite right. How about "The abscissa (x-axis coordinate) of the left top point of the virtual window."

+ </xs:annotation>
+ </xs:element>
+ <xs:element name="vertical_offset" type="xs:integer" default="0">
+ <xs:annotation acrn:title="Vertical offset (pixels)">
+ <xs:documentation>Vertical offset specifies the coordinate of
+ the left top of
virtual window.</xs:documentation>
Ditto. How about "The ordinate (x-axis coordinate) of the left top point of the virtual window."

+ </xs:annotation>
+ </xs:element>
+ </xs:all>
+</xs:complexType>
+
+<xs:complexType name="DisplaysConfiguration">
+ <xs:sequence>
+ <xs:element name="display" type="DisplayConfiguration"
+maxOccurs="unbounded"/>
+ </xs:sequence>
+</xs:complexType>
+
+<xs:complexType name="VirtioGPUConfiguration">
+ <xs:all>
+ <xs:element name="display_type" type="VirtioGPUDisplayType"
+minOccurs="0">
I cannot recall exactly, but I think a display type is always needed in the implementation. So make it optional may not be the best option; instead give it a default value (which can be the value used in the launch script generator when you see `display_type` missing).

---
Best Regards
Junjie Mao

+ <xs:annotation acrn:title="Display type">
+ <xs:documentation>Display type provide virtual display for
+ user vm with either
full screen mode or virtual window mode.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="displays" type="DisplaysConfiguration"/>
+ </xs:all>
+</xs:complexType>
+
<xs:complexType name="VirtioConsoleConfiguration">
<xs:all>
<xs:element name="use_type" type="VirtioConsoleUseType"
default="Virtio console"> diff --git
a/misc/config_tools/schema/config.xsd
b/misc/config_tools/schema/config.xsd
index 65226e7af..b2f3462a6 100644
--- a/misc/config_tools/schema/config.xsd
+++ b/misc/config_tools/schema/config.xsd
@@ -465,9 +465,8 @@ argument and memory.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
- <xs:element name="gpu" type="xs:string" minOccurs="0">
- <xs:annotation acrn:title="Virtio GPU device" acrn:views="basic"
- acrn:widget-options="'placeholder': 'fullscreen or
geometry=[width]x[height]+[x offset]+[y offset], e.g.
geometry=1280x720+0+0 specifies a
1280 x 720 pixels region at the top left corner of the screen'">
+ <xs:element name="gpu" type="VirtioGPUConfiguration" minOccurs="0">
+ <xs:annotation acrn:title="Virtio GPU device"
+ acrn:views="basic">
<xs:documentation>The virtio GPU device presents a GPU device to the VM.
This feature enables you to view the VM's GPU output in the Service VM.</xs:documentation>
</xs:annotation>
--
2.25.1


Junjie Mao
 

-----Original Message-----
From: Yang, Yu-chu <yu-chu.yang@...>
Sent: Friday, October 14, 2022 7:08 AM
To: Mao, Junjie <junjie.mao@...>; acrn-dev@...
Subject: RE: [PATCH v3 1/5] config_tools: refine virtio gpu device in the schema



-----Original Message-----
From: Mao, Junjie <junjie.mao@...>
Sent: Friday, October 7, 2022 6:33 PM
To: Yang, Yu-chu <yu-chu.yang@...>; acrn-dev@...
Subject: RE: [PATCH v3 1/5] config_tools: refine virtio gpu device in the schema

-----Original Message-----
From: Yang, Yu-chu <yu-chu.yang@...>
Sent: Friday, October 7, 2022 5:01 AM
To: acrn-dev@...
Cc: Mao, Junjie <junjie.mao@...>
Subject: [PATCH v3 1/5] config_tools: refine virtio gpu device in the
schema

From: Kunhui-Li <kunhuix.li@...>

this patch refines virtio gpu device in the schema for new design.

v2->v3
1. change the monitor_id xpath
2. replace dimension(s) to resolution(s) 3. add default value of
monitor_id, offsets and resolution 4. set the display type to optional

Tracked-On: #7970
Signed-off-by: Kunhui-Li <kunhuix.li@...>
Signed-off-by: Yang,Yu-chu <yu-chu.yang@...>
---
misc/config_tools/schema/VMtypes.xsd | 76
++++++++++++++++++++++++++++ misc/config_tools/schema/config.xsd |
5 +-
2 files changed, 78 insertions(+), 3 deletions(-)

diff --git a/misc/config_tools/schema/VMtypes.xsd
b/misc/config_tools/schema/VMtypes.xsd
index b8364f853..98da4022a 100644
--- a/misc/config_tools/schema/VMtypes.xsd
+++ b/misc/config_tools/schema/VMtypes.xsd
@@ -373,6 +373,82 @@ The size is a subset of the VM's total memory
size specified on the Basic tab.</
</xs:restriction>
</xs:simpleType>

+<xs:simpleType name="VirtioGPUDisplayType">
+ <xs:annotation>
+ <xs:documentation>A string with value: ``Window`` and ``Full
screen``.</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="Window" />
+ <xs:enumeration value="Full screen" />
+ </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="WindowResolutionsType">
+ <xs:annotation>
+ <xs:documentation>Values of display window
+resolutions.</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="1920x1080" />
+ <xs:enumeration value="1680x1050" />
+ <xs:enumeration value="1600x900" />
+ <xs:enumeration value="1440x900" />
+ <xs:enumeration value="1400x1050" />
+ <xs:enumeration value="1366x768" />
+ <xs:enumeration value="1360x768" />
+ <xs:enumeration value="1280x1024" />
+ <xs:enumeration value="1280x960" />
+ <xs:enumeration value="1280x800" />
+ <xs:enumeration value="1280x768" />
+ <xs:enumeration value="1280x720" />
+ <xs:enumeration value="1280x600" />
+ <xs:enumeration value="1152x864" />
+ <xs:enumeration value="1024x768" />
+ <xs:enumeration value="800x600" />
+ </xs:restriction>
+</xs:simpleType>
+
+<xs:complexType name="DisplayConfiguration">
+ <xs:all>
+ <xs:element name="monitor_id" type="xs:integer" default="0">
I remember in the last thread Yakui ever mentioned that there is no proper default
values for the monitor ID. Have I missed anything?

Since the "DisplayConfiguration" is required, any elements in this type would be required
unless it sets to optional(minOccurs=0).
To avoid the validation failure, it'd be optional or have a default value.

Thanks,
Yu-chu
Validation errors are not something to be avoided by design. Instead they are meant to capture missing or inconsistent inputs from users.

Whether we need a default value for an item depends on whether a user must specify something explicitly (probably because there is no reasonable defaults, such as CPU affinity).

I'm personally fine either a default of 0 is given or no default is specified for "monitor_id". Please align w/ Yakui and Peng, though.

---
Best Regards
Junjie Mao

+ <xs:annotation acrn:title="Monitor ID" acrn:options="//display/text()"
acrn:options-sorted-by="int">
+ <xs:documentation>Monitor id specifies which physical monitor
+ the virtual display
locates in full screen mode.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="window_resolutions" type="WindowResolutionsType"
default="800x600">
+ <xs:annotation acrn:title="Window resolutions">
+ <xs:documentation>Windows resolution specifies the virtual
+ window size of user
vm.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="horizontal_offset" type="xs:integer" default="0">
+ <xs:annotation acrn:title="Horizontal offset (pixels)">
+ <xs:documentation>Horizontal offset specifies the coordinate
+ of the left top of
virtual window.</xs:documentation>
The doc does not read quite right. How about "The abscissa (x-axis coordinate) of the left
top point of the virtual window."

+ </xs:annotation>
+ </xs:element>
+ <xs:element name="vertical_offset" type="xs:integer" default="0">
+ <xs:annotation acrn:title="Vertical offset (pixels)">
+ <xs:documentation>Vertical offset specifies the coordinate of
+ the left top of
virtual window.</xs:documentation>
Ditto. How about "The ordinate (x-axis coordinate) of the left top point of the virtual
window."

+ </xs:annotation>
+ </xs:element>
+ </xs:all>
+</xs:complexType>
+
+<xs:complexType name="DisplaysConfiguration">
+ <xs:sequence>
+ <xs:element name="display" type="DisplayConfiguration"
+maxOccurs="unbounded"/>
+ </xs:sequence>
+</xs:complexType>
+
+<xs:complexType name="VirtioGPUConfiguration">
+ <xs:all>
+ <xs:element name="display_type" type="VirtioGPUDisplayType"
+minOccurs="0">
I cannot recall exactly, but I think a display type is always needed in the implementation.
So make it optional may not be the best option; instead give it a default value (which can
be the value used in the launch script generator when you see `display_type` missing).

---
Best Regards
Junjie Mao

+ <xs:annotation acrn:title="Display type">
+ <xs:documentation>Display type provide virtual display for
+ user vm with either
full screen mode or virtual window mode.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="displays" type="DisplaysConfiguration"/>
+ </xs:all>
+</xs:complexType>
+
<xs:complexType name="VirtioConsoleConfiguration">
<xs:all>
<xs:element name="use_type" type="VirtioConsoleUseType"
default="Virtio console"> diff --git
a/misc/config_tools/schema/config.xsd
b/misc/config_tools/schema/config.xsd
index 65226e7af..b2f3462a6 100644
--- a/misc/config_tools/schema/config.xsd
+++ b/misc/config_tools/schema/config.xsd
@@ -465,9 +465,8 @@ argument and memory.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
- <xs:element name="gpu" type="xs:string" minOccurs="0">
- <xs:annotation acrn:title="Virtio GPU device" acrn:views="basic"
- acrn:widget-options="'placeholder': 'fullscreen or
geometry=[width]x[height]+[x offset]+[y offset], e.g.
geometry=1280x720+0+0 specifies a
1280 x 720 pixels region at the top left corner of the screen'">
+ <xs:element name="gpu" type="VirtioGPUConfiguration" minOccurs="0">
+ <xs:annotation acrn:title="Virtio GPU device"
+ acrn:views="basic">
<xs:documentation>The virtio GPU device presents a GPU device to the VM.
This feature enables you to view the VM's GPU output in the Service
VM.</xs:documentation>
</xs:annotation>
--
2.25.1


Junjie Mao
 

-----Original Message-----
From: acrn-dev@... <acrn-dev@...> On Behalf Of Junjie
Mao
Sent: Friday, October 14, 2022 8:32 AM
To: Yang, Yu-chu <yu-chu.yang@...>; acrn-dev@...
Subject: Re: [acrn-dev] [PATCH v3 1/5] config_tools: refine virtio gpu device in the
schema

-----Original Message-----
From: Yang, Yu-chu <yu-chu.yang@...>
Sent: Friday, October 14, 2022 7:08 AM
To: Mao, Junjie <junjie.mao@...>; acrn-dev@...
Subject: RE: [PATCH v3 1/5] config_tools: refine virtio gpu device in the schema



-----Original Message-----
From: Mao, Junjie <junjie.mao@...>
Sent: Friday, October 7, 2022 6:33 PM
To: Yang, Yu-chu <yu-chu.yang@...>; acrn-dev@...
Subject: RE: [PATCH v3 1/5] config_tools: refine virtio gpu device in the schema

-----Original Message-----
From: Yang, Yu-chu <yu-chu.yang@...>
Sent: Friday, October 7, 2022 5:01 AM
To: acrn-dev@...
Cc: Mao, Junjie <junjie.mao@...>
Subject: [PATCH v3 1/5] config_tools: refine virtio gpu device in the
schema

From: Kunhui-Li <kunhuix.li@...>

this patch refines virtio gpu device in the schema for new design.

v2->v3
1. change the monitor_id xpath
2. replace dimension(s) to resolution(s) 3. add default value of
monitor_id, offsets and resolution 4. set the display type to optional

Tracked-On: #7970
Signed-off-by: Kunhui-Li <kunhuix.li@...>
Signed-off-by: Yang,Yu-chu <yu-chu.yang@...>
---
misc/config_tools/schema/VMtypes.xsd | 76
++++++++++++++++++++++++++++ misc/config_tools/schema/config.xsd |
5 +-
2 files changed, 78 insertions(+), 3 deletions(-)

diff --git a/misc/config_tools/schema/VMtypes.xsd
b/misc/config_tools/schema/VMtypes.xsd
index b8364f853..98da4022a 100644
--- a/misc/config_tools/schema/VMtypes.xsd
+++ b/misc/config_tools/schema/VMtypes.xsd
@@ -373,6 +373,82 @@ The size is a subset of the VM's total memory
size specified on the Basic tab.</
</xs:restriction>
</xs:simpleType>

+<xs:simpleType name="VirtioGPUDisplayType">
+ <xs:annotation>
+ <xs:documentation>A string with value: ``Window`` and ``Full
screen``.</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="Window" />
+ <xs:enumeration value="Full screen" />
+ </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="WindowResolutionsType">
+ <xs:annotation>
+ <xs:documentation>Values of display window
+resolutions.</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="1920x1080" />
+ <xs:enumeration value="1680x1050" />
+ <xs:enumeration value="1600x900" />
+ <xs:enumeration value="1440x900" />
+ <xs:enumeration value="1400x1050" />
+ <xs:enumeration value="1366x768" />
+ <xs:enumeration value="1360x768" />
+ <xs:enumeration value="1280x1024" />
+ <xs:enumeration value="1280x960" />
+ <xs:enumeration value="1280x800" />
+ <xs:enumeration value="1280x768" />
+ <xs:enumeration value="1280x720" />
+ <xs:enumeration value="1280x600" />
+ <xs:enumeration value="1152x864" />
+ <xs:enumeration value="1024x768" />
+ <xs:enumeration value="800x600" />
+ </xs:restriction>
+</xs:simpleType>
+
+<xs:complexType name="DisplayConfiguration">
+ <xs:all>
+ <xs:element name="monitor_id" type="xs:integer" default="0">
I remember in the last thread Yakui ever mentioned that there is no proper default
values for the monitor ID. Have I missed anything?

Since the "DisplayConfiguration" is required, any elements in this type would be
required
unless it sets to optional(minOccurs=0).
To avoid the validation failure, it'd be optional or have a default value.

Thanks,
Yu-chu
Validation errors are not something to be avoided by design. Instead they are meant to
capture missing or inconsistent inputs from users.

Whether we need a default value for an item depends on whether a user must specify
something explicitly (probably because there is no reasonable defaults, such as CPU
affinity).

I'm personally fine either a default of 0 is given or no default is specified for
"monitor_id". Please align w/ Yakui and Peng, though.
After checking your latest version, I think by "avoid the validation failure", you mean "monitor_id" is mandatory only in full screen mode. Is that your intention?

---
Best Regards
Junjie Mao

+ <xs:annotation acrn:title="Monitor ID" acrn:options="//display/text()"
acrn:options-sorted-by="int">
+ <xs:documentation>Monitor id specifies which physical monitor
+ the virtual display
locates in full screen mode.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="window_resolutions" type="WindowResolutionsType"
default="800x600">
+ <xs:annotation acrn:title="Window resolutions">
+ <xs:documentation>Windows resolution specifies the virtual
+ window size of user
vm.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="horizontal_offset" type="xs:integer" default="0">
+ <xs:annotation acrn:title="Horizontal offset (pixels)">
+ <xs:documentation>Horizontal offset specifies the coordinate
+ of the left top of
virtual window.</xs:documentation>
The doc does not read quite right. How about "The abscissa (x-axis coordinate) of the
left
top point of the virtual window."

+ </xs:annotation>
+ </xs:element>
+ <xs:element name="vertical_offset" type="xs:integer" default="0">
+ <xs:annotation acrn:title="Vertical offset (pixels)">
+ <xs:documentation>Vertical offset specifies the coordinate of
+ the left top of
virtual window.</xs:documentation>
Ditto. How about "The ordinate (x-axis coordinate) of the left top point of the virtual
window."

+ </xs:annotation>
+ </xs:element>
+ </xs:all>
+</xs:complexType>
+
+<xs:complexType name="DisplaysConfiguration">
+ <xs:sequence>
+ <xs:element name="display" type="DisplayConfiguration"
+maxOccurs="unbounded"/>
+ </xs:sequence>
+</xs:complexType>
+
+<xs:complexType name="VirtioGPUConfiguration">
+ <xs:all>
+ <xs:element name="display_type" type="VirtioGPUDisplayType"
+minOccurs="0">
I cannot recall exactly, but I think a display type is always needed in the
implementation.
So make it optional may not be the best option; instead give it a default value (which
can
be the value used in the launch script generator when you see `display_type` missing).

---
Best Regards
Junjie Mao

+ <xs:annotation acrn:title="Display type">
+ <xs:documentation>Display type provide virtual display for
+ user vm with either
full screen mode or virtual window mode.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="displays" type="DisplaysConfiguration"/>
+ </xs:all>
+</xs:complexType>
+
<xs:complexType name="VirtioConsoleConfiguration">
<xs:all>
<xs:element name="use_type" type="VirtioConsoleUseType"
default="Virtio console"> diff --git
a/misc/config_tools/schema/config.xsd
b/misc/config_tools/schema/config.xsd
index 65226e7af..b2f3462a6 100644
--- a/misc/config_tools/schema/config.xsd
+++ b/misc/config_tools/schema/config.xsd
@@ -465,9 +465,8 @@ argument and memory.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
- <xs:element name="gpu" type="xs:string" minOccurs="0">
- <xs:annotation acrn:title="Virtio GPU device" acrn:views="basic"
- acrn:widget-options="'placeholder': 'fullscreen or
geometry=[width]x[height]+[x offset]+[y offset], e.g.
geometry=1280x720+0+0 specifies a
1280 x 720 pixels region at the top left corner of the screen'">
+ <xs:element name="gpu" type="VirtioGPUConfiguration" minOccurs="0">
+ <xs:annotation acrn:title="Virtio GPU device"
+ acrn:views="basic">
<xs:documentation>The virtio GPU device presents a GPU device to the VM.
This feature enables you to view the VM's GPU output in the Service
VM.</xs:documentation>
</xs:annotation>
--
2.25.1