From: Marc-André Lureau <marcandre.lureau@xxxxxxxxx> --- server/display-channel.h | 3 +++ server/red_worker.c | 29 +++++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/server/display-channel.h b/server/display-channel.h index 53c5ddc..1871cb0 100644 --- a/server/display-channel.h +++ b/server/display-channel.h @@ -282,6 +282,9 @@ struct DisplayChannel { uint32_t renderers[RED_RENDERER_LAST]; uint32_t renderer; + Ring current_list; // of TreeItem + uint32_t current_size; + int enable_jpeg; int jpeg_quality; int enable_zlib_glz_wrap; diff --git a/server/red_worker.c b/server/red_worker.c index 0f405f3..ffbae31 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -355,8 +355,6 @@ typedef struct RedWorker { uint32_t n_surfaces; SpiceImageSurfaces image_surfaces; - Ring current_list; - uint32_t current_size; uint32_t drawable_count; uint32_t red_drawable_count; uint32_t glz_drawable_count; @@ -1170,13 +1168,15 @@ static void red_flush_source_surfaces(RedWorker *worker, Drawable *drawable) static inline void current_remove_drawable(RedWorker *worker, Drawable *item) { - display_stream_trace_add_drawable(worker->display_channel, item); + DisplayChannel *display = worker->display_channel; + + display_stream_trace_add_drawable(display, 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); red_worker_drawable_unref(worker, item); - worker->current_size--; + display->current_size--; } static void remove_drawable(RedWorker *worker, Drawable *drawable) @@ -1496,14 +1496,15 @@ static inline int is_opaque_item(TreeItem *item) static inline void __current_add_drawable(RedWorker *worker, Drawable *drawable, RingItem *pos) { + DisplayChannel *display = worker->display_channel; RedSurface *surface; uint32_t surface_id = drawable->surface_id; surface = &worker->surfaces[surface_id]; ring_add_after(&drawable->tree_item.base.siblings_link, pos); - ring_add(&worker->current_list, &drawable->list_link); + ring_add(&display->current_list, &drawable->list_link); ring_add(&surface->current_list, &drawable->surface_list_link); - worker->current_size++; + display->current_size++; drawable->refs++; } @@ -2853,7 +2854,8 @@ static inline int red_handle_self_bitmap(RedWorker *worker, Drawable *drawable) static bool free_one_drawable(RedWorker *worker, int force_glz_free) { - RingItem *ring_item = ring_get_tail(&worker->current_list); + DisplayChannel *display = worker->display_channel; + RingItem *ring_item = ring_get_tail(&display->current_list); Drawable *drawable; Container *container; @@ -3304,6 +3306,7 @@ static void validate_area(RedWorker *worker, const SpiceRect *area, uint32_t sur static void red_update_area_till(RedWorker *worker, const SpiceRect *area, int surface_id, Drawable *last) { + DisplayChannel *display = worker->display_channel; RedSurface *surface; Drawable *surface_last = NULL; Ring *ring; @@ -3318,7 +3321,7 @@ static void red_update_area_till(RedWorker *worker, const SpiceRect *area, int s if (surface_id != last->surface_id) { // find the nearest older drawable from the appropriate surface - ring = &worker->current_list; + ring = &display->current_list; ring_item = &last->list_link; while ((ring_item = ring_next(ring, ring_item))) { now = SPICE_CONTAINEROF(ring_item, Drawable, list_link); @@ -3607,6 +3610,7 @@ static int red_process_commands(RedWorker *worker, uint32_t max_pipe_size, int * static void red_free_some(RedWorker *worker) { + DisplayChannel *display = worker->display_channel; int n = 0; DisplayChannelClient *dcc; RingItem *item, *next; @@ -3624,7 +3628,7 @@ static void red_free_some(RedWorker *worker) } } - while (!ring_is_empty(&worker->current_list) && n++ < RED_RELEASE_BUNCH_SIZE) { + while (!ring_is_empty(&display->current_list) && n++ < RED_RELEASE_BUNCH_SIZE) { free_one_drawable(worker, TRUE); } @@ -8816,6 +8820,7 @@ static void display_channel_create(RedWorker *worker, int migrate) display_channel->renderer = RED_RENDERER_INVALID; init_streams(display_channel); image_cache_init(&display_channel->image_cache); + ring_init(&display_channel->current_list); } static void guest_set_client_capabilities(RedWorker *worker) @@ -9393,6 +9398,7 @@ void handle_dev_wakeup(void *opaque, void *payload) void handle_dev_oom(void *opaque, void *payload) { RedWorker *worker = opaque; + DisplayChannel *display = worker->display_channel; RedChannel *display_red_channel = &worker->display_channel->common.base; int ring_is_empty; @@ -9403,7 +9409,7 @@ void handle_dev_oom(void *opaque, void *payload) worker->drawable_count, worker->red_drawable_count, worker->glz_drawable_count, - worker->current_size, + display->current_size, worker->display_channel ? red_channel_sum_pipes_size(display_red_channel) : 0); while (red_process_commands(worker, MAX_PIPE_SIZE, &ring_is_empty)) { @@ -9417,7 +9423,7 @@ void handle_dev_oom(void *opaque, void *payload) worker->drawable_count, worker->red_drawable_count, worker->glz_drawable_count, - worker->current_size, + display->current_size, worker->display_channel ? red_channel_sum_pipes_size(display_red_channel) : 0); red_dispatcher_clear_pending(worker->red_dispatcher, RED_DISPATCHER_PENDING_OOM); @@ -9946,7 +9952,6 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher) worker->jpeg_state = jpeg_state; worker->zlib_glz_state = zlib_glz_state; worker->driver_cap_monitors_config = 0; - ring_init(&worker->current_list); image_surface_init(worker); drawables_init(worker); stat_init(&worker->add_stat, add_stat_name); -- 2.4.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel