[Spice-devel] [spice PATCH 43/55] display & cursor migration: send SPICE_MSG_MIGRATE

Yonit Halperin yhalperi at redhat.com
Wed Aug 15 00:56:23 PDT 2012


---
 server/red_worker.c |   55 ++------------------------------------------------
 1 files changed, 3 insertions(+), 52 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index 7c71ba0..9e9908e 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -253,8 +253,6 @@ enum {
     PIPE_ITEM_TYPE_DRAW = PIPE_ITEM_TYPE_CHANNEL_BASE,
     PIPE_ITEM_TYPE_INVAL_ONE,
     PIPE_ITEM_TYPE_CURSOR,
-    PIPE_ITEM_TYPE_DISPLAY_MIGRATE, /* tmp. It will be substituted with
-                                       red_channel/PIPE_ITEM_TYPE_MIGRATE */
     PIPE_ITEM_TYPE_CURSOR_INIT,
     PIPE_ITEM_TYPE_IMAGE,
     PIPE_ITEM_TYPE_STREAM_CREATE,
@@ -626,7 +624,6 @@ struct DisplayChannelClient {
     CommonChannelClient common;
 
     int expect_init;
-    int expect_migrate_mark;
     int expect_migrate_data;
 
     PixmapCache *pixmap_cache;
@@ -669,7 +666,6 @@ struct DisplayChannel {
 
     // only required for one client, can be the first (or choose it by speed
     // and keep a pointer to it here?)
-    int expect_migrate_mark;
     int expect_migrate_data;
 
     int enable_jpeg;
@@ -8302,18 +8298,6 @@ static inline void red_marshall_inval(RedChannelClient *rcc,
     spice_marshall_msg_cursor_inval_one(base_marshaller, &inval_one);
 }
 
-static void display_channel_marshall_migrate(RedChannelClient *rcc,
-    SpiceMarshaller *base_marshaller)
-{
-    DisplayChannel *display_channel = SPICE_CONTAINEROF(rcc->channel, DisplayChannel, common.base);
-    SpiceMsgMigrate migrate;
-
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE, NULL);
-    migrate.flags = SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER;
-    spice_marshall_msg_migrate(base_marshaller, &migrate);
-    display_channel->expect_migrate_mark = TRUE;
-}
-
 static void display_channel_marshall_migrate_data(RedChannelClient *rcc,
                                                   SpiceMarshaller *base_marshaller)
 {
@@ -8644,17 +8628,6 @@ static void red_marshall_cursor_init(RedChannelClient *rcc, SpiceMarshaller *bas
     add_buf_from_info(base_marshaller, &info);
 }
 
-static void cursor_channel_marshall_migrate(RedChannelClient *rcc,
-                                            SpiceMarshaller *base_marshaller)
-{
-    SpiceMsgMigrate migrate;
-
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE, NULL);
-    migrate.flags = 0;
-
-    spice_marshall_msg_migrate(base_marshaller, &migrate);
-}
-
 static void red_marshall_cursor(RedChannelClient *rcc,
                    SpiceMarshaller *m, CursorPipeItem *cursor_pipe_item)
 {
@@ -8799,10 +8772,6 @@ static void display_channel_send_item(RedChannelClient *rcc, PipeItem *pipe_item
     case PIPE_ITEM_TYPE_VERB:
         red_marshall_verb(rcc, ((VerbItem*)pipe_item)->verb);
         break;
-    case PIPE_ITEM_TYPE_DISPLAY_MIGRATE:
-        spice_info("PIPE_ITEM_TYPE_MIGRATE");
-        display_channel_marshall_migrate(rcc, m);
-        break;
     case PIPE_ITEM_TYPE_MIGRATE_DATA:
         display_channel_marshall_migrate_data(rcc, m);
         break;
@@ -8864,10 +8833,6 @@ static void cursor_channel_send_item(RedChannelClient *rcc, PipeItem *pipe_item)
     case PIPE_ITEM_TYPE_VERB:
         red_marshall_verb(rcc, ((VerbItem*)pipe_item)->verb);
         break;
-    case PIPE_ITEM_TYPE_DISPLAY_MIGRATE:
-        spice_info("PIPE_ITEM_TYPE_MIGRATE");
-        cursor_channel_marshall_migrate(rcc, m);
-        break;
     case PIPE_ITEM_TYPE_CURSOR_INIT:
         red_reset_cursor_cache(rcc);
         red_marshall_cursor_init(rcc, m, pipe_item);
@@ -9009,14 +8974,9 @@ void red_disconnect_all_display_TODO_remove_me(RedChannel *channel)
 
 static void red_migrate_display(RedWorker *worker, RedChannelClient *rcc)
 {
-    // TODO: replace all worker->display_channel tests with
-    // is_connected
     if (red_channel_client_is_connected(rcc)) {
-        red_pipe_add_verb(rcc, PIPE_ITEM_TYPE_DISPLAY_MIGRATE);
-//        red_pipes_add_verb(&worker->display_channel->common.base,
-//                           SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL);
-//        red_channel_pipes_add_type(&worker->display_channel->common.base,
-//                                   PIPE_ITEM_TYPE_MIGRATE);
+        red_pipe_add_verb(rcc, SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL);
+        red_channel_client_default_migrate(rcc);
     }
 }
 
@@ -9631,11 +9591,6 @@ static int display_channel_handle_migrate_mark(RedChannelClient *rcc)
     DisplayChannel *display_channel = SPICE_CONTAINEROF(rcc->channel, DisplayChannel, common.base);
     RedChannel *channel = &display_channel->common.base;
 
-    if (!display_channel->expect_migrate_mark) {
-        spice_warning("unexpected");
-        return FALSE;
-    }
-    display_channel->expect_migrate_mark = FALSE;
     red_channel_pipes_add_type(channel, PIPE_ITEM_TYPE_MIGRATE_DATA);
     return TRUE;
 }
@@ -10059,7 +10014,6 @@ static void display_channel_client_release_item_before_push(DisplayChannelClient
     }
     case PIPE_ITEM_TYPE_INVAL_ONE:
     case PIPE_ITEM_TYPE_VERB:
-    case PIPE_ITEM_TYPE_DISPLAY_MIGRATE:
     case PIPE_ITEM_TYPE_MIGRATE_DATA:
     case PIPE_ITEM_TYPE_PIXMAP_SYNC:
     case PIPE_ITEM_TYPE_PIXMAP_RESET:
@@ -10212,12 +10166,10 @@ static void red_disconnect_cursor(RedChannel *channel)
 
 static void red_migrate_cursor(RedWorker *worker, RedChannelClient *rcc)
 {
-//    if (cursor_is_connected(worker)) {
     if (red_channel_client_is_connected(rcc)) {
         red_channel_client_pipe_add_type(rcc,
                                          PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
-        red_channel_client_pipe_add_type(rcc,
-                                         PIPE_ITEM_TYPE_DISPLAY_MIGRATE);
+        red_channel_client_default_migrate(rcc);
     }
 }
 
@@ -10256,7 +10208,6 @@ static void cursor_channel_client_release_item_before_push(CursorChannelClient *
     }
     case PIPE_ITEM_TYPE_INVAL_ONE:
     case PIPE_ITEM_TYPE_VERB:
-    case PIPE_ITEM_TYPE_DISPLAY_MIGRATE:
     case PIPE_ITEM_TYPE_CURSOR_INIT:
     case PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE:
         free(item);
-- 
1.7.7.6



More information about the Spice-devel mailing list