[Spice-devel] [PATCH RFC 07/14] Pass surface directly calling dcc_clear_surface_drawables_from_pipe

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


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

diff --git a/server/dcc.c b/server/dcc.c
index be95e1b..3e597b8 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -65,22 +65,17 @@ int dcc_drawable_is_in_pipe(DisplayChannelClient *dcc, Drawable *drawable)
  * Return: TRUE if wait_if_used == FALSE, or otherwise, if all of the pipe items that
  * are related to the surface have been cleared (or sent) from the pipe.
  */
-int dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surface_id,
+int dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, RedSurface *surface,
                                           int wait_if_used)
 {
     GList *l;
     int x;
     RedChannelClient *rcc;
-    DisplayChannel *display;
-    RedSurface *surface;
 
     spice_return_val_if_fail(dcc != NULL, TRUE);
-    /* removing the newest drawables that their destination is surface_id and
+    /* removing the newest drawables that their destination is surface and
        no other drawable depends on them */
 
-    display = DCC_TO_DC(dcc);
-    surface = &display->priv->surfaces[surface_id];
-
     rcc = RED_CHANNEL_CLIENT(dcc);
     for (l = rcc->priv->pipe.head; l != NULL; ) {
         Drawable *drawable;
@@ -112,7 +107,7 @@ int dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surface
         }
 
         if (depend_found) {
-            spice_debug("surface %d dependent item found %p, %p", surface_id, drawable, item);
+            spice_debug("surface %d dependent item found %p, %p", surface->id, drawable, item);
             if (!wait_if_used) {
                 return TRUE;
             }
diff --git a/server/dcc.h b/server/dcc.h
index 932e051..47386ff 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -44,6 +44,7 @@
 typedef struct DisplayChannel DisplayChannel;
 typedef struct Stream Stream;
 typedef struct StreamAgent StreamAgent;
+struct RedSurface;
 
 typedef struct WaitForChannels {
     SpiceMsgWaitForChannels header;
@@ -146,7 +147,7 @@ void                       dcc_add_drawable_after                    (DisplayCha
 void                       dcc_send_item                             (RedChannelClient *dcc,
                                                                       RedPipeItem *item);
 int                        dcc_clear_surface_drawables_from_pipe     (DisplayChannelClient *dcc,
-                                                                      int surface_id,
+                                                                      struct RedSurface *surface,
                                                                       int wait_if_used);
 int                        dcc_drawable_is_in_pipe                   (DisplayChannelClient *dcc,
                                                                       Drawable *drawable);
diff --git a/server/display-channel.c b/server/display-channel.c
index 87c801b..006b218 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1693,14 +1693,14 @@ void display_channel_update(DisplayChannel *display,
         region_clear(&surface->draw_dirty_region);
 }
 
-static void clear_surface_drawables_from_pipes(DisplayChannel *display, int surface_id,
+static void clear_surface_drawables_from_pipes(DisplayChannel *display, RedSurface *surface,
                                                int wait_if_used)
 {
     GListIter iter;
     DisplayChannelClient *dcc;
 
     FOREACH_DCC(display, iter, dcc) {
-        if (!dcc_clear_surface_drawables_from_pipe(dcc, surface_id, wait_if_used)) {
+        if (!dcc_clear_surface_drawables_from_pipe(dcc, surface, wait_if_used)) {
             red_channel_client_disconnect(RED_CHANNEL_CLIENT(dcc));
         }
     }
@@ -1714,7 +1714,7 @@ static void display_channel_destroy_surface(DisplayChannel *display, RedSurface
        otherwise "current" will hold items that other drawables may depend on, and then
        current_remove_all will remove them from the pipe. */
     current_remove_all(display, surface);
-    clear_surface_drawables_from_pipes(display, surface->id, FALSE);
+    clear_surface_drawables_from_pipes(display, surface, FALSE);
     display_channel_surface_unref(display, surface);
 }
 
@@ -1731,7 +1731,7 @@ void display_channel_destroy_surface_wait(DisplayChannel *display, uint32_t surf
        otherwise "current" will hold items that other drawables may depend on, and then
        current_remove_all will remove them from the pipe. */
     current_remove_all(display, surface);
-    clear_surface_drawables_from_pipes(display, surface_id, TRUE);
+    clear_surface_drawables_from_pipes(display, surface, TRUE);
 }
 
 /* called upon device reset */
-- 
2.7.4



More information about the Spice-devel mailing list