[Spice-devel] [PATCH v2 03/10] Palette cache: Use correct marshal function

Jonathon Jongsma jjongsma at redhat.com
Mon Nov 2 12:06:40 PST 2015


In order to invalidate a single palette cache item, we were using
spice_marshall_msg_cursor_inval_one(), which is the marshal function
used to send an invalidation message for the Cursor channel's cache.
This didn't cause any problems because SPICE_MSG_CURSOR_INVAL_ONE and
SPICE_MSG_DISPLAY_INVAL_PALETTE have the same message ID and parameters,
but it's better to use the correct marshalling function.
---

As I mentioned in the previous email, the real cause of the warning being fixed
by the previous patch was due to the removal of the PIPE_ITEM_TYPE_INVAL_ONE
case statement from display_channel_send_item(). So leaving this case in the
switch ensures that we don't get the warning. However, we were previously using
cursor-channel marshalling functions to send the display cache messages. It
worked because they happened to have the same message ID, but this patch makes
things more correct.

 server/red_worker.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index e3999ba..7c599b0 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -7626,15 +7626,17 @@ static inline void marshall_qxl_drawable(RedChannelClient *rcc,
         red_lossy_marshall_qxl_drawable(display_channel->common.worker, rcc, m, dpi);
 }
 
-static inline void red_marshall_inval(RedChannelClient *rcc,
-                                      SpiceMarshaller *base_marshaller, CacheItem *cach_item)
+static inline void red_marshall_inval_palette(RedChannelClient *rcc,
+                                              SpiceMarshaller *base_marshaller,
+                                              CacheItem *cache_item)
 {
     SpiceMsgDisplayInvalOne inval_one;
 
-    red_channel_client_init_send_data(rcc, cach_item->inval_type, NULL);
-    inval_one.id = *(uint64_t *)&cach_item->id;
+    red_channel_client_init_send_data(rcc, cache_item->inval_type, NULL);
+    inval_one.id = *(uint64_t *)&cache_item->id;
+
+    spice_marshall_msg_display_inval_palette(base_marshaller, &inval_one);
 
-    spice_marshall_msg_cursor_inval_one(base_marshaller, &inval_one);
 }
 
 static void display_channel_marshall_migrate_data_surfaces(DisplayChannelClient *dcc,
@@ -8093,7 +8095,7 @@ static void display_channel_send_item(RedChannelClient *rcc, PipeItem *pipe_item
         break;
     }
     case PIPE_ITEM_TYPE_INVAL_ONE:
-        red_marshall_inval(rcc, m, (CacheItem *)pipe_item);
+        red_marshall_inval_palette(rcc, m, (CacheItem *)pipe_item);
         break;
     case PIPE_ITEM_TYPE_STREAM_CREATE: {
         StreamAgent *agent = SPICE_CONTAINEROF(pipe_item, StreamAgent, create_item);
@@ -9352,7 +9354,6 @@ static void display_channel_client_release_item_before_push(DisplayChannelClient
         free(item);
         break;
     }
-    case PIPE_ITEM_TYPE_INVAL_ONE:
     case PIPE_ITEM_TYPE_VERB:
     case PIPE_ITEM_TYPE_MIGRATE_DATA:
     case PIPE_ITEM_TYPE_PIXMAP_SYNC:
-- 
2.4.3



More information about the Spice-devel mailing list