Skip to content

Commit 8910850

Browse files
CP-17631: Use combine_opts to simplify vga options
Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
1 parent 7533f67 commit 8910850

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

xc/device.ml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,35 +1523,33 @@ let get_state ~xs ~qemu_domid domid =
15231523
with _ -> None
15241524

15251525
let cmdline_of_disp info =
1526+
let combine_opts : bytes list option list -> bytes list = fun opts ->
1527+
List.map (function Some x -> x | _ -> []) opts
1528+
|> List.filter (function [] -> false | _ -> true)
1529+
|> List.flatten in
15261530
let vga_type_opts x =
15271531
let open Xenops_interface.Vgpu in
15281532
match x with
15291533
| Vgpu [{implementation = Nvidia _}] -> ["-vgpu"]
15301534
| Vgpu [{implementation = GVT_g gvt_g}] ->
1531-
[
1535+
let base_opts = Some [
15321536
"-xengt";
15331537
"-vgt_low_gm_sz"; Int64.to_string gvt_g.low_gm_sz;
15341538
"-vgt_high_gm_sz"; Int64.to_string gvt_g.high_gm_sz;
15351539
"-vgt_fence_sz"; Int64.to_string gvt_g.fence_sz;
1536-
] @ (
1537-
match gvt_g.monitor_config_file with
1538-
| Some monitor_config_file ->
1539-
["-vgt_monitor_config_file"; monitor_config_file]
1540-
| None -> []
1541-
) @ [
1542-
"-priv"
15431540
]
1541+
and config_file_opt = match gvt_g.monitor_config_file with
1542+
| Some path -> Some ["-vgt_monitor_config_file"; path]
1543+
| None -> None
1544+
and priv_opt = Some ["-priv"] in
1545+
combine_opts [base_opts; config_file_opt; priv_opt]
15441546
| Vgpu _ -> failwith "Unsupported vGPU configuration"
15451547
| Std_vga -> ["-std-vga"]
15461548
| Cirrus -> []
15471549
| GVT_d -> ["-std-vga"; "-gfx_passthru"]
15481550
in
15491551
let videoram_opt = ["-videoram"; string_of_int info.video_mib] in
15501552
let vnc_opts_of ip_addr_opt auto port keymap =
1551-
let combine_opts : bytes list option list -> bytes list = fun opts ->
1552-
List.map (function Some x -> x | _ -> []) opts
1553-
|> List.filter (function [] -> false | _ -> true)
1554-
|> List.flatten in
15551553
let ip_addr = Opt.default "127.0.0.1" ip_addr_opt in
15561554
let port = if auto then "1" else string_of_int port in
15571555
let unused_opt = if auto then Some ["-vncunused"] else None in

0 commit comments

Comments
 (0)