[pve-devel] [PATCH] add multi-monitors spice support

Alexandre Derumier aderumier at odiso.com
Wed Sep 25 15:33:08 CEST 2013


add qxl2 (2monitors),qxl3 (3monitors),qxl4 (4monitors) vga type.

For linux, we only need 1 qxl card with more memory

For windows, we need 1 qxl card by monitor

Original Information from spice-mailing
"
You need to specify multiple devices for Windows VMs. This is what
libvirt gives me (via 'virsh domxml-to-native qemu argv DOMAIN_XML'):
<...> -vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=33554432 -device qxl,id=video1,ram_size=67108864,vram_size=33554432 -device qxl,id=video2,ram_size=67108864,vram_size=33554432 -device qxl,id=video3,ram_size=67108864,vram_size=33554432

For Linux VM, just one qxl device is OK but then it's advisable to
increase the available RAM:
<...> -vga qxl -global qxl-vga.ram_size=134217728 -global qxl-vga.vram_size=33554432

If you don't turn off surfaces, then you should increase vram size to
say 64 MB from current default of 32 MB.
"

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |   30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 29dcc28..e62acc4 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -337,7 +337,7 @@ EODESC
 	optional => 1,
 	type => 'string',
 	description => "Select VGA type. If you want to use high resolution modes (>= 1280x1024x16) then you should use option 'std' or 'vmware'. Default is 'std' for win8/win7/w2k8, and 'cirrur' for other OS types. Option 'qxl' enables the SPICE display sever. You can also run without any graphic card using a serial devive as terminal.",
-	enum => [qw(std cirrus vmware qxl serial0 serial1 serial2 serial3)],
+	enum => [qw(std cirrus vmware qxl serial0 serial1 serial2 serial3 qxl2 qxl3 qxl4)],
     },
     watchdog => {
 	optional => 1,
@@ -2235,7 +2235,7 @@ sub foreach_volid {
 sub vga_conf_has_spice {
     my ($vga) = @_;
 
-    return $vga && ($vga eq 'qxl');
+    return $vga && ($vga =~ m/^qxl/);
 }
 
 sub config_to_command {
@@ -2290,6 +2290,16 @@ sub config_to_command {
     push @$devices, '-readconfig', '/usr/share/qemu-server/pve-usb.cfg' if $use_usb2;
 
     my $vga = $conf->{vga};
+
+    my $qxlnum = 0;
+    if (vga_conf_has_spice($vga)) {
+        $qxlnum = 1;
+        if($vga =~ m/^qxl(\d+)$/){
+            $qxlnum = $1;
+        }
+        $vga = 'qxl';
+    }
+
     if (!$vga) {
 	if ($conf->{ostype} && ($conf->{ostype} eq 'win8' || 
 				$conf->{ostype} eq 'win7' || 
@@ -2474,6 +2484,19 @@ sub config_to_command {
 
     my $spice_port;
     if (vga_conf_has_spice($vga)) {
+
+	if($qxlnum > 1 && $conf->{ostype} && $conf->{ostype} eq 'l26'){
+	    push @$cmd, '-global', 'qxl-vga.ram_size=134217728';
+	    push @$cmd, '-global', 'qxl-vga.vram_size=67108864';
+	}
+
+	if($qxlnum > 1 &&  $conf->{ostype} && $conf->{ostype} =~ m/^w/){
+	    for(my $i = 1; $i < $qxlnum; $i++){
+		my $pciaddr = print_pci_addr("vga$i", $bridges);
+		push @$cmd, '-device', "qxl,id=vga$i,ram_size=67108864,vram_size=33554432$pciaddr";
+	    }
+	}
+
 	my $pciaddr = print_pci_addr("spice", $bridges);
 
 	$spice_port = PVE::Tools::next_unused_port(61000, 61099);
@@ -3514,6 +3537,9 @@ sub print_pci_addr {
 	net3 => { bus => 0, addr => 21 },
 	net4 => { bus => 0, addr => 22 },
 	net5 => { bus => 0, addr => 23 },
+	vga1 => { bus => 0, addr => 24 },
+	vga2 => { bus => 0, addr => 25 },
+	vga3 => { bus => 0, addr => 26 },
 	#addr29 : usb-host (pve-usb.cfg)
 	'pci.1' => { bus => 0, addr => 30 },
 	'pci.2' => { bus => 0, addr => 31 },
-- 
1.7.10.4




More information about the pve-devel mailing list