[Spice-commits] 2 commits - server/reds.c server/red_worker.c server/spice.h

Alexander Larsson alexl at kemper.freedesktop.org
Thu Sep 2 09:45:33 PDT 2010


 server/red_worker.c |   15 ++++++++++-----
 server/reds.c       |   20 ++++++++++++++++++++
 server/spice.h      |   13 +++++++++++++
 3 files changed, 43 insertions(+), 5 deletions(-)

New commits:
commit 039700a90f5c2a0e0d3097e4feae3a84998e4111
Author: Yonit Halperin <yhalperi at redhat.com>
Date:   Wed Sep 1 12:10:35 2010 +0300

    server: avoid creating a stream from traces more than once for the same drawable
    
    could have caused ASSERT(!drawable->stream) in red_create_stream

diff --git a/server/red_worker.c b/server/red_worker.c
index 36c2763..74d26fe 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -2732,7 +2732,8 @@ static inline int red_is_stream_start(Drawable *drawable)
             (RED_STREAM_GRADUAL_FRAMES_START_CONDITION * drawable->frames_count)));
 }
 
-static void red_stream_add_frame(RedWorker* worker, Drawable *frame_drawable,
+// returns whether a stream was created
+static int red_stream_add_frame(RedWorker* worker, Drawable *frame_drawable,
                                  int frames_count,
                                  int gradual_frames_count,
                                  int last_gradual_frame)
@@ -2757,7 +2758,9 @@ static void red_stream_add_frame(RedWorker* worker, Drawable *frame_drawable,
 
     if (red_is_stream_start(frame_drawable)) {
         red_create_stream(worker, frame_drawable);
+        return TRUE;
     }
+    return FALSE;
 }
 
 static inline void red_stream_maintenance(RedWorker *worker, Drawable *candidate, Drawable *prev)
@@ -2890,10 +2893,12 @@ static inline void red_use_stream_trace(RedWorker *worker, Drawable *drawable)
     for (; trace < trace_end; trace++) {
         if (__red_is_next_stream_frame(worker, drawable, trace->width, trace->height,
                                        &trace->dest_area, trace->time, NULL)) {
-            red_stream_add_frame(worker, drawable,
-                                 trace->frames_count,
-                                 trace->gradual_frames_count,
-                                 trace->last_gradual_frame);
+            if (red_stream_add_frame(worker, drawable,
+                                     trace->frames_count,
+                                     trace->gradual_frames_count,
+                                     trace->last_gradual_frame)) {
+                return;
+            }
         }
     }
 }
commit 0c6d654c2f67795fe5c3229bb615ab2bd99ef7a4
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Aug 26 15:14:05 2010 +0200

    Add API to turn on backwards compatibility mode
    
    When upgrading a cluster of machines you typically do this by
    upgrading a set of machines at a time, making the new machines run
    the new software version, but in a fashion compatible with the old
    versions (in terms of e.g. migration). Then when all machines are
    upgrades, any new features in the new version can be enabled.
    
    This API allows qemu to limit the set of features that spice uses to
    those compatible with an older version, in order to do an upgrade like
    this. Right now it doesn't really do much, since we don't keep compat
    with 0.4.0 atm (although that may be added later).
    
    There is no guarantee that any future version of spice support
    being compatible with any previous version. However, we will always
    support compatibility with the previous major version so that clusters
    can be upgraded step by step.

diff --git a/server/reds.c b/server/reds.c
index ca58772..5fafe40 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3768,6 +3768,26 @@ __visible__ void spice_server_destroy(SpiceServer *s)
     reds_exit();
 }
 
+__visible__ spice_compat_version_t spice_get_current_compat_version(void)
+{
+    return SPICE_COMPAT_VERSION_CURRENT;
+}
+
+__visible__ int spice_server_set_compat_version(SpiceServer *s,
+                                                spice_compat_version_t version)
+{
+    if (version < SPICE_COMPAT_VERSION_0_6) {
+        /* We don't support 0.4 compat mode atm */
+        return -1;
+    }
+
+    if (version > SPICE_COMPAT_VERSION_CURRENT) {
+        /* Not compatible with future versions */
+        return -1;
+    }
+    return 0;
+}
+
 __visible__ int spice_server_set_port(SpiceServer *s, int port)
 {
     ASSERT(reds == s);
diff --git a/server/spice.h b/server/spice.h
index 65683a3..6f4c782 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -307,6 +307,17 @@ uint32_t spice_server_record_get_samples(SpiceRecordInstance *sin,
 
 /* spice server setup */
 
+/* Don't use features incompatible with a specific spice
+   version, so that migration to/from that version works. */
+typedef enum {
+    SPICE_COMPAT_VERSION_0_4 = 0,
+    SPICE_COMPAT_VERSION_0_6 = 1,
+} spice_compat_version_t;
+
+#define SPICE_COMPAT_VERSION_CURRENT SPICE_COMPAT_VERSION_0_6
+
+spice_compat_version_t spice_get_current_compat_version(void);
+
 typedef struct RedsState SpiceServer;
 SpiceServer *spice_server_new(void);
 int spice_server_init(SpiceServer *s, SpiceCoreInterface *core);
@@ -315,6 +326,8 @@ void spice_server_destroy(SpiceServer *s);
 #define SPICE_ADDR_FLAG_IPV4_ONLY (1 << 0)
 #define SPICE_ADDR_FLAG_IPV6_ONLY (1 << 1)
 
+int spice_server_set_compat_version(SpiceServer *s,
+                                    spice_compat_version_t version);
 int spice_server_set_port(SpiceServer *s, int port);
 void spice_server_set_addr(SpiceServer *s, const char *addr, int flags);
 int spice_server_set_noauth(SpiceServer *s);


More information about the Spice-commits mailing list