[PATCH] dcc: move id from CommonChannelClient to DisplayChannelClient

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Was not used by CursorChannelClient but only by DisplayChannelClient.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/dcc-send.c   | 14 +++++++-------
 server/dcc.c        | 15 ++++++++-------
 server/dcc.h        |  1 +
 server/red-worker.c |  1 -
 server/red-worker.h |  1 -
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/server/dcc-send.c b/server/dcc-send.c
index 14ce239..4180cc1 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -61,9 +61,9 @@ static int dcc_pixmap_cache_unlocked_hit(DisplayChannelClient *dcc, uint64_t id,
         if (item->id == id) {
             ring_remove(&item->lru_link);
             ring_add(&cache->lru, &item->lru_link);
-            spice_assert(dcc->common.id < MAX_CACHE_CLIENTS);
-            item->sync[dcc->common.id] = serial;
-            cache->sync[dcc->common.id] = serial;
+            spice_assert(dcc->id < MAX_CACHE_CLIENTS);
+            item->sync[dcc->id] = serial;
+            cache->sync[dcc->id] = serial;
             *lossy = item->lossy;
             break;
         }
@@ -1886,13 +1886,13 @@ static void dcc_pixmap_cache_reset(DisplayChannelClient *dcc, SpiceMsgWaitForCha
     pixmap_cache_clear(cache);
 
     dcc->pixmap_cache_generation = ++cache->generation;
-    cache->generation_initiator.client = dcc->common.id;
+    cache->generation_initiator.client = dcc->id;
     cache->generation_initiator.message = serial;
-    cache->sync[dcc->common.id] = serial;
+    cache->sync[dcc->id] = serial;
 
     wait_count = 0;
     for (i = 0; i < MAX_CACHE_CLIENTS; i++) {
-        if (cache->sync[i] && i != dcc->common.id) {
+        if (cache->sync[i] && i != dcc->id) {
             sync_data->wait_list[wait_count].channel_type = SPICE_CHANNEL_DISPLAY;
             sync_data->wait_list[wait_count].channel_id = i;
             sync_data->wait_list[wait_count++].message_serial = cache->sync[i];
@@ -2341,7 +2341,7 @@ static void begin_send_message(RedChannelClient *rcc)
         int i;
 
         for (i = 0; i < MAX_CACHE_CLIENTS; i++) {
-            if (i != dcc->common.id && free_list->sync[i] != 0) {
+            if (i != dcc->id && free_list->sync[i] != 0) {
                 free_list->wait.header.wait_list[sync_count].channel_type = SPICE_CHANNEL_DISPLAY;
                 free_list->wait.header.wait_list[sync_count].channel_id = i;
                 free_list->wait.header.wait_list[sync_count++].message_serial = free_list->sync[i];
diff --git a/server/dcc.c b/server/dcc.c
index 72a7130..dca9a64 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -373,6 +373,7 @@ DisplayChannelClient *dcc_new(DisplayChannel *display,
         client, stream, mig_target, TRUE,
         common_caps, num_common_caps,
         caps, num_caps);
+    dcc->id = display->common.qxl->id;
     spice_return_val_if_fail(dcc, NULL);
     spice_info("New display (client %p) dcc %p stream %p", client, dcc, stream);
 
@@ -424,8 +425,8 @@ static int display_channel_client_wait_for_init(DisplayChannelClient *dcc)
         if (dcc->pixmap_cache && dcc->glz_dict) {
             dcc->pixmap_cache_generation = dcc->pixmap_cache->generation;
             /* TODO: move common.id? if it's used for a per client structure.. */
-            spice_info("creating encoder with id == %d", dcc->common.id);
-            dcc->glz = glz_encoder_create(dcc->common.id, dcc->glz_dict->dict, &dcc->glz_data.usr);
+            spice_info("creating encoder with id == %d", dcc->id);
+            dcc->glz = glz_encoder_create(dcc->id, dcc->glz_dict->dict, &dcc->glz_data.usr);
             if (!dcc->glz) {
                 spice_critical("create global lz failed");
             }
@@ -1280,7 +1281,7 @@ int dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
         NewCacheItem **now;
 
         if (!(tail = (NewCacheItem *)ring_get_tail(&cache->lru)) ||
-                                                   tail->sync[dcc->common.id] == serial) {
+                                                   tail->sync[dcc->id] == serial) {
             cache->available += size;
             free(item);
             return FALSE;
@@ -1298,7 +1299,7 @@ int dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
         ring_remove(&tail->lru_link);
         cache->items--;
         cache->available += tail->size;
-        cache->sync[dcc->common.id] = serial;
+        cache->sync[dcc->id] = serial;
         dcc_push_release(dcc, SPICE_RES_TYPE_PIXMAP, tail->id, tail->sync);
         free(tail);
     }
@@ -1311,8 +1312,8 @@ int dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
     item->size = size;
     item->lossy = lossy;
     memset(item->sync, 0, sizeof(item->sync));
-    item->sync[dcc->common.id] = serial;
-    cache->sync[dcc->common.id] = serial;
+    item->sync[dcc->id] = serial;
+    cache->sync[dcc->id] = serial;
     return TRUE;
 }
 
@@ -1526,7 +1527,7 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
 
     if (dcc_handle_migrate_glz_dictionary(dcc, migrate_data)) {
         dcc->glz =
-            glz_encoder_create(dcc->common.id, dcc->glz_dict->dict, &dcc->glz_data.usr);
+            glz_encoder_create(dcc->id, dcc->glz_dict->dict, &dcc->glz_data.usr);
     } else {
         spice_critical("restoring global lz dictionary failed");
     }
diff --git a/server/dcc.h b/server/dcc.h
index a482938..cbeea75 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -56,6 +56,7 @@ typedef struct FreeList {
 
 struct DisplayChannelClient {
     CommonChannelClient common;
+    uint32_t id;
     SpiceImageCompression image_compression;
     spice_wan_compression_t jpeg_state;
     spice_wan_compression_t zlib_glz_state;
diff --git a/server/red-worker.c b/server/red-worker.c
index 6780d2b..0afbda5 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -457,7 +457,6 @@ CommonChannelClient *common_channel_new_client(CommonChannel *common,
         return NULL;
     }
     CommonChannelClient *common_cc = (CommonChannelClient*)rcc;
-    common_cc->id = common->qxl->id;
     common->during_target_migrate = mig_target;
 
     // TODO: move wide/narrow ack setting to red_channel.
diff --git a/server/red-worker.h b/server/red-worker.h
index 94974b7..b60375e 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -27,7 +27,6 @@ typedef struct RedWorker RedWorker;
 typedef struct CommonChannelClient {
     RedChannelClient base;
 
-    uint32_t id;
     int is_low_bandwidth;
 } CommonChannelClient;
 
-- 
2.5.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]