于 2011年02月15日 21:47, Osier Yang 写道:
qemu command line to specify "vram":
     -global qxl.vram_size=uint

qemu command line to specify "heads", (no need of '-device' for
the first 'head'):
     -device qxl,id=qxl-N (N is natural number)

This patch is just about the command line building, still left work
on the command line parsing (hacking on "qemuBuildCommandLine"), as
I'm even not sure if it's the right way to build the command line.

Any advise/idea is appreciated.
---
  src/qemu/qemu_capabilities.c |    5 ++++-
  src/qemu/qemu_capabilities.h |    3 ++-
  src/qemu/qemu_command.c      |   14 ++++++++++++++
  3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index cc5552c..78bcb4c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -942,9 +942,12 @@ qemuCapsComputeCmdFlags(const char *help,
       * two features. The benefits of JSON mode now outweigh
       * the downside.
       */
-     if (version>= 13000)
+    if (version>= 13000)
          flags |= QEMUD_CMD_FLAG_MONITOR_JSON;

+    if (strstr(help, "-global"))
+        flags |= QEMUD_CMD_FLAG_GLOBAL;
+
      return flags;
  }

diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index a130a4f..b1feb87 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -91,7 +91,8 @@ enum qemuCapsFlags {
      QEMUD_CMD_FLAG_CCID_EMULATED = (1LL<<  54), /* -device ccid-card-emulated 
*/
      QEMUD_CMD_FLAG_CCID_PASSTHRU = (1LL<<  55), /* -device ccid-card-passthru 
*/
      QEMUD_CMD_FLAG_CHARDEV_SPICEVMC = (1LL<<  56), /* newer -chardev spicevmc 
*/
-    QEMUD_CMD_FLAG_DEVICE_SPICEVMC = (1LL<<  57), /* older -device spicevmc*/
+    QEMUD_CMD_FLAG_DEVICE_SPICEVMC = (1LL<<  57), /* older -device spicevmc */
+    QEMUD_CMD_FLAG_GLOBAL        = (1LL<<  58), /* Is -global available */
  };

  virCapsPtr qemuCapsInit(virCapsPtr old_caps);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1687203..92af6cb 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3964,6 +3964,20 @@ qemuBuildCommandLine(virConnectPtr conn,
                  }

                  virCommandAddArgList(cmd, "-vga", vgastr, NULL);
+
+                if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
+                    if (def->videos[0]->vram&&
+                        (qemuCmdFlags&  QEMUD_CMD_FLAG_GLOBAL)) {
+                        virCommandAddArgFormat(cmd, "-global qxl.vram_size=%u",
+                                               def->videos[0]->vram);
+                    }
+
+                    if (def->videos[0]->heads>  0) {

urgh, s/> 0/> 1/ here..

+                        for (i = 0; i<  def->videos[0]->heads - 1; i++) {
+                            virCommandAddArgFormat(cmd, "-device 
%s,id=qxl-%d", vgastr, i+1);
+                        }
+                    }
+                }
              }
          } else {

--
1.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to