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

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

 



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@xxxxxxx>
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;
--
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]