vl: add -vga help support
Provide help output similar to other argument help handling: $ qemu-system-x86_64 -vga help none std standard VGA (default) cirrus Cirrus VGA vmware VMWare SVGA xenfb qxl QXL VGA virtio Virtio VG Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20190412152713.16018-3-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
		
							parent
							
								
									53b93511f1
								
							
						
					
					
						commit
						dceb885255
					
				
							
								
								
									
										40
									
								
								vl.c
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								vl.c
									
									
									
									
									
								
							| @ -2069,11 +2069,39 @@ static bool vga_interface_available(VGAInterfaceType t) | |||||||
|            object_class_by_name(ti->class_names[1]); |            object_class_by_name(ti->class_names[1]); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void select_vgahw(const char *p) | static const char * | ||||||
|  | get_default_vga_model(const MachineClass *machine_class) | ||||||
|  | { | ||||||
|  |     if (machine_class->default_display) { | ||||||
|  |         return machine_class->default_display; | ||||||
|  |     } else if (vga_interface_available(VGA_CIRRUS)) { | ||||||
|  |         return "cirrus"; | ||||||
|  |     } else if (vga_interface_available(VGA_STD)) { | ||||||
|  |         return "std"; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return NULL; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static void select_vgahw(const MachineClass *machine_class, const char *p) | ||||||
| { | { | ||||||
|     const char *opts; |     const char *opts; | ||||||
|     int t; |     int t; | ||||||
| 
 | 
 | ||||||
|  |     if (g_str_equal(p, "help")) { | ||||||
|  |         const char *def = get_default_vga_model(machine_class); | ||||||
|  | 
 | ||||||
|  |         for (t = 0; t < VGA_TYPE_MAX; t++) { | ||||||
|  |             const VGAInterfaceInfo *ti = &vga_interfaces[t]; | ||||||
|  | 
 | ||||||
|  |             if (vga_interface_available(t) && ti->opt_name) { | ||||||
|  |                 printf("%-20s %s%s\n", ti->opt_name, ti->name ?: "", | ||||||
|  |                        g_str_equal(ti->opt_name, def) ? " (default)" : ""); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         exit(0); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     assert(vga_interface_type == VGA_NONE); |     assert(vga_interface_type == VGA_NONE); | ||||||
|     for (t = 0; t < VGA_TYPE_MAX; t++) { |     for (t = 0; t < VGA_TYPE_MAX; t++) { | ||||||
|         const VGAInterfaceInfo *ti = &vga_interfaces[t]; |         const VGAInterfaceInfo *ti = &vga_interfaces[t]; | ||||||
| @ -4424,16 +4452,10 @@ int main(int argc, char **argv, char **envp) | |||||||
| 
 | 
 | ||||||
|     /* If no default VGA is requested, the default is "none".  */ |     /* If no default VGA is requested, the default is "none".  */ | ||||||
|     if (default_vga) { |     if (default_vga) { | ||||||
|         if (machine_class->default_display) { |         vga_model = get_default_vga_model(machine_class); | ||||||
|             vga_model = machine_class->default_display; |  | ||||||
|         } else if (vga_interface_available(VGA_CIRRUS)) { |  | ||||||
|             vga_model = "cirrus"; |  | ||||||
|         } else if (vga_interface_available(VGA_STD)) { |  | ||||||
|             vga_model = "std"; |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|     if (vga_model) { |     if (vga_model) { | ||||||
|         select_vgahw(vga_model); |         select_vgahw(machine_class, vga_model); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (watchdog) { |     if (watchdog) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Marc-André Lureau
						Marc-André Lureau