[libvirt] [v2] qemu: Support vram for video of qxl type

Daniel P. Berrange berrange at redhat.com
Fri Mar 4 11:40:22 UTC 2011


On Mon, Feb 21, 2011 at 09:43:30PM +0800, Osier Yang wrote:
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index e7c3409..db8c8da 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -4164,6 +4164,10 @@ virDomainVideoDefaultRAM(virDomainDefPtr def,
>          /* Original Xen PVFB hardcoded to 4 MB */
>          return 4 * 1024;
> 
> +    case VIR_DOMAIN_VIDEO_TYPE_QXL:
> +        /* QEMU uses 16M as the minimal video memory for qxl device */
> +        return 16 * 1024;
> +

It is 64 MB actually.

# qemu-kvm -vga qxl -monitor stdio
 (qemu)  info qtree
      ....
      dev: qxl-vga, id ""
        dev-prop: ram_size = 67108864
        dev-prop: vram_size = 67108864
        ....

>      default:
>          return 0;
>      }
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 5f08a20..cce6b5f 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -1118,6 +1118,8 @@ qemuCapsParseDeviceStr(const char *str, unsigned long long *flags)
>      }
>      if (strstr(str, "virtio-net-pci.tx="))
>          *flags |= QEMUD_CMD_FLAG_VIRTIO_TX_ALG;
> +    if (strstr(str, "name \"qxl-vga\""))
> +        *flags |= QEMUD_CMD_FLAG_DEVICE_QXL_VGA;
> 
>      return 0;
>  }
> diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
> index 63cbbb3..f36c3ab 100644
> --- a/src/qemu/qemu_capabilities.h
> +++ b/src/qemu/qemu_capabilities.h
> @@ -93,6 +93,7 @@ enum qemuCapsFlags {
>      QEMUD_CMD_FLAG_CHARDEV_SPICEVMC = (1LL << 56), /* newer -chardev spicevmc */
>      QEMUD_CMD_FLAG_DEVICE_SPICEVMC = (1LL << 57), /* older -device spicevmc*/
>      QEMUD_CMD_FLAG_VIRTIO_TX_ALG = (1LL << 58), /* -device virtio-net-pci,tx=string */
> +    QEMUD_CMD_FLAG_DEVICE_QXL_VGA = (1LL << 59), /* Is the primary and vga compatible qxl device named qxl-vga? */
>  };
> 
>  virCapsPtr qemuCapsInit(virCapsPtr old_caps);
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 0db2843..f2709f5 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1914,7 +1914,8 @@ error:
>  }
> 
>  static char *
> -qemuBuildVideoDevStr(virDomainVideoDefPtr video,
> +qemuBuildVideoDevStr(virDomainDefPtr def,
> +                     virDomainVideoDefPtr video,
>                       unsigned long long qemuCmdFlags)
>  {
>      virBuffer buf = VIR_BUFFER_INITIALIZER;
> @@ -1928,6 +1929,15 @@ qemuBuildVideoDevStr(virDomainVideoDefPtr video,
> 
>      virBufferVSprintf(&buf, "%s", model);
>      virBufferVSprintf(&buf, ",id=%s", video->info.alias);
> +
> +    if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
> +        if (!video->vram)
> +            video->vram = virDomainVideoDefaultRAM(def, video->type);

Actually, the XML parser already calls this, so all that was needed
was the 'case VIR_DOMAIN_VIDEO_TYPE_QXL' that you added earlier.

> +
> +        /* QEMU accepts bytes for vram_size. */
> +        virBufferVSprintf(&buf, ",vram_size=%u", video->vram * 1024);
> +    }
> +
>      if (qemuBuildDeviceAddressStr(&buf, &video->info, qemuCmdFlags) < 0)
>          goto error;
> 
> @@ -4023,6 +4033,18 @@ qemuBuildCommandLine(virConnectPtr conn,


If those two changes are made, then this is fine.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list