[Spice-commits] server/display-channel.c server/display-channel.h server/red_worker.c server/stream.c server/stream.h
Frediano Ziglio
fziglio at kemper.freedesktop.org
Thu Nov 26 07:30:40 PST 2015
server/display-channel.c | 61 +++++++++++++++++++++++++++++++++++
server/display-channel.h | 3 -
server/red_worker.c | 80 -----------------------------------------------
server/stream.c | 19 +++++++++++
server/stream.h | 2 +
5 files changed, 82 insertions(+), 83 deletions(-)
New commits:
commit 4ca383b2613bdc89f2574c5bf74d259f69bcc4ec
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date: Tue Oct 1 17:00:13 2013 +0200
worker: move current_remove*
Acked-by: Fabiano FidĂȘncio <fidencio at redhat.com>
diff --git a/server/display-channel.c b/server/display-channel.c
index ffc9cfb..3e2419d 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -386,6 +386,67 @@ static void current_add_drawable(DisplayChannel *display,
drawable->refs++;
}
+static void current_remove_drawable(DisplayChannel *display, Drawable *item)
+{
+ /* todo: move all to unref? */
+ stream_trace_add_drawable(display, item);
+ draw_item_remove_shadow(&item->tree_item);
+ ring_remove(&item->tree_item.base.siblings_link);
+ ring_remove(&item->list_link);
+ ring_remove(&item->surface_list_link);
+ display_channel_drawable_unref(display, item);
+ display->current_size--;
+}
+
+static void current_remove(DisplayChannel *display, TreeItem *item)
+{
+ TreeItem *now = item;
+
+ /* depth-first tree traversal, TODO: do a to tree_foreach()? */
+ for (;;) {
+ Container *container = now->container;
+ RingItem *ring_item;
+
+ if (now->type == TREE_ITEM_TYPE_DRAWABLE) {
+ Drawable *drawable = SPICE_CONTAINEROF(now, Drawable, tree_item);
+ ring_item = now->siblings_link.prev;
+ red_pipes_remove_drawable(drawable);
+ current_remove_drawable(display, drawable);
+ } else {
+ Container *container = (Container *)now;
+
+ spice_assert(now->type == TREE_ITEM_TYPE_CONTAINER);
+
+ if ((ring_item = ring_get_head(&container->items))) {
+ now = SPICE_CONTAINEROF(ring_item, TreeItem, siblings_link);
+ continue;
+ }
+ ring_item = now->siblings_link.prev;
+ container_free(container);
+ }
+ if (now == item) {
+ return;
+ }
+
+ if ((ring_item = ring_next(&container->items, ring_item))) {
+ now = SPICE_CONTAINEROF(ring_item, TreeItem, siblings_link);
+ } else {
+ now = (TreeItem *)container;
+ }
+ }
+}
+
+static void current_remove_all(DisplayChannel *display, int surface_id)
+{
+ Ring *ring = &display->surfaces[surface_id].current;
+ RingItem *ring_item;
+
+ while ((ring_item = ring_get_head(ring))) {
+ TreeItem *now = SPICE_CONTAINEROF(ring_item, TreeItem, siblings_link);
+ current_remove(display, now);
+ }
+}
+
static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *other)
{
DrawItem *other_draw_item;
diff --git a/server/display-channel.h b/server/display-channel.h
index b909202..b3ebc2e 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -445,9 +445,6 @@ static inline void draw_depend_on_me(DisplayChannel *display, uint32_t surface_i
}
}
-void current_remove_drawable(DisplayChannel *display, Drawable *item);
void red_pipes_remove_drawable(Drawable *drawable);
-void current_remove(DisplayChannel *display, TreeItem *item);
-void current_remove_all(DisplayChannel *display, int surface_id);
#endif /* DISPLAY_CHANNEL_H_ */
diff --git a/server/red_worker.c b/server/red_worker.c
index 9747cb0..c0e4a5f 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -249,86 +249,6 @@ void red_drawable_unref(RedWorker *worker, RedDrawable *red_drawable,
free(red_drawable);
}
-static void display_stream_trace_add_drawable(DisplayChannel *display, Drawable *item)
-{
- ItemTrace *trace;
-
- if (item->stream || !item->streamable) {
- return;
- }
-
- trace = &display->items_trace[display->next_item_trace++ & ITEMS_TRACE_MASK];
- trace->time = item->creation_time;
- trace->frames_count = item->frames_count;
- trace->gradual_frames_count = item->gradual_frames_count;
- trace->last_gradual_frame = item->last_gradual_frame;
- SpiceRect* src_area = &item->red_drawable->u.copy.src_area;
- trace->width = src_area->right - src_area->left;
- trace->height = src_area->bottom - src_area->top;
- trace->dest_area = item->red_drawable->bbox;
-}
-
-void current_remove_drawable(DisplayChannel *display, Drawable *item)
-{
- /* todo: move all to unref? */
- display_stream_trace_add_drawable(display, item);
- draw_item_remove_shadow(&item->tree_item);
- ring_remove(&item->tree_item.base.siblings_link);
- ring_remove(&item->list_link);
- ring_remove(&item->surface_list_link);
- display_channel_drawable_unref(display, item);
- display->current_size--;
-}
-
-void current_remove(DisplayChannel *display, TreeItem *item)
-{
- TreeItem *now = item;
-
- /* depth-first tree traversal, TODO: do a to tree_foreach()? */
- for (;;) {
- Container *container = now->container;
- RingItem *ring_item;
-
- if (now->type == TREE_ITEM_TYPE_DRAWABLE) {
- Drawable *drawable = SPICE_CONTAINEROF(now, Drawable, tree_item);
- ring_item = now->siblings_link.prev;
- red_pipes_remove_drawable(drawable);
- current_remove_drawable(display, drawable);
- } else {
- Container *container = (Container *)now;
-
- spice_assert(now->type == TREE_ITEM_TYPE_CONTAINER);
-
- if ((ring_item = ring_get_head(&container->items))) {
- now = SPICE_CONTAINEROF(ring_item, TreeItem, siblings_link);
- continue;
- }
- ring_item = now->siblings_link.prev;
- container_free(container);
- }
- if (now == item) {
- return;
- }
-
- if ((ring_item = ring_next(&container->items, ring_item))) {
- now = SPICE_CONTAINEROF(ring_item, TreeItem, siblings_link);
- } else {
- now = (TreeItem *)container;
- }
- }
-}
-
-void current_remove_all(DisplayChannel *display, int surface_id)
-{
- Ring *ring = &display->surfaces[surface_id].current;
- RingItem *ring_item;
-
- while ((ring_item = ring_get_head(ring))) {
- TreeItem *now = SPICE_CONTAINEROF(ring_item, TreeItem, siblings_link);
- current_remove(display, now);
- }
-}
-
static void red_get_area(DisplayChannel *display, int surface_id, const SpiceRect *area,
uint8_t *dest, int dest_stride, int update)
{
diff --git a/server/stream.c b/server/stream.c
index e8b8f9b..3bd91b6 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -899,3 +899,22 @@ void stream_timeout(DisplayChannel *display)
}
}
}
+
+void stream_trace_add_drawable(DisplayChannel *display, Drawable *item)
+{
+ ItemTrace *trace;
+
+ if (item->stream || !item->streamable) {
+ return;
+ }
+
+ trace = &display->items_trace[display->next_item_trace++ & ITEMS_TRACE_MASK];
+ trace->time = item->creation_time;
+ trace->frames_count = item->frames_count;
+ trace->gradual_frames_count = item->gradual_frames_count;
+ trace->last_gradual_frame = item->last_gradual_frame;
+ SpiceRect* src_area = &item->red_drawable->u.copy.src_area;
+ trace->width = src_area->right - src_area->left;
+ trace->height = src_area->bottom - src_area->top;
+ trace->dest_area = item->red_drawable->bbox;
+}
diff --git a/server/stream.h b/server/stream.h
index a9abc82..c436c2e 100644
--- a/server/stream.h
+++ b/server/stream.h
@@ -150,6 +150,8 @@ void stream_maintenance (DisplayChan
Drawable *prev);
void stream_timeout (DisplayChannel *display);
void stream_detach_and_stop (DisplayChannel *display);
+void stream_trace_add_drawable (DisplayChannel *display,
+ Drawable *item);
void stream_agent_unref (DisplayChannel *display,
StreamAgent *agent);
More information about the Spice-commits
mailing list