diff options
author | Thomas Huth <thuth@redhat.com> | 2023-05-10 18:54:33 +0200 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2023-05-22 09:39:15 +0200 |
commit | d563cc84cdc599c3fbd40b36d6b71411e008b039 (patch) | |
tree | d25ed59d54bd46f696ae847f6ba44b030f895ad5 | |
parent | d11b791890b17d3e80e31aae5028660f41c1b58b (diff) |
softmmu/vl.c: Check for the availability of the VGA device before using it
In case the user disabled the default VGA device in the binary (e.g.
with the "--without-default-devices" configure switch), we should
not try to use it by default if QEMU is running with the default
devices, otherwise it aborts when trying to use it. Simply emit a
warning instead.
Message-Id: <20230512124033.502654-3-thuth@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
-rw-r--r-- | softmmu/vl.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/softmmu/vl.c b/softmmu/vl.c index 6c2427262b..43d3b972da 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -957,7 +957,18 @@ static const char * get_default_vga_model(const MachineClass *machine_class) { if (machine_class->default_display) { - return machine_class->default_display; + for (int t = 0; t < VGA_TYPE_MAX; t++) { + const VGAInterfaceInfo *ti = &vga_interfaces[t]; + + if (ti->opt_name && vga_interface_available(t) && + g_str_equal(ti->opt_name, machine_class->default_display)) { + return machine_class->default_display; + } + } + + warn_report_once("Default display '%s' is not available in this binary", + machine_class->default_display); + return NULL; } else if (vga_interface_available(VGA_CIRRUS)) { return "cirrus"; } else if (vga_interface_available(VGA_STD)) { |