This series of patches attempt to use direct pointers to surfaces. The current code rely on the fact that surface pointer for a specific surface_id does not change. For this reason for instance surfaces are allocated in a static array. On the other way surfaces have reference counting so why don't use counters for life management instead of having complicated function that attempt to do all possible checks in order to make sure they are not used? Mainly instead of using surface_id and every time having to ask DisplayChannel to convert this to a RedSurface pass and store directly the pointers. On deletion you could simply remove the reference to the main list (which can became something like RedSurface *surfaces[MAX_SURFACES]) and you can create a new RedSurface. Also as usually multiple surfaces are disabled this will reduce memory usage. Frediano Ziglio (14): Use direct pointers for surface and surface dependencies from Drawable Pass surface directly for surface_read_bits Pass surface directly to current_remove_all Pass surface directly to display_channel_surface_unref Pass surface directly in is_primary_surface Pass surface directly calling draw_depend_on_me and display_channel_destroy_surface Pass surface directly calling dcc_clear_surface_drawables_from_pipe Pass surface directly calling display_channel_current_flush New function to pass surface directly to display_channel_draw Pass surface directly to dcc_create_surface Pass surface directly to dcc_push_surface_image Use directly surface instead of id Change validate_surface to return surface pointer Reuse more validate_surface server/dcc-send.c | 29 ++++--- server/dcc.c | 56 ++++++------- server/dcc.h | 9 +- server/display-channel.c | 214 +++++++++++++++++++++++++---------------------- server/display-channel.h | 28 +++++-- server/red-worker.c | 2 +- 6 files changed, 178 insertions(+), 160 deletions(-) -- 2.7.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel