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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
commit 521f752a700e8dd933cbb6b407e60a2e95ddd6fe
Author: pritesh <pritesh@d6844923-1013-0410-bc22-a9adef35e721>
Date:   Tue Aug 18 15:14:43 2009 +0000

    libvirt: support for defining/dumping video device in VirtualBox
    
    git-svn-id: https://linserv.germany.sun.com/vbox/svn/trunk/src/libs/libvirt@51236 d6844923-1013-0410-bc22-a9adef35e721

diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 0180b9b..722f24e 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -1751,6 +1751,31 @@ static char *vboxDomainDumpXML(virDomainPtr dom, int flags) {
                  * so locatime is always true here */
                 def->localtime = 1;
 
+                /* dump video options vram/2d/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]->accel.support3d = accelerate3DEnabled;
+                            /* Not supported yet, but should be in 3.1 soon */
+                            def->videos[0]->accel.support2d = 0;
+                        }
+                    }
+                }
+
                 /* dump display options vrdp/gui/sdl */
                 {
                     int vrdpPresent           = 0;
@@ -3537,6 +3562,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]->accel.support3d);
+            }
+        }   /* Finished:Block to specify video card settings */
+
         {   /* Started:Block to attach the Remote Display to VM */
             int vrdpPresent  = 0;
             int sdlPresent   = 0;
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]