[Spice-devel] [PATCH RFC 11/14] Pass surface directly to dcc_push_surface_image

Frediano Ziglio fziglio at redhat.com
Thu Sep 29 08:44:10 UTC 2016


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/dcc.c             | 13 +++++--------
 server/dcc.h             |  3 +--
 server/display-channel.c |  5 +++--
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/server/dcc.c b/server/dcc.c
index 8a63caf..a800aaa 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -217,18 +217,15 @@ RedImageItem *dcc_add_surface_area_image(DisplayChannelClient *dcc,
     return item;
 }
 
-void dcc_push_surface_image(DisplayChannelClient *dcc, int surface_id)
+void dcc_push_surface_image(DisplayChannelClient *dcc, RedSurface *surface)
 {
-    DisplayChannel *display;
     SpiceRect area;
-    RedSurface *surface;
+    uint32_t surface_id = surface->id;
 
     if (!dcc) {
         return;
     }
 
-    display = DCC_TO_DC(dcc);
-    surface = &display->priv->surfaces[surface_id];
     if (!surface->context.canvas) {
         return;
     }
@@ -257,7 +254,7 @@ static void add_drawable_surface_images(DisplayChannelClient *dcc, Drawable *dra
             }
             dcc_create_surface(dcc, drawable->surface_deps[x]);
             display_channel_current_flush(display, drawable->surface_deps[x]);
-            dcc_push_surface_image(dcc, surface_id);
+            dcc_push_surface_image(dcc, drawable->surface_deps[x]);
         }
     }
 
@@ -267,7 +264,7 @@ static void add_drawable_surface_images(DisplayChannelClient *dcc, Drawable *dra
 
     dcc_create_surface(dcc, drawable->surface);
     display_channel_current_flush(display, drawable->surface);
-    dcc_push_surface_image(dcc, drawable->surface->id);
+    dcc_push_surface_image(dcc, drawable->surface);
 }
 
 static void red_drawable_pipe_item_free(RedPipeItem *item)
@@ -439,7 +436,7 @@ void dcc_start(DisplayChannelClient *dcc)
         display_channel_current_flush(display, &display->priv->surfaces[0]);
         red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE);
         dcc_create_surface(dcc, &display->priv->surfaces[0]);
-        dcc_push_surface_image(dcc, 0);
+        dcc_push_surface_image(dcc, &display->priv->surfaces[0]);
         dcc_push_monitors_config(dcc);
         red_pipe_add_verb(rcc, SPICE_MSG_DISPLAY_MARK);
         dcc_create_all_streams(dcc);
diff --git a/server/dcc.h b/server/dcc.h
index 2068d78..db48191 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -123,8 +123,7 @@ void                       dcc_stream_agent_clip                     (DisplayCha
 void                       dcc_create_stream                         (DisplayChannelClient *dcc,
                                                                       Stream *stream);
 void dcc_create_surface(DisplayChannelClient *dcc, struct RedSurface *surface);
-void                       dcc_push_surface_image                    (DisplayChannelClient *dcc,
-                                                                      int surface_id);
+void dcc_push_surface_image(DisplayChannelClient *dcc, struct RedSurface *surface);
 RedImageItem *             dcc_add_surface_area_image                (DisplayChannelClient *dcc,
                                                                       int surface_id,
                                                                       SpiceRect *area,
diff --git a/server/display-channel.c b/server/display-channel.c
index 64a59de..d0b4a25 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1780,8 +1780,9 @@ static void send_create_surface(DisplayChannel *display, RedSurface *surface, in
 
     FOREACH_DCC(display, iter, dcc) {
         dcc_create_surface(dcc, surface);
-        if (image_ready)
-            dcc_push_surface_image(dcc, surface->id);
+        if (image_ready) {
+            dcc_push_surface_image(dcc, surface);
+        }
     }
 }
 
-- 
2.7.4



More information about the Spice-devel mailing list