[Spice-devel] [PATCH 05/24] display: make get_drawable symmetric to display_channel_drawable_unref
Frediano Ziglio
fziglio at redhat.com
Tue Dec 1 04:05:17 PST 2015
Make possible to safely call display_channel_drawable_unref straight
forward to get_drawable call.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/display-channel.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/server/display-channel.c b/server/display-channel.c
index 0b4415b..45594d8 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1117,7 +1117,16 @@ Drawable *display_channel_get_drawable(DisplayChannel *display, uint8_t effect,
drawable->red_drawable = red_drawable_ref(red_drawable);
drawable->surface_id = red_drawable->surface_id;
+ display->surfaces[drawable->surface_id].refs++;
+
memcpy(drawable->surface_deps, red_drawable->surface_deps, sizeof(drawable->surface_deps));
+ /*
+ surface->refs is affected by a drawable (that is
+ dependent on the surface) as long as the drawable is alive.
+ However, surface->depend_on_me is affected by a drawable only
+ as long as it is in the current tree (hasn't been rendered yet).
+ */
+ red_inc_surfaces_drawable_dependencies(display, drawable);
return drawable;
}
@@ -1128,9 +1137,6 @@ void display_channel_add_drawable(DisplayChannel *display, Drawable *drawable)
RedDrawable *red_drawable = drawable->red_drawable;
red_drawable->mm_time = reds_get_mm_time();
- surface_id = drawable->surface_id;
-
- display->surfaces[surface_id].refs++;
region_add(&drawable->tree_item.base.rgn, &red_drawable->bbox);
@@ -1143,14 +1149,6 @@ void display_channel_add_drawable(DisplayChannel *display, Drawable *drawable)
region_destroy(&rgn);
}
- /*
- surface->refs is affected by a drawable (that is
- dependent on the surface) as long as the drawable is alive.
- However, surface->depend_on_me is affected by a drawable only
- as long as it is in the current tree (hasn't been rendered yet).
- */
- red_inc_surfaces_drawable_dependencies(display, drawable);
-
if (region_is_empty(&drawable->tree_item.base.rgn)) {
return;
}
--
2.4.3
More information about the Spice-devel
mailing list