[libvirt] [PATCH] Support for defining/dumping video device in VirtualBox

Daniel P. Berrange berrange at redhat.com
Thu Aug 13 18:50:25 UTC 2009


On Mon, Aug 10, 2009 at 01:55:03PM +0200, Pritesh Kothari wrote:
> Hi All,
> 
> I have added support for defining/dumping video device in VirtualBox. The patch 
> for the same is attached here. Also this patch depends on the earlier patch 
> "Support for 3d Acceleration in video tag".
> 
> Regards,
> Pritesh

> commit 777bf7dbbc1a6531965cd11be41987d8b74bf0f2
> Author: Pritesh Kothari <Pritesh.Kothari at Sun.com>
> Date:   Mon Aug 10 13:41:14 2009 +0200
> 
>     libvirt: support for defining/dumping video device in VirtualBox
> 
> diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
> index 24ec7ba..4fe960b 100644
> --- a/src/vbox/vbox_tmpl.c
> +++ b/src/vbox/vbox_tmpl.c
> @@ -1752,6 +1752,29 @@ static char *vboxDomainDumpXML(virDomainPtr dom, int flags) {
>                   * so locatime is always true here */
>                  def->localtime = 1;
>  
> +                /* dump video options vram/3d/directx/etc. */
> +                {
> +                    /* Currently supports only one graphics card */
> +                    def->nvideos = 1;
> +                    if (VIR_ALLOC_N(def->videos, def->nvideos) >= 0) {
> +                        if (VIR_ALLOC(def->videos[0]) >= 0) {
> +                            /* the default is: vram is 8MB, One monitor, 3dAccel Off */
> +                            PRUint32 VRAMSize          = 8 * 1024;
> +                            PRUint32 monitorCount      = 1;
> +                            PRBool accelerate3DEnabled = PR_FALSE;
> +
> +                            machine->vtbl->GetVRAMSize(machine, &VRAMSize);
> +                            machine->vtbl->GetMonitorCount(machine, &monitorCount);
> +                            machine->vtbl->GetAccelerate3DEnabled(machine, &accelerate3DEnabled);
> +
> +                            def->videos[0]->type      = VIR_DOMAIN_VIDEO_TYPE_VBOX;
> +                            def->videos[0]->vram      = VRAMSize;
> +                            def->videos[0]->heads     = monitorCount;
> +                            def->videos[0]->support3d = accelerate3DEnabled;
> +                        }
> +                    }
> +                }
> +
>                  /* dump display options vrdp/gui/sdl */
>                  {
>                      int vrdpPresent           = 0;
> @@ -3538,6 +3561,14 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
>              }
>          }   /* Finished:Block to attach the Parallel Port to the VM */
>  
> +        {   /* Started:Block to specify video card settings */
> +            if ((def->nvideos == 1) && (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_VBOX)) {
> +                machine->vtbl->SetVRAMSize(machine, def->videos[0]->vram);
> +                machine->vtbl->SetMonitorCount(machine, def->videos[0]->heads);
> +                machine->vtbl->SetAccelerate3DEnabled(machine, def->videos[0]->support3d);
> +            }
> +        }   /* Finished:Block to specify video card settings */
> +
>          {   /* Started:Block to attach the Remote Display to VM */
>              int vrdpPresent  = 0;
>              int sdlPresent   = 0;

ACK looks fine


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list