Date
1 - 1 of 1
[PATCH v4 2/5] config_tools: refine virtio gpu in launch script
Yang, Yu-chu
From: Kunhui-Li <kunhuix.li@...>
If display type is "Windows", the generated launch script will follow
the below rule.
"virtio-gpu,geometry=<width>x<height>+<x_off>+<y_off>,geometry=<width>x<height>+<x_off>+<y_off>"
If display type is "Full screen", the generated launch script look like
this. For example:
"virtio-gpu,geometry=fullscreen:0,geometry=fullscreen:1"
Tracked-On: #7970
Signed-off-by: Kunhui-Li <kunhuix.li@...>
Signed-off-by: Yang,Yu-chu <yu-chu.yang@...>
Reviewed-by: Junjie Mao <junjie.mao@...>
---
.../config_tools/launch_config/launch_cfg_gen.py | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/misc/config_tools/launch_config/launch_cfg_gen.py b/misc/config_tools/launch_config/launch_cfg_gen.py
index 7c4668013..05ed0a396 100755
--- a/misc/config_tools/launch_config/launch_cfg_gen.py
+++ b/misc/config_tools/launch_config/launch_cfg_gen.py
@@ -373,9 +373,19 @@ def generate_for_one_vm(board_etree, hv_scenario_etree, vm_scenario_etree, vm_id
script.add_virtual_device("virtio-blk", options=os.path.join(f"${{{var}}}", rootfs_img))
script.add_deinit_command(f"unmount_partition ${{{var}}}")
- for virtio_gpu in eval_xpath_all(vm_scenario_etree, ".//virtio_devices/gpu[text() != '']/text()"):
- if virtio_gpu is not None:
- script.add_virtual_device("virtio-gpu", options=virtio_gpu)
+ for gpu_etree in eval_xpath_all(vm_scenario_etree, ".//virtio_devices/gpu"):
+ display_type = eval_xpath(gpu_etree, "./display_type[text() != '']/text()")
+ params = list()
+ for display_etree in eval_xpath_all(gpu_etree, "./displays/display"):
+ if display_type == "Window":
+ window_resolutions = eval_xpath(display_etree, "./window_resolutions/text()")
+ horizontal_offset = eval_xpath(display_etree, "./horizontal_offset/text()")
+ vertical_offset = eval_xpath(display_etree, "./vertical_offset/text()")
+ params.append(f"geometry={window_resolutions}+{horizontal_offset}+{vertical_offset}")
+ if display_type == "Full screen":
+ monitor_id = eval_xpath(display_etree, "./monitor_id/text()")
+ params.append(f"geometry=fullscreen:{monitor_id}")
+ script.add_virtual_device("virtio-gpu", options=",".join(params))
for vsock in eval_xpath_all(vm_scenario_etree, ".//virtio_devices/vsock[text() != '']/text()"):
script.add_virtual_device("vhost-vsock", options="cid="+vsock)
--
2.25.1
If display type is "Windows", the generated launch script will follow
the below rule.
"virtio-gpu,geometry=<width>x<height>+<x_off>+<y_off>,geometry=<width>x<height>+<x_off>+<y_off>"
If display type is "Full screen", the generated launch script look like
this. For example:
"virtio-gpu,geometry=fullscreen:0,geometry=fullscreen:1"
Tracked-On: #7970
Signed-off-by: Kunhui-Li <kunhuix.li@...>
Signed-off-by: Yang,Yu-chu <yu-chu.yang@...>
Reviewed-by: Junjie Mao <junjie.mao@...>
---
.../config_tools/launch_config/launch_cfg_gen.py | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/misc/config_tools/launch_config/launch_cfg_gen.py b/misc/config_tools/launch_config/launch_cfg_gen.py
index 7c4668013..05ed0a396 100755
--- a/misc/config_tools/launch_config/launch_cfg_gen.py
+++ b/misc/config_tools/launch_config/launch_cfg_gen.py
@@ -373,9 +373,19 @@ def generate_for_one_vm(board_etree, hv_scenario_etree, vm_scenario_etree, vm_id
script.add_virtual_device("virtio-blk", options=os.path.join(f"${{{var}}}", rootfs_img))
script.add_deinit_command(f"unmount_partition ${{{var}}}")
- for virtio_gpu in eval_xpath_all(vm_scenario_etree, ".//virtio_devices/gpu[text() != '']/text()"):
- if virtio_gpu is not None:
- script.add_virtual_device("virtio-gpu", options=virtio_gpu)
+ for gpu_etree in eval_xpath_all(vm_scenario_etree, ".//virtio_devices/gpu"):
+ display_type = eval_xpath(gpu_etree, "./display_type[text() != '']/text()")
+ params = list()
+ for display_etree in eval_xpath_all(gpu_etree, "./displays/display"):
+ if display_type == "Window":
+ window_resolutions = eval_xpath(display_etree, "./window_resolutions/text()")
+ horizontal_offset = eval_xpath(display_etree, "./horizontal_offset/text()")
+ vertical_offset = eval_xpath(display_etree, "./vertical_offset/text()")
+ params.append(f"geometry={window_resolutions}+{horizontal_offset}+{vertical_offset}")
+ if display_type == "Full screen":
+ monitor_id = eval_xpath(display_etree, "./monitor_id/text()")
+ params.append(f"geometry=fullscreen:{monitor_id}")
+ script.add_virtual_device("virtio-gpu", options=",".join(params))
for vsock in eval_xpath_all(vm_scenario_etree, ".//virtio_devices/vsock[text() != '']/text()"):
script.add_virtual_device("vhost-vsock", options="cid="+vsock)
--
2.25.1