--- server/red_worker.c | 28 ++++------------------------ server/spice_bitmap_utils.c | 17 +++++++++++++++++ server/spice_bitmap_utils.h | 2 ++ 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/server/red_worker.c b/server/red_worker.c index 334a709..f1b7db6 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -84,6 +84,7 @@ #include "main_dispatcher.h" #include "spice_server_utils.h" #include "red_time.h" +#include "spice_bitmap_utils.h" //#define COMPRESS_STAT //#define DUMP_BITMAP @@ -95,10 +96,6 @@ //#define ACYCLIC_SURFACE_DEBUG //#define DEBUG_CURSORS -#ifdef DUMP_BITMAP -#include "spice_bitmap_utils.h" -#endif - //#define UPDATE_AREA_BY_TREE #define CMD_RING_POLL_TIMEOUT 10 //milli @@ -3941,23 +3938,6 @@ static void red_get_area(RedWorker *worker, int surface_id, const SpiceRect *are canvas->ops->read_bits(canvas, dest, dest_stride, area); } -static int surface_format_to_image_type(uint32_t surface_format) -{ - switch (surface_format) { - case SPICE_SURFACE_FMT_16_555: - return SPICE_BITMAP_FMT_16BIT; - case SPICE_SURFACE_FMT_32_xRGB: - return SPICE_BITMAP_FMT_32BIT; - case SPICE_SURFACE_FMT_32_ARGB: - return SPICE_BITMAP_FMT_RGBA; - case SPICE_SURFACE_FMT_8_A: - return SPICE_BITMAP_FMT_8BIT_A; - default: - spice_critical("Unsupported surface format"); - } - return 0; -} - static int rgb32_data_has_alpha(int width, int height, size_t stride, uint8_t *data, int *all_set_out) { @@ -4018,7 +3998,7 @@ static inline int red_handle_self_bitmap(RedWorker *worker, Drawable *drawable) QXL_SET_IMAGE_ID(image, QXL_IMAGE_GROUP_RED, ++worker->bits_unique); image->u.bitmap.flags = surface->context.top_down ? SPICE_BITMAP_FLAGS_TOP_DOWN : 0; - image->u.bitmap.format = surface_format_to_image_type(surface->context.format); + image->u.bitmap.format = spice_bitmap_from_surface_type(surface->context.format); image->u.bitmap.stride = dest_stride; image->descriptor.width = image->u.bitmap.x = width; image->descriptor.height = image->u.bitmap.y = height; @@ -5319,7 +5299,7 @@ static ImageItem *red_add_surface_area_image(DisplayChannelClient *dcc, int surf item->refs = 1; item->surface_id = surface_id; item->image_format = - surface_format_to_image_type(surface->context.format); + spice_bitmap_from_surface_type(surface->context.format); item->image_flags = 0; item->pos.x = area->left; item->pos.y = area->top; @@ -9777,7 +9757,7 @@ static inline void flush_cursor_commands(RedWorker *worker) } } -// TODO: on timeout, don't disconnect all channeld immeduiatly - try to disconnect the slowest ones +// TODO: on timeout, don't disconnect all channels immediatly - try to disconnect the slowest ones // first and maybe turn timeouts to several timeouts in order to disconnect channels gradually. // Should use disconnect or shutdown? static inline void flush_all_qxl_commands(RedWorker *worker) diff --git a/server/spice_bitmap_utils.c b/server/spice_bitmap_utils.c index 9044622..ce0a5ed 100644 --- a/server/spice_bitmap_utils.c +++ b/server/spice_bitmap_utils.c @@ -5,6 +5,23 @@ #include "spice_bitmap_utils.h" +int spice_bitmap_from_surface_type(uint32_t surface_format) +{ + switch (surface_format) { + case SPICE_SURFACE_FMT_16_555: + return SPICE_BITMAP_FMT_16BIT; + case SPICE_SURFACE_FMT_32_xRGB: + return SPICE_BITMAP_FMT_32BIT; + case SPICE_SURFACE_FMT_32_ARGB: + return SPICE_BITMAP_FMT_RGBA; + case SPICE_SURFACE_FMT_8_A: + return SPICE_BITMAP_FMT_8BIT_A; + default: + spice_critical("Unsupported surface format"); + } + return 0; +} + #define RAM_PATH "/tmp/tmpfs" static void dump_palette(FILE *f, SpicePalette* plt) diff --git a/server/spice_bitmap_utils.h b/server/spice_bitmap_utils.h index ae4939f..69860e5 100644 --- a/server/spice_bitmap_utils.h +++ b/server/spice_bitmap_utils.h @@ -3,4 +3,6 @@ void dump_bitmap(SpiceBitmap *bitmap); +int spice_bitmap_from_surface_type(uint32_t surface_format); + #endif -- 1.8.3.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel