@@ -1418,7 +1418,7 @@ type disp_intf_opt =
14181418(*  Display output / keyboard input *) 
14191419type  disp_opt  =
14201420	| NONE 
1421- 	| VNC  of  disp_intf_opt  *  string  option  *  bool  *  int  *  string  (*  IP address, auto-allocate, port if previous false, keymap *) 
1421+ 	| VNC  of  disp_intf_opt  *  string  option  *  bool  *  int  *  string  option   (*  IP address, auto-allocate, port if previous false, keymap *) 
14221422	| SDL  of  disp_intf_opt  *  string  (*  X11 display *) 
14231423
14241424type  media  = Disk  | Cdrom 
@@ -1528,40 +1528,42 @@ let cmdline_of_disp info =
15281528		match  x with 
15291529		|  Vgpu  [{implementation =  Nvidia  _}] -> [" -vgpu" 
15301530		|  Vgpu  [{implementation =  GVT_g  gvt_g}] ->
1531- 			[
1531+ 			let  base_opts  =   [
15321532				" -xengt" 
15331533				" -vgt_low_gm_sz" Int64. to_string gvt_g.low_gm_sz;
15341534				" -vgt_high_gm_sz" Int64. to_string gvt_g.high_gm_sz;
15351535				" -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" 
1540- 				|  None  -> [] 
1541- 			) @  [
1542- 				" -priv" 
15431536			]
1537+ 			and  config_file_opt =  match  gvt_g.monitor_config_file with 
1538+ 			|  Some  path  -> [" -vgt_monitor_config_file" 
1539+ 			|  None  -> [] 
1540+ 			and  priv_opt =  [" -priv" in 
1541+ 			List. flatten [base_opts; config_file_opt; priv_opt]
15441542		|  Vgpu  _  -> failwith " Unsupported vGPU configuration" 
15451543		|  Std_vga  -> [" -std-vga" 
15461544		|  Cirrus  -> [] 
15471545		|  GVT_d  -> [" -std-vga" " -gfx_passthru" 
15481546	in 
15491547	let  videoram_opt =  [" -videoram" in 
1548+ 	let  vnc_opts_of  ip_addr_opt  auto  port  keymap  = 
1549+ 		let  unused_opt =  if  auto then  [" -vncunused" else  []  in 
1550+ 		let  vnc_opt = 
1551+ 			let  ip_addr =  Opt. default " 127.0.0.1" 
1552+ 			and  port =  if  auto then  " 1" else  string_of_int port in 
1553+ 			[" -vnc" ^  " :" ^  port] in 
1554+ 		let  keymap_opt =  match  keymap with  Some  k  ->  [" -k" |  None  ->  []  in 
1555+ 		List. flatten [unused_opt; vnc_opt; keymap_opt]
1556+ 	in 
15501557	let  disp_options, wait_for_port = 
15511558		match  info.disp with 
15521559		|  NONE  -> 
1553- 		     ([] , false )
1554- 		|  SDL  (opts ,x11name ) ->
1555- 		    (  [] , false )
1560+ 			 ([] , false )
1561+ 		|  SDL  (opts ,  x11name ) ->
1562+ 			( [] , false )
15561563		|  VNC  (disp_intf , ip_addr_opt , auto , port , keymap ) ->
1557- 			let  ip_addr =  Opt. default " 127.0.0.1" in 
1558- 		    let  vga_type_opts =  vga_type_opts disp_intf in 
1559- 		    let  vnc_opts =  
1560- 		      if  auto
1561- 		      then  [ " -vncunused" " -k" " -vnc" ^  " :1" 
1562- 		      else  [ " -vnc" ^  " :" ^  (string_of_int port); " -k" 
1563- 		    in 
1564- 				(vga_type_opts @  videoram_opt @  vnc_opts), true 
1564+ 			let  vga_type_opts =  vga_type_opts disp_intf in 
1565+ 			let  vnc_opts =  vnc_opts_of ip_addr_opt auto port keymap in 
1566+ 			(vga_type_opts @  videoram_opt @  vnc_opts), true 
15651567	in 
15661568	disp_options, wait_for_port
15671569
0 commit comments