From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Alistair Francis" <alistair@alistair23.me>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [Qemu-devel] [PULL 5/8] vl: add -vga help support
Date: Tue, 7 May 2019 10:19:43 +0200 [thread overview]
Message-ID: <20190507081946.19264-6-kraxel@redhat.com> (raw)
In-Reply-To: <20190507081946.19264-1-kraxel@redhat.com>
From: Marc-André Lureau <marcandre.lureau@redhat.com>
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>
---
vl.c | 40 +++++++++++++++++++++++++++++++---------
1 file changed, 31 insertions(+), 9 deletions(-)
diff --git a/vl.c b/vl.c
index 6b2820483c43..b6709514c1bb 100644
--- a/vl.c
+++ b/vl.c
@@ -2069,11 +2069,39 @@ static bool vga_interface_available(VGAInterfaceType t)
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;
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);
for (t = 0; t < VGA_TYPE_MAX; 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 (default_vga) {
- if (machine_class->default_display) {
- 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";
- }
+ vga_model = get_default_vga_model(machine_class);
}
if (vga_model) {
- select_vgahw(vga_model);
+ select_vgahw(machine_class, vga_model);
}
if (watchdog) {
--
2.18.1
next prev parent reply other threads:[~2019-05-07 8:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 8:19 [Qemu-devel] [PULL 0/8] Vga 20190507 patches Gerd Hoffmann
2019-05-07 8:19 ` [Qemu-devel] [PULL 1/8] qxl: check release info object Gerd Hoffmann
2019-05-07 8:19 ` [Qemu-devel] [PULL 2/8] hw/display/cirrus_vga: Update the documentation URL Gerd Hoffmann
2019-05-07 8:19 ` [Qemu-devel] [PULL 3/8] hw/display/cirrus_vga: Remove unused include Gerd Hoffmann
2019-05-07 8:19 ` [Qemu-devel] [PULL 4/8] vl: constify VGAInterfaceInfo Gerd Hoffmann
2019-05-07 8:19 ` Gerd Hoffmann [this message]
2019-05-07 8:19 ` [Qemu-devel] [PULL 6/8] qxl: avoid unaligned pointer reads/writes Gerd Hoffmann
2019-05-07 8:19 ` [Qemu-devel] [PULL 7/8] ati-vga: Fix check for blt outside vram Gerd Hoffmann
2019-05-07 8:19 ` [Qemu-devel] [PULL 8/8] i2c-ddc: move it to hw/display Gerd Hoffmann
2019-05-07 23:06 ` [Qemu-devel] [PULL 0/8] Vga 20190507 patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190507081946.19264-6-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=alistair@alistair23.me \
--cc=edgar.iglesias@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).