[Spice-devel] [PATCH 00/30] Convert cairo canvas to use pixman

Alexander Larsson alexl at redhat.com
Fri Feb 19 07:50:23 PST 2010


On Thu, 2010-02-18 at 21:58 +0100, Alexander Larsson wrote:
> This series converts the software based canvas "cairo_canvas" to use
> pixman for rendering instead of cairo. It uses the upstream pixman
> (the latest version, 0.7.16 is needed) thus dropping the dependencies
> on qcairo and qpixman (and additionally cairo is not linked into the
> server at all).
> 
> After the whole series is applied its possible to build spice with
> upstream cairo and pixman 0.7.16. However, if you want to compile and
> run intermediate steps (for instance when bisecting) you need to do
> some extra work:

Seems i missed some qcairo parts:

commit 39be5a8b13ae793aacf641ef605a4cef8eabf373
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Feb 4 18:46:22 2010 +0100

    Use standard int types and <spice/types.h>

diff --git a/client/common.h b/client/common.h
index 69253db..f9b1956 100644
--- a/client/common.h
+++ b/client/common.h
@@ -22,7 +22,7 @@
 #include <errno.h>
 #endif
 
-#include <stdint.h>
+#include <spice/types.h>
 #include <stdio.h>
 #include <string>
 #include <vector>
@@ -35,7 +35,6 @@
 #ifdef WIN32
 #include <winsock2.h>
 #include <windows.h>
-#include <basetsd.h>
 
 #pragma warning(disable:4355)
 #pragma warning(disable:4996)
diff --git a/client/glz_decoder_config.h b/client/glz_decoder_config.h
index 44ef165..3e820a5 100644
--- a/client/glz_decoder_config.h
+++ b/client/glz_decoder_config.h
@@ -25,23 +25,7 @@
 
 #include <stdio.h>
 
-#ifdef __GNUC__
-
-#include <stdint.h>
-
-
-#else
-
-#include <stddef.h>
-#include <basetsd.h>
-
-
-typedef UINT64 uint64_t;
-typedef UINT32 uint32_t;
-typedef UINT16 uint16_t;
-typedef UINT8 uint8_t;
-
-#endif  //__GNUC__
+#include <spice/types.h>
 
 #define MIN(x, y) (((x) <= (y)) ? (x) : (y))
 #define MAX(x, y) (((x) >= (y)) ? (x) : (y))
diff --git a/common/cairo_canvas.c b/common/cairo_canvas.c
index 1a4993d..f198878 100644
--- a/common/cairo_canvas.c
+++ b/common/cairo_canvas.c
@@ -146,7 +146,7 @@ static void canvas_set_line_attr_no_dash(CairoCanvas
*canvas, SpiceLineAttr *att
     cairo_set_dash(cairo, NULL, 0, 0);
 }
 
-static void canvas_set_dash(CairoCanvas *canvas, UINT8 nseg,
SPICE_ADDRESS addr, int start_is_gap)
+static void canvas_set_dash(CairoCanvas *canvas, uint8_t nseg,
SPICE_ADDRESS addr, int start_is_gap)
 {
     SPICE_FIXED28_4* style = (SPICE_FIXED28_4*)SPICE_GET_ADDRESS(addr);
     double offset = 0;
@@ -1136,8 +1136,8 @@ void canvas_draw_rop3(CairoCanvas *canvas,
SpiceRect *bbox, SpiceClip *clip, Spi
     x_pos = bbox->left;
     y_pos = bbox->top;
     cairo_user_to_device(cairo, &x_pos, &y_pos);
-    pos.x = (INT32)x_pos;
-    pos.y = (INT32)y_pos;
+    pos.x = (int32_t)x_pos;
+    pos.y = (int32_t)y_pos;
     d = canvas_surface_from_self(canvas, &pos, width, heigth);
     s = canvas_get_image(&canvas->base, rop3->src_bitmap);
 
diff --git a/common/canvas_base.c b/common/canvas_base.c
index fe9ef9b..de467c7 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -199,10 +199,10 @@ typedef struct CanvasBase {
 #endif
 
 typedef struct ATTR_PACKED DataChunk {
-    UINT32 size;
+    uint32_t size;
     SPICE_ADDRESS prev;
     SPICE_ADDRESS next;
-    UINT8 data[0];
+    uint8_t data[0];
 } DataChunk;
 
 #undef ATTR_PACKED
@@ -217,8 +217,8 @@ typedef struct ATTR_PACKED DataChunk {
 static inline void canvas_localize_palette(CanvasBase *canvas,
SpicePalette *palette)
 {
     if (canvas->color_shift == 5) {
-        UINT32 *now = palette->ents;
-        UINT32 *end = now + palette->num_ents;
+        uint32_t *now = palette->ents;
+        uint32_t *end = now + palette->num_ents;
         for (; now < end; now++) {
             *now = canvas_16bpp_to_32bpp(*now);
         }
diff --git a/common/canvas_utils.h b/common/canvas_utils.h
index 8ccc304..10f2d64 100644
--- a/common/canvas_utils.h
+++ b/common/canvas_utils.h
@@ -18,13 +18,7 @@
 #ifndef _H_CANVAS_UTILS
 #define _H_CANVAS_UTILS
 
-#ifdef __GNUC__
-#include <stdint.h>
-#else
-#include <stddef.h>
-#include <basetsd.h>
-typedef UINT8 uint8_t;
-#endif  //__GNUC__
+#include <spice/types.h>
 
 #include "cairo.h"
 #include "lz.h"
diff --git a/common/gdi_canvas.c b/common/gdi_canvas.c
index b60bef2..df5ae64 100644
--- a/common/gdi_canvas.c
+++ b/common/gdi_canvas.c
@@ -1477,7 +1477,7 @@ static int get_cap(int end_style)
     }
 }
 
-static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, UINT8 nseg,
SPICE_ADDRESS addr, int start_is_gap)
+static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, uint8_t nseg,
SPICE_ADDRESS addr, int start_is_gap)
 {
     SPICE_FIXED28_4* style = (SPICE_FIXED28_4*)SPICE_GET_ADDRESS(addr);
     double offset = 0;
diff --git a/common/gl_canvas.c b/common/gl_canvas.c
index eaf1e91..fd1a2c9 100644
--- a/common/gl_canvas.c
+++ b/common/gl_canvas.c
@@ -282,7 +282,7 @@ static void set_brush(GLCanvas *canvas, SpiceBrush
*brush)
     }
 }
 
-static void set_op(GLCanvas *canvas, UINT16 rop_decriptor)
+static void set_op(GLCanvas *canvas, uint16_t rop_decriptor)
 {
     GLCOp op;
 
diff --git a/common/lookup3.h b/common/lookup3.h
index a2fbdea..00bc4eb 100644
--- a/common/lookup3.h
+++ b/common/lookup3.h
@@ -18,25 +18,7 @@
 #ifndef __LOOKUP3_H
 #define __LOOKUP3_H
 
-#ifdef __GNUC__
-
-#include <stdint.h>
-
-#else
-
-#ifdef QXLDD
-#include <windef.h>
-#include "os_dep.h"
-#else
-#include <stddef.h>
-#include <basetsd.h>
-#endif
-
-typedef UINT32 uint32_t;
-typedef UINT16 uint16_t;
-typedef UINT8 uint8_t;
-
-#endif
+#include <spice/types.h>
 
 uint32_t hashlittle(const void *key, size_t length, uint32_t initval);
 
diff --git a/common/lz_config.h b/common/lz_config.h
index 1020e7b..748d79d 100644
--- a/common/lz_config.h
+++ b/common/lz_config.h
@@ -20,6 +20,8 @@
 #ifndef __LZ_CONFIG_H
 #define __LZ_CONFIG_H
 
+#include <spice/types.h>
+
 #ifndef FALSE
 #define FALSE 0
 #endif
@@ -31,7 +33,6 @@
 
 #ifdef __GNUC__
 
-#include <stdint.h>
 #include <string.h>
 
 #define INLINE inline
@@ -45,15 +46,10 @@
 
 #else
 #include <stddef.h>
-#include <basetsd.h>
 #include <string.h>
 
 #define INLINE inline
 #endif  // QXLDD
 
-typedef UINT32 uint32_t;
-typedef UINT16 uint16_t;
-typedef UINT8 uint8_t;
-
 #endif  //__GNUC__
 #endif  //__LZ_CONFIG_H
diff --git a/common/quic_config.h b/common/quic_config.h
index ab418b1..c9eb8fa 100644
--- a/common/quic_config.h
+++ b/common/quic_config.h
@@ -18,9 +18,10 @@
 #ifndef __QUIC_CONFIG_H
 #define __QUIC_CONFIG_H
 
+#include <spice/types.h>
+
 #ifdef __GNUC__
 
-#include <stdint.h>
 #include <string.h>
 
 #define INLINE inline
@@ -36,16 +37,12 @@
 #define MEMCLEAR(ptr, size) RtlZeroMemory(ptr, size)
 #else
 #include <stddef.h>
-#include <basetsd.h>
 #include <string.h>
 
 #define INLINE inline
 #define MEMCLEAR(ptr, size) memset(ptr, 0, size)
 #endif
 
-typedef UINT32 uint32_t;
-typedef UINT16 uint16_t;
-typedef UINT8 uint8_t;
 
 #endif
 
diff --git a/server/red_worker.c b/server/red_worker.c
index 483c5a3..2b50b9f 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1229,7 +1229,7 @@ static void cb_validate_virt_preload_group(void
*opaque, unsigned long virt,
                   ((RedWorker *)opaque)->preload_group_id);
 }
 
-char *draw_type_to_str(UINT8 type)
+char *draw_type_to_str(uint8_t type)
 {
     switch (type) {
     case QXL_DRAW_FILL:
@@ -3724,11 +3724,11 @@ static void localize_path(RedWorker *worker,
QXLPHYSICAL *in_path, uint32_t grou
 
     ASSERT(in_path && *in_path);
     path = (QXLPath *)get_virt(worker, *in_path, sizeof(QXLPath),
group_id);
-    data = malloc(sizeof(UINT32) + path->data_size);
+    data = malloc(sizeof(uint32_t) + path->data_size);
     ASSERT(data);
     *in_path = (QXLPHYSICAL)data;
-    *(UINT32 *)data = path->data_size;
-    data += sizeof(UINT32);
+    *(uint32_t *)data = path->data_size;
+    data += sizeof(uint32_t);
     chunk = &path->chunk;
     do {
         data_size = chunk->data_size;
@@ -3757,7 +3757,7 @@ static void localize_str(RedWorker *worker,
QXLPHYSICAL *in_str, uint32_t group_
     int memslot_id = get_memslot_id(worker, *in_str);
 
     ASSERT(in_str);
-    str = malloc(sizeof(UINT32) + qxl_str->data_size);
+    str = malloc(sizeof(uint32_t) + qxl_str->data_size);
     ASSERT(str);
     *in_str = (QXLPHYSICAL)str;
     str->length = qxl_str->length;
@@ -3801,11 +3801,11 @@ static void localize_clip(RedWorker *worker,
SpiceClip *clip, uint32_t group_id)
         clip_rects = (QXLClipRects *)get_virt(worker, clip->data,
sizeof(QXLClipRects), group_id);
         chunk = &clip_rects->chunk;
         ASSERT(clip->data);
-        data = malloc(sizeof(UINT32) + clip_rects->num_rects *
sizeof(SpiceRect));
+        data = malloc(sizeof(uint32_t) + clip_rects->num_rects *
sizeof(SpiceRect));
         ASSERT(data);
         clip->data = (QXLPHYSICAL)data;
-        *(UINT32 *)(data) = clip_rects->num_rects;
-        data += sizeof(UINT32);
+        *(uint32_t *)(data) = clip_rects->num_rects;
+        data += sizeof(uint32_t);
         do {
             data_size = chunk->data_size;
             validate_virt(worker, (unsigned long)chunk->data,
memslot_id, data_size, group_id);
@@ -3848,7 +3848,7 @@ static LocalImage *alloc_local_image(RedWorker
*worker)
     return &worker->local_images[worker->local_images_pos++];
 }
 
-static ImageCacheItem *image_cache_find(ImageCache *cache, UINT64 id)
+static ImageCacheItem *image_cache_find(ImageCache *cache, uint64_t id)
 {
     ImageCacheItem *item = cache->hash_table[id %
IMAGE_CACHE_HASH_SIZE];
 
@@ -3861,7 +3861,7 @@ static ImageCacheItem *image_cache_find(ImageCache
*cache, UINT64 id)
     return NULL;
 }
 
-static int image_cache_hit(ImageCache *cache, UINT64 id)
+static int image_cache_hit(ImageCache *cache, uint64_t id)
 {
     ImageCacheItem *item;
     if (!(item = image_cache_find(cache, id))) {
@@ -4744,7 +4744,7 @@ static void fill_path(DisplayChannel
*display_channel, QXLPHYSICAL *in_path, uin
     memslot_id  = get_memslot_id(worker, *in_path);
     QXLPath *path = (QXLPath *)get_virt(worker, *in_path,
sizeof(QXLPath), group_id);
     *in_path = channel->send_data.header.size;
-    add_buf(channel, BUF_TYPE_RAW, &path->data_size, sizeof(UINT32), 0,
0);
+    add_buf(channel, BUF_TYPE_RAW, &path->data_size, sizeof(uint32_t),
0, 0);
     add_buf(channel, BUF_TYPE_CHUNK, &path->chunk, path->data_size,
memslot_id, group_id);
 }
 
@@ -4758,7 +4758,7 @@ static void fill_str(DisplayChannel
*display_channel, QXLPHYSICAL *in_str, uint3
     memslot_id  = get_memslot_id(worker, *in_str);
     QXLString *str = (QXLString *)get_virt(worker, *in_str,
sizeof(QXLString), group_id);
     *in_str = channel->send_data.header.size;
-    add_buf(channel, BUF_TYPE_RAW, &str->length, sizeof(UINT32), 0, 0);
+    add_buf(channel, BUF_TYPE_RAW, &str->length, sizeof(uint32_t), 0,
0);
     add_buf(channel, BUF_TYPE_CHUNK, &str->chunk, str->data_size,
memslot_id, group_id);
 }
 
@@ -4771,7 +4771,7 @@ static inline void fill_rects_clip(RedChannel
*channel, QXLPHYSICAL *in_clip, ui
     ASSERT(in_clip && *in_clip);
     clip = (QXLClipRects *)get_virt(worker, *in_clip,
sizeof(QXLClipRects), group_id);
     *in_clip = channel->send_data.header.size;
-    add_buf(channel, BUF_TYPE_RAW, &clip->num_rects, sizeof(UINT32), 0,
0);
+    add_buf(channel, BUF_TYPE_RAW, &clip->num_rects, sizeof(uint32_t),
0, 0);
     add_buf(channel, BUF_TYPE_CHUNK, &clip->chunk, clip->num_rects *
sizeof(SpiceRect), memslot_id,
             group_id);
 }
@@ -4798,7 +4798,7 @@ static inline RedImage *alloc_image(DisplayChannel
*display_channel)
 }
 
 /* io_palette is relative address of the palette*/
-static inline void fill_palette(DisplayChannel *display_channel,
SPICE_ADDRESS *io_palette, UINT8 *flags,
+static inline void fill_palette(DisplayChannel *display_channel,
SPICE_ADDRESS *io_palette, uint8_t *flags,
                                 uint32_t group_id)
 {
     RedChannel *channel = &display_channel->base;
@@ -4821,7 +4821,7 @@ static inline void fill_palette(DisplayChannel
*display_channel, SPICE_ADDRESS *
     }
     *io_palette = channel->send_data.header.size;
     add_buf(channel, BUF_TYPE_RAW, palette,
-            sizeof(SpicePalette) + palette->num_ents * sizeof(UINT32),
0, 0);
+            sizeof(SpicePalette) + palette->num_ents *
sizeof(uint32_t), 0, 0);
 }
 
 static inline RedCompressBuf
*red_display_alloc_compress_buf(DisplayChannel *display_channel)
@@ -5559,7 +5559,7 @@ typedef struct compress_send_data_t {
     void*    comp_buf;
     uint32_t comp_buf_size;
     SPICE_ADDRESS  *plt_ptr;
-    UINT8    *flags_ptr;
+    uint8_t    *flags_ptr;
 } compress_send_data_t;
 
 





-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl at redhat.com            alexander.larsson at gmail.com 
He's a genetically engineered moralistic stage actor on the edge. She's a 
disco-crazy punk former first lady who inherited a spooky stately manor from 
her late maiden aunt. They fight crime! 



More information about the Spice-devel mailing list