[PATCH spice-server 6/6] Move display field from Drawable to _Drawable (pool object)

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

 



This pointer is used only to maintain the pool.
There is no reason to expose this to the other objects.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/display-channel-private.h | 1 +
 server/display-channel.c         | 7 ++-----
 server/display-channel.h         | 1 -
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/server/display-channel-private.h b/server/display-channel-private.h
index 617ce30d..ff3dde30 100644
--- a/server/display-channel-private.h
+++ b/server/display-channel-private.h
@@ -69,6 +69,7 @@ struct _Drawable {
         Drawable drawable;
         _Drawable *next;
     } u;
+    DisplayChannel *display;
 };
 
 struct DisplayChannelPrivate
diff --git a/server/display-channel.c b/server/display-channel.c
index 899df42c..9ac9c5c5 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1594,6 +1594,7 @@ static Drawable* drawable_try_new(DisplayChannel *display)
     if (!display->priv->free_drawables)
         return NULL;
 
+    display->priv->free_drawables->display = display;
     drawable = &display->priv->free_drawables->u.drawable;
     display->priv->free_drawables = display->priv->free_drawables->u.next;
     display->priv->drawable_count++;
@@ -1633,10 +1634,6 @@ static Drawable *display_channel_drawable_try_new(DisplayChannel *display,
     }
 
     bzero(drawable, sizeof(Drawable));
-    /* Pointer to the display from which the drawable is allocated.  This
-     * pointer is safe to be retained as DisplayChannel lifespan is bigger than
-     * all drawables.  */
-    drawable->display = display;
     drawable->refs = 1;
     drawable->creation_time = drawable->first_frame_time = spice_get_monotonic_time_ns();
     ring_item_init(&drawable->list_link);
@@ -1688,7 +1685,7 @@ static void drawable_unref_surface_deps(DisplayChannel *display, Drawable *drawa
 
 void drawable_unref(Drawable *drawable)
 {
-    DisplayChannel *display = drawable->display;
+    DisplayChannel *display = SPICE_CONTAINEROF(drawable, _Drawable, u.drawable)->display;
 
     if (--drawable->refs != 0)
         return;
diff --git a/server/display-channel.h b/server/display-channel.h
index e26d2ba1..04c4f3d5 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -104,7 +104,6 @@ struct Drawable {
     int surface_deps[3];
 
     uint32_t process_commands_generation;
-    DisplayChannel *display;
 };
 
 DisplayChannel*            display_channel_new                       (RedsState *reds,
-- 
2.14.3

_______________________________________________
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]