summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2013-08-12 15:20:38 +0300
committerAlon Levy <alevy@redhat.com>2013-08-14 12:08:04 +0300
commit7241cc9544de818eb07de7dd99d72f8451ed8038 (patch)
tree0d547db471127bc59a3a49d31075891973c18415
parent9b8ff0428468b7f081fe6f2b27774af2d0b4dadf (diff)
downloadspice-7241cc9544de818eb07de7dd99d72f8451ed8038.tar.gz
spice-7241cc9544de818eb07de7dd99d72f8451ed8038.tar.xz
spice-7241cc9544de818eb07de7dd99d72f8451ed8038.zip
server: move surface_format_to_image_type to spice_bitmap_utils
-rw-r--r--server/red_worker.c28
-rw-r--r--server/spice_bitmap_utils.c17
-rw-r--r--server/spice_bitmap_utils.h2
3 files changed, 23 insertions, 24 deletions
diff --git a/server/red_worker.c b/server/red_worker.c
index 175cf92e..1caaa515 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
@@ -3931,23 +3928,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)
{
@@ -4008,7 +3988,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;
@@ -5309,7 +5289,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;
@@ -9767,7 +9747,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 90446222..ce0a5ed0 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 ae4939f1..69860e5a 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