提交 635f9ca1 编写于 作者: D Daniel P. Berrange

Implement QEMU/KVM QXL video card support in QEMU driver

This supports the '-vga qxl' parameter in upstream QEMU/KVM
which has SPICE support added. This isn't particularly useful
until you get the next patch for -spice support. Also note that
while the libvirt XML supports multiple video devices, this
patch only supports a single one. A later patch can add support
for 2nd, 3rd, etc PCI devices for QXL

* src/qemu/qemu_conf.h: Flag for QXL support
* src/qemu/qemu_conf.c: Probe for '-vga qxl' support and implement it
* tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c,
  tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args,
  tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml: Test
  case for generating spice args with RHEL6 kvm
上级 c909091b
......@@ -93,7 +93,7 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
"vmware",
"", /* no arg needed for xen */
"", /* don't support vbox */
"", /* Not implemented QXL yet */);
"qxl");
int qemudLoadDriverConfig(struct qemud_driver *driver,
const char *filename) {
......@@ -1202,8 +1202,12 @@ static unsigned long long qemudComputeCmdFlags(const char *help,
if (strstr(help, "readonly="))
flags |= QEMUD_CMD_FLAG_DRIVE_READONLY;
}
if (strstr(help, "-vga") && !strstr(help, "-std-vga"))
if (strstr(help, "-vga") && !strstr(help, "-std-vga")) {
flags |= QEMUD_CMD_FLAG_VGA;
if (strstr(help, "|qxl"))
flags |= QEMUD_CMD_FLAG_VGA_QXL;
}
if (strstr(help, "boot=on"))
flags |= QEMUD_CMD_FLAG_DRIVE_BOOT;
if (strstr(help, "serial=s"))
......@@ -5081,6 +5085,13 @@ int qemudBuildCommandLine(virConnectPtr conn,
if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_XEN) {
/* nothing - vga has no effect on Xen pvfb */
} else {
if ((def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL) &&
!(qemuCmdFlags & QEMUD_CMD_FLAG_VGA_QXL)) {
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("This QEMU does not support QXL graphics adapters"));
goto error;
}
const char *vgastr = qemuVideoTypeToString(def->videos[0]->type);
if (!vgastr || STREQ(vgastr, "")) {
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
......
......@@ -98,6 +98,7 @@ enum qemud_cmd_flags {
QEMUD_CMD_FLAG_NAME_PROCESS = (1LL << 42), /* Is -name process= available */
QEMUD_CMD_FLAG_DRIVE_READONLY= (1LL << 43), /* -drive readonly=on|off */
QEMUD_CMD_FLAG_SMBIOS_TYPE = (1LL << 44), /* Is -smbios type= available */
QEMUD_CMD_FLAG_VGA_QXL = (1LL << 45), /* The 'qxl' arg for '-vga' */
};
/* Main driver state */
......
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -vga qxl -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory>219200</memory>
<currentMemory>219200</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu</emulator>
<disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest1'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='ide' index='0'/>
<video>
<model type='qxl' vram='65536' heads='1'/>
</video>
</devices>
</domain>
......@@ -323,6 +323,10 @@ mymain(int argc, char **argv)
DO_TEST("graphics-sdl", 0, false);
DO_TEST("graphics-sdl-fullscreen", 0, false);
DO_TEST("nographics-vga", QEMUD_CMD_FLAG_VGA, false);
DO_TEST("graphics-spice",
QEMUD_CMD_FLAG_VGA | QEMUD_CMD_FLAG_VGA_QXL |
QEMUD_CMD_FLAG_DEVICE, false);
DO_TEST("input-usbmouse", 0, false);
DO_TEST("input-usbtablet", 0, false);
DO_TEST("input-xen", QEMUD_CMD_FLAG_DOMID, true);
......
......@@ -149,6 +149,7 @@ mymain(int argc, char **argv)
DO_TEST("graphics-vnc-tls");
DO_TEST("graphics-sdl");
DO_TEST("graphics-sdl-fullscreen");
DO_TEST("graphics-spice");
DO_TEST("input-usbmouse");
DO_TEST("input-usbtablet");
DO_TEST("input-xen");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册