qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] add a -vga none cli option
@ 2009-01-14 15:58 Stefano Stabellini
  2009-01-15 20:37 ` Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Stefano Stabellini @ 2009-01-14 15:58 UTC (permalink / raw)
  To: qemu-devel

Hi all,
currently there is no way to fully disable any graphic card device for
the PC architecture.
You can have no graphical output, thanks to -nographic, but you would
have the VGA device connected to your PCI bus anyway.
There is already a convenient -vga option to choose between std, cirrus
and vmware; this patch add the new option "none" to select no graphic
card at all.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

diff --git a/hw/pc.c b/hw/pc.c
index 6a1c8ec..c6af337 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -851,22 +851,24 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
         exit(1);
     }
 
-    /* VGA BIOS load */
-    if (cirrus_vga_enabled) {
-        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_CIRRUS_FILENAME);
-    } else {
-        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
-    }
-    vga_bios_size = get_image_size(buf);
-    if (vga_bios_size <= 0 || vga_bios_size > 65536)
-        goto vga_bios_error;
-    vga_bios_offset = qemu_ram_alloc(65536);
-
-    ret = load_image(buf, phys_ram_base + vga_bios_offset);
-    if (ret != vga_bios_size) {
-    vga_bios_error:
-        fprintf(stderr, "qemu: could not load VGA BIOS '%s'\n", buf);
-        exit(1);
+    if (cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled) {
+        /* VGA BIOS load */
+        if (cirrus_vga_enabled) {
+            snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_CIRRUS_FILENAME);
+        } else {
+            snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
+        }
+        vga_bios_size = get_image_size(buf);
+        if (vga_bios_size <= 0 || vga_bios_size > 65536)
+            goto vga_bios_error;
+        vga_bios_offset = qemu_ram_alloc(65536);
+
+        ret = load_image(buf, phys_ram_base + vga_bios_offset);
+        if (ret != vga_bios_size) {
+vga_bios_error:
+            fprintf(stderr, "qemu: could not load VGA BIOS '%s'\n", buf);
+            exit(1);
+        }
     }
 
     /* setup basic memory access */
@@ -955,7 +957,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
                             vga_ram_addr, vga_ram_size);
         else
             fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
-    } else {
+    } else if (std_vga_enabled) {
         if (pci_enabled) {
             pci_vga_init(pci_bus, ds, phys_ram_base + vga_ram_addr,
                          vga_ram_addr, vga_ram_size, 0, 0);
diff --git a/sysemu.h b/sysemu.h
index 47c1fea..060768d 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -83,6 +83,7 @@ void do_info_slirp(void);
 
 extern int bios_size;
 extern int cirrus_vga_enabled;
+extern int std_vga_enabled;
 extern int vmsvga_enabled;
 extern int graphic_width;
 extern int graphic_height;
diff --git a/vl.c b/vl.c
index e29072b..5ea59b5 100644
--- a/vl.c
+++ b/vl.c
@@ -192,6 +192,7 @@ int vm_running;
 static int rtc_utc = 1;
 static int rtc_date_offset = -1; /* -1 means no change */
 int cirrus_vga_enabled = 1;
+int std_vga_enabled = 0;
 int vmsvga_enabled = 0;
 #ifdef TARGET_SPARC
 int graphic_width = 1024;
@@ -3871,7 +3872,7 @@ static void help(int exitcode)
            "                use -soundhw ? to get the list of supported cards\n"
            "                use -soundhw all to enable all of them\n"
 #endif
-           "-vga [std|cirrus|vmware]\n"
+           "-vga [std|cirrus|vmware|none]\n"
            "                select video card type\n"
            "-localtime      set the real time clock to local time [default=utc]\n"
            "-full-screen    start in full screen\n"
@@ -4400,14 +4401,21 @@ static void select_vgahw (const char *p)
     const char *opts;
 
     if (strstart(p, "std", &opts)) {
+        std_vga_enabled = 1;
         cirrus_vga_enabled = 0;
         vmsvga_enabled = 0;
     } else if (strstart(p, "cirrus", &opts)) {
         cirrus_vga_enabled = 1;
+        std_vga_enabled = 0;
         vmsvga_enabled = 0;
     } else if (strstart(p, "vmware", &opts)) {
         cirrus_vga_enabled = 0;
+        std_vga_enabled = 0;
         vmsvga_enabled = 1;
+    } else if (strstart(p, "none", &opts)) {
+        cirrus_vga_enabled = 0;
+        std_vga_enabled = 0;
+        vmsvga_enabled = 0;
     } else {
     invalid_vga:
         fprintf(stderr, "Unknown vga type: %s\n", p);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] add a -vga none cli option
  2009-01-14 15:58 [Qemu-devel] [PATCH] add a -vga none cli option Stefano Stabellini
@ 2009-01-15 20:37 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2009-01-15 20:37 UTC (permalink / raw)
  To: qemu-devel

Stefano Stabellini wrote:
> Hi all,
> currently there is no way to fully disable any graphic card device for
> the PC architecture.
> You can have no graphical output, thanks to -nographic, but you would
> have the VGA device connected to your PCI bus anyway.
> There is already a convenient -vga option to choose between std, cirrus
> and vmware; this patch add the new option "none" to select no graphic
> card at all.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>   

Applied.  Thanks.

Regards,

Anthony Liguori

> diff --git a/hw/pc.c b/hw/pc.c
> index 6a1c8ec..c6af337 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -851,22 +851,24 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
>          exit(1);
>      }
>  
> -    /* VGA BIOS load */
> -    if (cirrus_vga_enabled) {
> -        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_CIRRUS_FILENAME);
> -    } else {
> -        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
> -    }
> -    vga_bios_size = get_image_size(buf);
> -    if (vga_bios_size <= 0 || vga_bios_size > 65536)
> -        goto vga_bios_error;
> -    vga_bios_offset = qemu_ram_alloc(65536);
> -
> -    ret = load_image(buf, phys_ram_base + vga_bios_offset);
> -    if (ret != vga_bios_size) {
> -    vga_bios_error:
> -        fprintf(stderr, "qemu: could not load VGA BIOS '%s'\n", buf);
> -        exit(1);
> +    if (cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled) {
> +        /* VGA BIOS load */
> +        if (cirrus_vga_enabled) {
> +            snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_CIRRUS_FILENAME);
> +        } else {
> +            snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
> +        }
> +        vga_bios_size = get_image_size(buf);
> +        if (vga_bios_size <= 0 || vga_bios_size > 65536)
> +            goto vga_bios_error;
> +        vga_bios_offset = qemu_ram_alloc(65536);
> +
> +        ret = load_image(buf, phys_ram_base + vga_bios_offset);
> +        if (ret != vga_bios_size) {
> +vga_bios_error:
> +            fprintf(stderr, "qemu: could not load VGA BIOS '%s'\n", buf);
> +            exit(1);
> +        }
>      }
>  
>      /* setup basic memory access */
> @@ -955,7 +957,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
>                              vga_ram_addr, vga_ram_size);
>          else
>              fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
> -    } else {
> +    } else if (std_vga_enabled) {
>          if (pci_enabled) {
>              pci_vga_init(pci_bus, ds, phys_ram_base + vga_ram_addr,
>                           vga_ram_addr, vga_ram_size, 0, 0);
> diff --git a/sysemu.h b/sysemu.h
> index 47c1fea..060768d 100644
> --- a/sysemu.h
> +++ b/sysemu.h
> @@ -83,6 +83,7 @@ void do_info_slirp(void);
>  
>  extern int bios_size;
>  extern int cirrus_vga_enabled;
> +extern int std_vga_enabled;
>  extern int vmsvga_enabled;
>  extern int graphic_width;
>  extern int graphic_height;
> diff --git a/vl.c b/vl.c
> index e29072b..5ea59b5 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -192,6 +192,7 @@ int vm_running;
>  static int rtc_utc = 1;
>  static int rtc_date_offset = -1; /* -1 means no change */
>  int cirrus_vga_enabled = 1;
> +int std_vga_enabled = 0;
>  int vmsvga_enabled = 0;
>  #ifdef TARGET_SPARC
>  int graphic_width = 1024;
> @@ -3871,7 +3872,7 @@ static void help(int exitcode)
>             "                use -soundhw ? to get the list of supported cards\n"
>             "                use -soundhw all to enable all of them\n"
>  #endif
> -           "-vga [std|cirrus|vmware]\n"
> +           "-vga [std|cirrus|vmware|none]\n"
>             "                select video card type\n"
>             "-localtime      set the real time clock to local time [default=utc]\n"
>             "-full-screen    start in full screen\n"
> @@ -4400,14 +4401,21 @@ static void select_vgahw (const char *p)
>      const char *opts;
>  
>      if (strstart(p, "std", &opts)) {
> +        std_vga_enabled = 1;
>          cirrus_vga_enabled = 0;
>          vmsvga_enabled = 0;
>      } else if (strstart(p, "cirrus", &opts)) {
>          cirrus_vga_enabled = 1;
> +        std_vga_enabled = 0;
>          vmsvga_enabled = 0;
>      } else if (strstart(p, "vmware", &opts)) {
>          cirrus_vga_enabled = 0;
> +        std_vga_enabled = 0;
>          vmsvga_enabled = 1;
> +    } else if (strstart(p, "none", &opts)) {
> +        cirrus_vga_enabled = 0;
> +        std_vga_enabled = 0;
> +        vmsvga_enabled = 0;
>      } else {
>      invalid_vga:
>          fprintf(stderr, "Unknown vga type: %s\n", p);
>
>
>   

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-15 20:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-14 15:58 [Qemu-devel] [PATCH] add a -vga none cli option Stefano Stabellini
2009-01-15 20:37 ` Anthony Liguori

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).