]> xenbits.xensource.com Git - libvirt.git/commitdiff
spice: support streaming-video parameter
authorAlon Levy <alevy@redhat.com>
Mon, 23 May 2011 15:16:42 +0000 (18:16 +0300)
committerEric Blake <eblake@redhat.com>
Tue, 24 May 2011 02:53:59 +0000 (20:53 -0600)
This adds a streaming-video=filter|all|off attribute. It is used to change
the behavior of video stream detection in spice, the default is filter (the
default for libvirt is not to specify it - the actual default is defined in
libspice-server.so).

Usage:

    <graphics type='spice' autoport='yes'>
      <streaming mode='off'/>
    </graphics>

Tested with the above and with tests/qemuxml2argvtest.

Signed-off-by: Alon Levy <alevy@redhat.com>
docs/formatdomain.html.in
docs/schemas/domain.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
src/libvirt_private.syms
src/qemu/qemu_command.c
tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml

index 59c3d5178db17f807efaccd5efa2ee484276d328..f8baffd66bc28704405f4f0ac36bcbe74ed0d353 100644 (file)
@@ -1798,6 +1798,7 @@ qemu-kvm -net nic,model=? /dev/null
     &lt;channel name='main' mode='secure'/&gt;
     &lt;channel name='record' mode='insecure'/&gt;
     &lt;image compression='auto_glz'/&gt;
+    &lt;streaming mode='filter'/&gt;
   &lt;/graphics&gt;</pre>
             <p>
               Spice supports variable compression settings for audio,
@@ -1816,6 +1817,12 @@ qemu-kvm -net nic,model=? /dev/null
               and <code>playback</code> for enabling audio stream
               compression (accepts <code>on</code> or <code>off</code>).
             </p>
+            <p>
+              Streaming mode is set by the <code>streaming</code>
+              element, settings it's <code>mode</code> attribute to one
+              of <code>filter</code>, <code>all</code>
+              or <code>off</code>, <span class="since">since 0.9.2</span>.
+            </p>
           </dd>
           <dt><code>"rdp"</code></dt>
           <dd>
index b252547eb91edd8bdf5eb7fc117c68b359e324c8..563981d435c6b3ab073c9c34c4fe9936b3fc3b90 100644 (file)
                 <empty/>
               </element>
             </optional>
+            <optional>
+              <element name="streaming">
+                <attribute name="mode">
+                  <choice>
+                    <value>filter</value>
+                    <value>all</value>
+                    <value>off</value>
+                  </choice>
+                </attribute>
+                <empty/>
+              </element>
+            </optional>
           </interleave>
         </group>
         <group>
index 6129bbc6b468d7200cc1607b7c8438b0baf96f43..3f2fb1103c7f8a4973b1e0c10c3904d2a4e5b504 100644 (file)
@@ -359,6 +359,13 @@ VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression,
               "on",
               "off");
 
+VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode,
+              VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST,
+              "default",
+              "filter",
+              "all",
+              "off");
+
 VIR_ENUM_IMPL(virDomainHostdevMode, VIR_DOMAIN_HOSTDEV_MODE_LAST,
               "subsystem",
               "capabilities")
@@ -4168,6 +4175,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
                     VIR_FREE(compression);
 
                     def->data.spice.playback = compressionVal;
+                } else if (xmlStrEqual(cur->name, BAD_CAST "streaming")) {
+                    const char *mode = virXMLPropString(cur, "mode");
+                    int modeVal;
+
+                    if (!mode) {
+                        virDomainReportError(VIR_ERR_XML_ERROR, "%s",
+                                             _("spice streaming missing mode"));
+                        goto error;
+                    }
+                    if ((modeVal =
+                         virDomainGraphicsSpiceStreamingModeTypeFromString(mode)) <= 0) {
+                        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                                             _("unknown spice streaming mode"));
+                        VIR_FREE(mode);
+                        goto error;
+
+                    }
+                    VIR_FREE(mode);
+
+                    def->data.spice.streaming = modeVal;
                 }
             }
             cur = cur->next;
@@ -8067,6 +8094,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
         if (def->data.spice.playback)
             virBufferAsprintf(buf, "      <playback compression='%s'/>\n",
                               virDomainGraphicsSpicePlaybackCompressionTypeToString(def->data.spice.playback));
+        if (def->data.spice.streaming)
+            virBufferAsprintf(buf, "      <streaming mode='%s'/>\n",
+                              virDomainGraphicsSpiceStreamingModeTypeToString(def->data.spice.streaming));
     }
 
     if (children) {
index 5fe31d41d2d431d6e07a2c80a470410b1bf2d20a..9d4349e480679766e0b3ded07d096e3a9445cc91 100644 (file)
@@ -697,6 +697,15 @@ enum virDomainGraphicsSpicePlaybackCompression {
     VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST
 };
 
+enum virDomainGraphicsSpiceStreamingMode {
+    VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_DEFAULT = 0,
+    VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_FILTER,
+    VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_ALL,
+    VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_OFF,
+
+    VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST
+};
+
 typedef struct _virDomainGraphicsDef virDomainGraphicsDef;
 typedef virDomainGraphicsDef *virDomainGraphicsDefPtr;
 struct _virDomainGraphicsDef {
@@ -738,6 +747,7 @@ struct _virDomainGraphicsDef {
             int jpeg;
             int zlib;
             int playback;
+            int streaming;
         } spice;
     } data;
 };
@@ -1506,6 +1516,7 @@ VIR_ENUM_DECL(virDomainGraphicsSpiceImageCompression)
 VIR_ENUM_DECL(virDomainGraphicsSpiceJpegCompression)
 VIR_ENUM_DECL(virDomainGraphicsSpiceZlibCompression)
 VIR_ENUM_DECL(virDomainGraphicsSpicePlaybackCompression)
+VIR_ENUM_DECL(virDomainGraphicsSpiceStreamingMode)
 /* from libvirt.h */
 VIR_ENUM_DECL(virDomainState)
 VIR_ENUM_DECL(virDomainNostateReason)
index 7b6151c6abcb7e335f5ae15e87839f572fb3b343..4cb8ddad8ddf54ac340fbd6eee02710f173fa74f 100644 (file)
@@ -274,6 +274,8 @@ virDomainGraphicsSpiceJpegCompressionTypeFromString;
 virDomainGraphicsSpiceJpegCompressionTypeToString;
 virDomainGraphicsSpicePlaybackCompressionTypeFromString;
 virDomainGraphicsSpicePlaybackCompressionTypeToString;
+virDomainGraphicsSpiceStreamingModeTypeFromString;
+virDomainGraphicsSpiceStreamingModeTypeToString;
 virDomainGraphicsSpiceZlibCompressionTypeFromString;
 virDomainGraphicsSpiceZlibCompressionTypeToString;
 virDomainGraphicsTypeFromString;
index 2828823bf1b510a623d2061cf5799a29f543f822..839405f04983376ed71bd7c6985d1d396aff2222 100644 (file)
@@ -4037,6 +4037,9 @@ qemuBuildCommandLine(virConnectPtr conn,
         if (def->graphics[0]->data.spice.playback)
             virBufferAsprintf(&opt, ",playback-compression=%s",
                               virDomainGraphicsSpicePlaybackCompressionTypeToString(def->graphics[0]->data.spice.playback));
+        if (def->graphics[0]->data.spice.streaming)
+            virBufferAsprintf(&opt, ",streaming-video=%s",
+                              virDomainGraphicsSpiceStreamingModeTypeToString(def->graphics[0]->data.spice.streaming));
 
         virCommandAddArg(cmd, "-spice");
         virCommandAddArgBuffer(cmd, &opt);
index 70cd35b08842a3da18d8a43a46d83c42ca1bae03..084a10019784fcd2ef615f5bc7e169d96ae46715 100644 (file)
@@ -4,6 +4,6 @@ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda \
 /dev/HostVG/QEMUGuest1 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1,\
 x509-dir=/etc/pki/libvirt-spice,tls-channel=main,plaintext-channel=inputs,\
 image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,\
-playback-compression=on -vga \
+playback-compression=on,streaming-video=filter -vga \
 qxl -global qxl.vram_size=18874368 -device qxl,id=video1,vram_size=33554432,bus=pci.0,addr=0x4 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
index a29f50d1cebb04db8b5ef8ef7b82658f63d72032..0d3dd48761d8c134545b1dbab7c0a56db8fdb4f1 100644 (file)
@@ -28,6 +28,7 @@
       <jpeg compression='auto'/>
       <zlib compression='auto'/>
       <playback compression='on'/>
+      <streaming mode='filter'/>
     </graphics>
     <video>
       <model type='qxl' vram='18432' heads='1'/>