[Spice-commits] 5 commits - client/display_channel.cpp server/red_worker.c server/spice.h

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Fri Sep 7 09:09:24 PDT 2012


 client/display_channel.cpp |    1 +
 server/red_worker.c        |   31 +++++++++++++++++++++++++++++++
 server/spice.h             |    5 ++++-
 3 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit 88283023a89b4ee212ac08ede797d1ce1c3a0906
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Sat Sep 1 11:42:56 2012 -0400

    Bump spice.h version number to 0.11.4
    
    No new symbols are added, but there is an addition to QXLInterface:
    
        void (*set_client_capabilities)(QXLInstance *qin,
                                        uint8_t client_present,
                                        uint8_t caps[58]);

diff --git a/server/spice.h b/server/spice.h
index 6114407..3152f8c 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -22,7 +22,7 @@
 #include <sys/socket.h>
 #include <spice/qxl_dev.h>
 
-#define SPICE_SERVER_VERSION 0x000b02 /* release 0.11.2 */
+#define SPICE_SERVER_VERSION 0x000b04 /* release 0.11.4 */
 
 /* interface base type */
 
commit 7628b91a0b8b12dce3783623df58924b2ba43295
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Sat Sep 1 11:34:43 2012 -0400

    Set a8 capability in the QXL device if supported by the client

diff --git a/server/red_worker.c b/server/red_worker.c
index 75bc045..81fffd7 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -10362,6 +10362,8 @@ static void handle_new_display_channel(RedWorker *worker, RedClient *client, Red
             SET_CAP(caps, SPICE_DISPLAY_CAP_MONITORS_CONFIG);
         if (red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_COMPOSITE))
             SET_CAP(caps, SPICE_DISPLAY_CAP_COMPOSITE);
+        if (red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_A8_SURFACE))
+            SET_CAP(caps, SPICE_DISPLAY_CAP_A8_SURFACE);
 
         worker->qxl->st->qif->set_client_capabilities(worker->qxl, TRUE, caps);
     }
commit 8855438ab64d025495007b941ac75f2078274c13
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Sat Sep 1 11:13:49 2012 -0400

    Process outstanding commands in the ring after changing capability bits
    
    When a new client connects, there may be commands in the ring that it
    can't understand, so we need to process these before forwarding new
    commands to the client. By doing this after changing the capability
    bits we ensure that the new client will never see a command that it
    doesn't understand (under the assumption that the guest will read and
    obey the capability bits).
    
    Acked-by: Alon Levy <alonl at redhat.com>

diff --git a/server/red_worker.c b/server/red_worker.c
index 1e301c4..75bc045 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -9478,6 +9478,11 @@ static void on_new_display_channel_client(DisplayChannelClient *dcc)
     }
     red_channel_client_ack_zero_messages_window(&dcc->common.base);
     if (worker->surfaces[0].context.canvas) {
+        int ring_is_empty;
+
+        while (red_process_commands(worker, MAX_PIPE_SIZE, &ring_is_empty)) {
+        }
+        
         red_current_flush(worker, 0);
         push_new_primary_surface(dcc);
         red_push_surface_image(dcc, 0);
commit 83b3e3f20dbd7c87e2d7cace68d99138c09ed6ab
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Thu Aug 23 22:04:24 2012 -0400

    Add new set_client_capabilities() interface to QXLInstance
    
    A new interface
    
      set_client_capabilities (QXLInstance *qin,
      			   uint8_t client_present,
      			   uint8_t caps[58]);
    
    is added to QXLInstance, and spice server is changed to call it
    whenever a client connects or disconnects. The QXL device in response
    is expected to update the client capability bits in the ROM of the
    device and raise the QXL_INTERRUPT_CLIENT interrupt.
    
    There is a potential race condition in the case where a client
    disconnects and a new client with fewer capabilities connects. There
    may be commands in the ring that the new client can't handle. This
    case is handled by first changing the capability bits, then processing
    all commands in the ring, and then start forwarding commands to the
    new client. As long as the guest obeys the capability bits, the new
    client will never see anything it doesn't understand.

diff --git a/server/red_worker.c b/server/red_worker.c
index eee9915..1e301c4 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -10344,6 +10344,23 @@ static void handle_new_display_channel(RedWorker *worker, RedClient *client, Red
     spice_info("jpeg %s", display_channel->enable_jpeg ? "enabled" : "disabled");
     spice_info("zlib-over-glz %s", display_channel->enable_zlib_glz_wrap ? "enabled" : "disabled");
 
+    if (worker->qxl->st->qif->set_client_capabilities) {
+        RedChannelClient *rcc = (RedChannelClient *)dcc;
+        uint8_t caps[58] = { 0 };
+
+#define SET_CAP(a,c)                                                    \
+        ((a)[(c) / 8] |= (1 << ((c) % 8)))
+
+        if (red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_SIZED_STREAM))
+            SET_CAP(caps, SPICE_DISPLAY_CAP_SIZED_STREAM);
+        if (red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_MONITORS_CONFIG))
+            SET_CAP(caps, SPICE_DISPLAY_CAP_MONITORS_CONFIG);
+        if (red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_COMPOSITE))
+            SET_CAP(caps, SPICE_DISPLAY_CAP_COMPOSITE);
+
+        worker->qxl->st->qif->set_client_capabilities(worker->qxl, TRUE, caps);
+    }
+    
     // todo: tune level according to bandwidth
     display_channel->zlib_level = ZLIB_DEFAULT_COMPRESSION_LEVEL;
     red_display_client_init_streams(dcc);
@@ -11198,9 +11215,16 @@ void handle_dev_display_disconnect(void *opaque, void *payload)
 {
     RedWorkerMessageDisplayDisconnect *msg = payload;
     RedChannelClient *rcc = msg->rcc;
+    RedWorker *worker = opaque;
 
     spice_info("disconnect display client");
     spice_assert(rcc);
+
+    if (worker->qxl->st->qif->set_client_capabilities) {
+        uint8_t caps[58] = { 0 };
+        worker->qxl->st->qif->set_client_capabilities(worker->qxl, FALSE, caps);
+    }
+
     red_channel_client_disconnect(rcc);
 }
 
diff --git a/server/spice.h b/server/spice.h
index fdcfbb7..6114407 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -239,6 +239,9 @@ struct QXLInterface {
     void (*update_area_complete)(QXLInstance *qin, uint32_t surface_id,
                                  struct QXLRect *updated_rects,
                                  uint32_t num_updated_rects);
+    void (*set_client_capabilities)(QXLInstance *qin,
+				    uint8_t client_present,
+				    uint8_t caps[58]);
 };
 
 struct QXLInstance {
commit 9e9432c0233ff2e62170543634e5b2419891c0da
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Sat Sep 1 11:30:58 2012 -0400

    client: Advertise A8_SURFACE capability

diff --git a/client/display_channel.cpp b/client/display_channel.cpp
index d08072d..49a4c6a 100644
--- a/client/display_channel.cpp
+++ b/client/display_channel.cpp
@@ -652,6 +652,7 @@ DisplayChannel::DisplayChannel(RedClient& client, uint32_t id,
     set_draw_handlers();
 
     set_capability(SPICE_DISPLAY_CAP_COMPOSITE);
+    set_capability(SPICE_DISPLAY_CAP_A8_SURFACE);
 }
 
 DisplayChannel::~DisplayChannel()


More information about the Spice-commits mailing list