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

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

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@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 :|

On Thursday 13 August 2009 20:50:25 Daniel P. Berrange wrote:
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".
Since the patch "Support for <acceleration> in video tag" has changed, reposting this patch with necessary changes. Regards, Pritesh

On Wed, Aug 19, 2009 at 10:48:45AM +0200, Pritesh Kothari wrote:
On Thursday 13 August 2009 20:50:25 Daniel P. Berrange wrote:
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".
Since the patch "Support for <acceleration> in video tag" has changed, reposting this patch with necessary changes.
Okay, applied too, I had to change the code to support the fact that accel is dynamically allocated. I note that there is a lot of VIR_ALLOC where the return is checked but no error is raised in case of NULL. I think some cleanup is in order there ! Anyway patch applied and commited, thanks, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Pritesh Kothari