[Spice-devel] [PATCH 07/10] server: move surface_format_to_image_type to spice_bitmap_utils

Alon Levy alevy at redhat.com
Mon Aug 12 05:49:16 PDT 2013


---
 server/red_worker.c         | 24 ++----------------------
 server/spice_bitmap_utils.c | 17 +++++++++++++++++
 server/spice_bitmap_utils.h |  2 ++
 3 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index 334a709..0aa00be 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)
 {
@@ -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 1fbd7de..347a693 100644
--- a/server/spice_bitmap_utils.c
+++ b/server/spice_bitmap_utils.c
@@ -5,6 +5,23 @@
 
 #include "spice_bitmap_utils.h"
 
+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;
+}
+
 #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..162a709 100644
--- a/server/spice_bitmap_utils.h
+++ b/server/spice_bitmap_utils.h
@@ -3,4 +3,6 @@
 
 void dump_bitmap(SpiceBitmap *bitmap);
 
+int surface_format_to_image_type(uint32_t surface_format);
+
 #endif
-- 
1.8.3.1



More information about the Spice-devel mailing list