summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2010-11-13 16:54:12 +0200
committerAlon Levy <alevy@redhat.com>2011-01-19 19:51:03 +0200
commitaeab63c0976e2319511c662af32eac1a123f0107 (patch)
tree680d5a7b14a08b84619150d651205203a7c36b26
parent106cfc4bdef5a2e1f6fb063402681205c81034df (diff)
server/red_worker: use red_channel_pipe_item_initred_channel_refactor
replaces in file red_pipe_item_init.
-rw-r--r--server/red_client_cache.h2
-rw-r--r--server/red_worker.c66
2 files changed, 38 insertions, 30 deletions
diff --git a/server/red_client_cache.h b/server/red_client_cache.h
index 28f99550..a79944ab 100644
--- a/server/red_client_cache.h
+++ b/server/red_client_cache.h
@@ -73,7 +73,7 @@ static void FUNC_NAME(remove)(CHANNEL *channel, CacheItem *item)
channel->VAR_NAME(items)--;
channel->VAR_NAME(available) += item->size;
- red_pipe_item_init(&item->u.pipe_data, PIPE_ITEM_TYPE_INVAL_ONE);
+ red_channel_pipe_item_init(&channel->common.base, &item->u.pipe_data, PIPE_ITEM_TYPE_INVAL_ONE);
red_pipe_add_tail(&channel->common.base, &item->u.pipe_data); // for now
}
diff --git a/server/red_worker.c b/server/red_worker.c
index 448222b0..2a0c4442 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1123,12 +1123,6 @@ static void show_draw_item(RedWorker *worker, DrawItem *draw_item, const char *p
draw_item->base.rgn.extents.y2);
}
-static inline void red_pipe_item_init(PipeItem *item, int type)
-{
- ring_item_init(&item->link);
- item->type = type;
-}
-
static inline int pipe_item_is_linked(PipeItem *item)
{
return ring_item_is_linked(&item->link);
@@ -1149,7 +1143,7 @@ static inline void red_pipe_add_tail(RedChannel *channel, PipeItem *item)
static void red_pipe_add_verb(RedChannel* channel, uint16_t verb)
{
VerbItem *item = spice_new(VerbItem, 1);
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_VERB);
+ red_channel_pipe_item_init(channel, &item->base, PIPE_ITEM_TYPE_VERB);
item->verb = verb;
red_channel_pipe_add(channel, &item->base);
}
@@ -1339,7 +1333,8 @@ static void drawables_init(RedWorker *worker)
static void red_reset_stream_trace(RedWorker *worker);
-static SurfaceDestroyItem *get_surface_destroy_item(uint32_t surface_id)
+static SurfaceDestroyItem *get_surface_destroy_item(RedChannel *channel,
+ uint32_t surface_id)
{
SurfaceDestroyItem *destroy;
@@ -1348,7 +1343,8 @@ static SurfaceDestroyItem *get_surface_destroy_item(uint32_t surface_id)
destroy->surface_destroy.surface_id = surface_id;
- red_pipe_item_init(&destroy->pipe_item, PIPE_ITEM_TYPE_DESTROY_SURFACE);
+ red_channel_pipe_item_init(channel,
+ &destroy->pipe_item, PIPE_ITEM_TYPE_DESTROY_SURFACE);
return destroy;
}
@@ -1356,16 +1352,15 @@ static SurfaceDestroyItem *get_surface_destroy_item(uint32_t surface_id)
static inline void red_destroy_surface_item(RedWorker *worker, uint32_t surface_id)
{
SurfaceDestroyItem *destroy;
+ RedChannel *channel;
if (!worker->display_channel) {
return;
}
-
worker->display_channel->surface_client_created[surface_id] = FALSE;
-
- destroy = get_surface_destroy_item(surface_id);
-
- red_channel_pipe_add(&worker->display_channel->common.base, &destroy->pipe_item);
+ channel = &worker->display_channel->common.base;
+ destroy = get_surface_destroy_item(channel, surface_id);
+ red_channel_pipe_add(channel, &destroy->pipe_item);
}
static inline void red_destroy_surface(RedWorker *worker, uint32_t surface_id)
@@ -2129,7 +2124,8 @@ static inline void red_detach_stream(RedWorker *worker, Stream *stream)
static StreamClipItem *__new_stream_clip(DisplayChannel* channel, StreamAgent *agent)
{
StreamClipItem *item = spice_new(StreamClipItem, 1);
- red_pipe_item_init((PipeItem *)item, PIPE_ITEM_TYPE_STREAM_CLIP);
+ red_channel_pipe_item_init(&channel->common.base,
+ (PipeItem *)item, PIPE_ITEM_TYPE_STREAM_CLIP);
item->stream_agent = agent;
agent->stream->refs++;
@@ -2239,7 +2235,8 @@ static inline void red_detach_stream_gracefully(RedWorker *worker, Stream *strea
upgrade_item = spice_new(UpgradeItem, 1);
upgrade_item->refs = 1;
- red_pipe_item_init(&upgrade_item->base, PIPE_ITEM_TYPE_UPGRADE);
+ red_channel_pipe_item_init(&channel->common.base,
+ &upgrade_item->base, PIPE_ITEM_TYPE_UPGRADE);
upgrade_item->drawable = stream->current;
upgrade_item->drawable->refs++;
n_rects = pixman_region32_n_rects(&upgrade_item->drawable->tree_item.base.rgn);
@@ -2460,8 +2457,10 @@ static void red_display_init_streams(DisplayChannel *display)
StreamAgent *agent = &display->stream_agents[i];
agent->stream = &display->common.worker->streams_buf[i];
region_init(&agent->vis_region);
- red_pipe_item_init(&agent->create_item, PIPE_ITEM_TYPE_STREAM_CREATE);
- red_pipe_item_init(&agent->destroy_item, PIPE_ITEM_TYPE_STREAM_DESTROY);
+ red_channel_pipe_item_init(&display->common.base,
+ &agent->create_item, PIPE_ITEM_TYPE_STREAM_CREATE);
+ red_channel_pipe_item_init(&display->common.base,
+ &agent->destroy_item, PIPE_ITEM_TYPE_STREAM_DESTROY);
}
}
@@ -3239,7 +3238,8 @@ static Drawable *get_drawable(RedWorker *worker, uint8_t effect, RedDrawable *re
drawable->tree_item.base.type = TREE_ITEM_TYPE_DRAWABLE;
region_init(&drawable->tree_item.base.rgn);
drawable->tree_item.effect = effect;
- red_pipe_item_init(&drawable->pipe_item, PIPE_ITEM_TYPE_DRAW);
+ red_channel_pipe_item_init(&worker->display_channel->common.base,
+ &drawable->pipe_item, PIPE_ITEM_TYPE_DRAW);
drawable->red_drawable = red_drawable;
drawable->group_id = group_id;
@@ -4123,7 +4123,8 @@ static CursorItem *get_cursor_item(RedWorker *worker, RedCursorCmd *cmd, uint32_
PANIC_ON(!(cursor_item = alloc_cursor_item(worker)));
cursor_item->refs = 1;
- red_pipe_item_init(&cursor_item->pipe_data, PIPE_ITEM_TYPE_CURSOR);
+ red_channel_pipe_item_init(&worker->cursor_channel->common.base,
+ &cursor_item->pipe_data, PIPE_ITEM_TYPE_CURSOR);
cursor_item->type = CURSOR_TYPE_INVALID;
cursor_item->group_id = group_id;
cursor_item->red_cursor = cmd;
@@ -4351,7 +4352,8 @@ static ImageItem *red_add_surface_area_image(RedWorker *worker, int surface_id,
item = (ImageItem *)spice_malloc_n_m(height, stride, sizeof(ImageItem));
- red_pipe_item_init(&item->link, PIPE_ITEM_TYPE_IMAGE);
+ red_channel_pipe_item_init(&worker->display_channel->common.base,
+ &item->link, PIPE_ITEM_TYPE_IMAGE);
item->refs = 1;
item->surface_id = surface_id;
@@ -8401,8 +8403,10 @@ static inline void *create_canvas_for_surface(RedWorker *worker, RedSurface *sur
};
}
-static SurfaceCreateItem *get_surface_create_item(uint32_t surface_id, uint32_t width,
- uint32_t height, uint32_t format, uint32_t flags)
+static SurfaceCreateItem *get_surface_create_item(
+ RedChannel* channel,
+ uint32_t surface_id, uint32_t width,
+ uint32_t height, uint32_t format, uint32_t flags)
{
SurfaceCreateItem *create;
@@ -8415,8 +8419,8 @@ static SurfaceCreateItem *get_surface_create_item(uint32_t surface_id, uint32_t
create->surface_create.flags = flags;
create->surface_create.format = format;
- red_pipe_item_init(&create->pipe_item, PIPE_ITEM_TYPE_CREATE_SURFACE);
-
+ red_channel_pipe_item_init(channel,
+ &create->pipe_item, PIPE_ITEM_TYPE_CREATE_SURFACE);
return create;
}
@@ -8431,7 +8435,8 @@ static inline void __red_create_surface_item(RedWorker *worker, int surface_id,
surface = &worker->surfaces[surface_id];
- create = get_surface_create_item(surface_id, surface->context.width, surface->context.height,
+ create = get_surface_create_item(&worker->display_channel->common.base,
+ surface_id, surface->context.width, surface->context.height,
surface->context.format, flags);
worker->display_channel->surface_client_created[surface_id] = TRUE;
@@ -9325,13 +9330,15 @@ typedef struct __attribute__ ((__packed__)) CursorData {
SpiceCursor _cursor;
} CursorData;
-static LocalCursor *_new_local_cursor(SpiceCursorHeader *header, int data_size, SpicePoint16 position)
+static LocalCursor *_new_local_cursor(RedChannel *channel,
+ SpiceCursorHeader *header, int data_size, SpicePoint16 position)
{
LocalCursor *local;
local = (LocalCursor *)spice_malloc0(sizeof(LocalCursor) + data_size);
- red_pipe_item_init(&local->base.pipe_data, PIPE_ITEM_TYPE_LOCAL_CURSOR);
+ red_channel_pipe_item_init(channel, &local->base.pipe_data,
+ PIPE_ITEM_TYPE_LOCAL_CURSOR);
local->base.refs = 1;
local->base.type = CURSOR_TYPE_LOCAL;
@@ -9362,7 +9369,8 @@ static void red_cursor_flush(RedWorker *worker)
ASSERT(cursor_cmd->type == QXL_CURSOR_SET);
cursor = &cursor_cmd->u.set.shape;
- local = _new_local_cursor(&cursor->header, cursor->data_size,
+ local = _new_local_cursor(&worker->cursor_channel->common.base,
+ &cursor->header, cursor->data_size,
worker->cursor_position);
ASSERT(local);
memcpy(local->red_cursor.data, cursor->data, local->data_size);