From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/9] Clean up handling of name=value, ... part of -vga option argument
Date: Thu, 22 Jan 2009 20:30:58 +0100 [thread overview]
Message-ID: <1232652665-1710-2-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <87ocxzrvqb.fsf@pike.pond.sub.org>
From: Markus Armbruster <armbru@pond.sub.org>
Move interpretation of the option argument from select_vgahw() into
the device initialization functions. The only one that's currently
interested is vga_common_init(). Use get_param_value() there instead
of the special purpose code select_vgahw() used to use. The move
permits hiding vga_retrace_method & friends in vga.c, so do that.
---
hw/pc.h | 7 +------
hw/vga.c | 34 +++++++++++++++++-----------------
vl.c | 19 +++++--------------
3 files changed, 23 insertions(+), 37 deletions(-)
diff --git a/hw/pc.h b/hw/pc.h
index 1ba3d9e..f43c138 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -119,12 +119,7 @@ extern PCIDevice *piix4_dev;
int piix4_init(PCIBus *bus, int devfn);
/* vga.c */
-enum vga_retrace_method {
- VGA_RETRACE_DUMB,
- VGA_RETRACE_PRECISE
-};
-
-extern enum vga_retrace_method vga_retrace_method;
+extern const char *vga_opts;
#ifndef TARGET_SPARC
#define VGA_RAM_SIZE (8192 * 1024)
diff --git a/hw/vga.c b/hw/vga.c
index 776ead0..164e652 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -29,6 +29,7 @@
#include "pixel_ops.h"
#include "qemu-timer.h"
#include "kvm.h"
+#include "sysemu.h"
//#define DEBUG_VGA
//#define DEBUG_VGA_MEM
@@ -1922,13 +1923,8 @@ void vga_reset(void *opaque)
memset(s->invalidated_y_table, '\0', sizeof(s->invalidated_y_table));
memset(s->last_palette, '\0', sizeof(s->last_palette));
memset(s->last_ch_attr, '\0', sizeof(s->last_ch_attr));
- switch (vga_retrace_method) {
- case VGA_RETRACE_DUMB:
- break;
- case VGA_RETRACE_PRECISE:
+ if (s->retrace == vga_precise_retrace)
memset(&s->retrace_info, 0, sizeof (s->retrace_info));
- break;
- }
}
#define TEXTMODE_X(x) ((x) % width)
@@ -2257,7 +2253,8 @@ static void vga_map(PCIDevice *pci_dev, int region_num,
void vga_common_init(VGAState *s, uint8_t *vga_ram_base,
ram_addr_t vga_ram_offset, int vga_ram_size)
{
- int i, j, v, b;
+ int i, j, v, b, precise_retrace;
+ char buf[32];
for(i = 0;i < 256; i++) {
v = 0;
@@ -2292,16 +2289,19 @@ void vga_common_init(VGAState *s, uint8_t *vga_ram_base,
s->invalidate = vga_invalidate_display;
s->screen_dump = vga_screen_dump;
s->text_update = vga_update_text;
- switch (vga_retrace_method) {
- case VGA_RETRACE_DUMB:
- s->retrace = vga_dumb_retrace;
- s->update_retrace_info = vga_dumb_update_retrace_info;
- break;
-
- case VGA_RETRACE_PRECISE:
- s->retrace = vga_precise_retrace;
- s->update_retrace_info = vga_precise_update_retrace_info;
- break;
+ precise_retrace = 0;
+ if (get_param_value(buf, sizeof(buf), "retrace", vga_opts)) {
+ if (!strcmp(buf, "precise"))
+ precise_retrace = 1;
+ else if (strcmp(buf, "dumb"))
+ fprintf(stderr, "Unknown VGA retrace=%s ignored\n", buf);
+ }
+ if (precise_retrace) {
+ s->retrace = vga_precise_retrace;
+ s->update_retrace_info = vga_precise_update_retrace_info;
+ } else {
+ s->retrace = vga_dumb_retrace;
+ s->update_retrace_info = vga_dumb_update_retrace_info;
}
vga_reset(s);
}
diff --git a/vl.c b/vl.c
index 63d954b..4c1045c 100644
--- a/vl.c
+++ b/vl.c
@@ -186,7 +186,6 @@ static IOPortWriteFunc *ioport_write_table[3][MAX_IOPORTS];
DriveInfo drives_table[MAX_DRIVES+1];
int nb_drives;
static int vga_ram_size;
-enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
static DisplayState *display_state;
int nographic;
static int curses;
@@ -202,6 +201,7 @@ static int rtc_date_offset = -1; /* -1 means no change */
int cirrus_vga_enabled = 1;
int std_vga_enabled = 0;
int vmsvga_enabled = 0;
+const char *vga_opts = "";
#ifdef TARGET_SPARC
int graphic_width = 1024;
int graphic_height = 768;
@@ -4430,19 +4430,10 @@ static void select_vgahw (const char *p)
fprintf(stderr, "Unknown vga type: %s\n", p);
exit(1);
}
- while (*opts) {
- const char *nextopt;
-
- if (strstart(opts, ",retrace=", &nextopt)) {
- opts = nextopt;
- if (strstart(opts, "dumb", &nextopt))
- vga_retrace_method = VGA_RETRACE_DUMB;
- else if (strstart(opts, "precise", &nextopt))
- vga_retrace_method = VGA_RETRACE_PRECISE;
- else goto invalid_vga;
- } else goto invalid_vga;
- opts = nextopt;
- }
+ if (opts[0] == ',')
+ vga_opts = opts + 1;
+ else if (opts[0])
+ goto invalid_vga;
}
#ifdef _WIN32
--
1.6.0.6
next prev parent reply other threads:[~2009-01-22 19:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-22 19:23 [Qemu-devel] [RFC PATCH 0/9] Configurable PCI device addresses Markus Armbruster
2009-01-22 19:30 ` [Qemu-devel] [PATCH 1/9] PCI device registration helpers Markus Armbruster
2009-01-22 19:30 ` Markus Armbruster [this message]
2009-01-22 19:30 ` [Qemu-devel] [PATCH 3/9] Support pci=... in option argument of -vga Markus Armbruster
2009-01-22 19:31 ` [Qemu-devel] [PATCH 4/9] Convert virtio_init_pci() to pci_register_device_2() Markus Armbruster
2009-01-22 19:31 ` [Qemu-devel] [PATCH 5/9] Support pci=... in option argument of -net nic Markus Armbruster
2009-01-22 19:31 ` [Qemu-devel] [PATCH 6/9] Make drives_opt[] accessible from device initialization Markus Armbruster
2009-01-22 19:31 ` [Qemu-devel] [PATCH 7/9] Support pci=... in option argument of -drive if=virtio Markus Armbruster
2009-01-22 19:31 ` [Qemu-devel] [PATCH 8/9] New option -audio as a more flexible alternative to -soundhw Markus Armbruster
2009-01-22 22:03 ` malc
2009-01-23 8:32 ` Markus Armbruster
2009-01-23 9:29 ` Kevin Wolf
2009-01-23 10:04 ` Markus Armbruster
2009-01-23 10:24 ` Kevin Wolf
2009-01-23 11:51 ` Markus Armbruster
2009-01-22 19:31 ` [Qemu-devel] [PATCH 9/9] Support pci=... in option argument of -audio Markus Armbruster
2009-01-22 20:06 ` [Qemu-devel] [RFC PATCH 0/9] Configurable PCI device addresses Anthony Liguori
2009-01-23 9:04 ` Markus Armbruster
2009-01-23 10:23 ` Daniel P. Berrange
2009-01-23 19:06 ` Paul Brook
2009-01-23 19:28 ` Anthony Liguori
2009-01-26 8:55 ` Markus Armbruster
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=1232652665-1710-2-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=qemu-devel@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).