[Spice-commits] 9 commits - client/canvas.h client/glz_decoder.h client/monitor.h client/pixels_source.h common/canvas_base.c common/canvas_base.h common/draw.h common/gdi_canvas.c common/gdi_canvas.h common/gl_canvas.h common/lines.h common/lz.h common/marshaller.h common/mem.h common/messages.h common/pixman_utils.c common/pixman_utils.h common/rect.h common/region.h common/rop3.h common/sw_canvas.h python_modules/demarshal.py python_modules/ptypes.py server/red_parse_qxl.c server/red_parse_qxl.h server/red_worker.c spice1.proto spice.proto

Alexander Larsson alexl at kemper.freedesktop.org
Thu Jul 8 05:48:52 PDT 2010


 client/canvas.h             |    5 
 client/glz_decoder.h        |    3 
 client/monitor.h            |    2 
 client/pixels_source.h      |    2 
 common/canvas_base.c        |    3 
 common/canvas_base.h        |    2 
 common/draw.h               |  274 ++++++++++++++++++++++++++++++++++++++++++++
 common/gdi_canvas.c         |    3 
 common/gdi_canvas.h         |    1 
 common/gl_canvas.h          |    1 
 common/lines.h              |    2 
 common/lz.h                 |    2 
 common/marshaller.h         |    2 
 common/mem.h                |   18 ++
 common/messages.h           |    1 
 common/pixman_utils.c       |   30 ----
 common/pixman_utils.h       |    2 
 common/rect.h               |    2 
 common/region.h             |    2 
 common/rop3.h               |    2 
 common/sw_canvas.h          |    2 
 python_modules/demarshal.py |   24 +--
 python_modules/ptypes.py    |    7 -
 server/red_parse_qxl.c      |   61 +++++----
 server/red_parse_qxl.h      |   33 ++---
 server/red_worker.c         |   49 ++-----
 spice.proto                 |   24 +--
 spice1.proto                |   22 +--
 28 files changed, 409 insertions(+), 172 deletions(-)

New commits:
commit 10734c8d74bc26043c9714a80468040b8bfa7249
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Jul 8 14:46:04 2010 +0200

    Simplify spice_pixman_region32_init_rects with new types
    
    Don't manually of SpiceRects to pixman_box32_t now that they are compatible
    and SpiceRect is internal.

diff --git a/common/pixman_utils.c b/common/pixman_utils.c
index de8706e..bdc18c9 100644
--- a/common/pixman_utils.c
+++ b/common/pixman_utils.c
@@ -919,34 +919,8 @@ pixman_bool_t spice_pixman_region32_init_rects (pixman_region32_t *region,
                                                 const SpiceRect   *rects,
                                                 int                count)
 {
-    pixman_box32_t boxes_array[10];
-    pixman_box32_t *boxes;
-    pixman_bool_t res;
-    int i;
-
-    if (count < 10) {
-        boxes = boxes_array;
-    } else {
-        boxes = spice_new(pixman_box32_t, count);
-        if (boxes == NULL) {
-            return FALSE;
-        }
-    }
-
-    for (i = 0; i < count; i++) {
-        boxes[i].x1 = rects[i].left;
-        boxes[i].y1 = rects[i].top;
-        boxes[i].x2 = rects[i].right;
-        boxes[i].y2 = rects[i].bottom;
-    }
-
-    res = pixman_region32_init_rects(region, boxes, count);
-
-    if (count >= 10) {
-        free(boxes);
-    }
-
-    return res;
+    /* These types are compatible, so just cast */
+    return pixman_region32_init_rects(region, (pixman_box32_t *)rects, count);
 }
 
 pixman_format_code_t spice_surface_format_to_pixman(uint32_t surface_format)
commit c60c995e60d4364d9d5233dbc84b32a118b3b360
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Jul 8 14:30:01 2010 +0200

    Make all internal structures not be packed

diff --git a/common/draw.h b/common/draw.h
index 79ca596..5741eff 100644
--- a/common/draw.h
+++ b/common/draw.h
@@ -35,58 +35,56 @@
 #include <spice/enums.h>
 #include <common/mem.h>
 
-#include <spice/start-packed.h>
-
 #define SPICE_GET_ADDRESS(addr) ((void *)(unsigned long)(addr))
 #define SPICE_SET_ADDRESS(addr, val) ((addr) = (unsigned long)(val))
 
 typedef int32_t SPICE_FIXED28_4;
 typedef uint64_t SPICE_ADDRESS;
 
-typedef struct SPICE_ATTR_PACKED SpicePointFix {
+typedef struct SpicePointFix {
     SPICE_FIXED28_4 x;
     SPICE_FIXED28_4 y;
 } SpicePointFix;
 
-typedef struct SPICE_ATTR_PACKED SpicePoint {
+typedef struct SpicePoint {
     int32_t x;
     int32_t y;
 } SpicePoint;
 
-typedef struct SPICE_ATTR_PACKED SpicePoint16 {
+typedef struct SpicePoint16 {
     int16_t x;
     int16_t y;
 } SpicePoint16;
 
-typedef struct SPICE_ATTR_PACKED SpiceRect {
+typedef struct SpiceRect {
     int32_t left;
     int32_t top;
     int32_t right;
     int32_t bottom;
 } SpiceRect;
 
-typedef struct SPICE_ATTR_PACKED SpicePathSeg {
+typedef struct SpicePathSeg {
     uint32_t flags;
     uint32_t count;
     SpicePointFix points[0];
 } SpicePathSeg;
 
-typedef struct SPICE_ATTR_PACKED SpicePath {
+typedef struct SpicePath {
   uint32_t num_segments;
   SpicePathSeg *segments[0];
 } SpicePath;
 
-typedef struct SPICE_ATTR_PACKED SpiceClipRects {
+typedef struct SpiceClipRects {
   uint32_t num_rects;
   SpiceRect rects[0];
 } SpiceClipRects;
 
-typedef struct SPICE_ATTR_PACKED SpiceClip {
+typedef struct SpiceClip {
     uint32_t type;
     SpiceClipRects *rects;
 } SpiceClip;
 
-typedef struct SPICE_ATTR_PACKED SpicePalette {
+typedef struct SpicePalette {
     uint64_t unique;
     uint16_t num_ents;
     uint32_t ents[0];
@@ -94,7 +92,7 @@ typedef struct SPICE_ATTR_PACKED SpicePalette {
 
 #define SPICE_SURFACE_FMT_DEPTH(_d) ((_d) & 0x3f)
 
-typedef struct SPICE_ATTR_PACKED SpiceImageDescriptor {
+typedef struct SpiceImageDescriptor {
     uint64_t id;
     uint8_t type;
     uint8_t flags;
@@ -102,7 +100,7 @@ typedef struct SPICE_ATTR_PACKED SpiceImageDescriptor {
     uint32_t height;
 } SpiceImageDescriptor;
 
-typedef struct SPICE_ATTR_PACKED SpiceBitmap {
+typedef struct SpiceBitmap {
     uint8_t format;
     uint8_t flags;
     uint32_t x;
@@ -113,16 +111,16 @@ typedef struct SPICE_ATTR_PACKED SpiceBitmap {
     SpiceChunks *data;
 } SpiceBitmap;
 
-typedef struct SPICE_ATTR_PACKED SpiceSurface {
+typedef struct SpiceSurface {
     uint32_t surface_id;
 } SpiceSurface;
 
-typedef struct SPICE_ATTR_PACKED SpiceQUICData {
+typedef struct SpiceQUICData {
     uint32_t data_size;
     SpiceChunks *data;
 } SpiceQUICData, SpiceLZRGBData, SpiceJPEGData;
 
-typedef struct SPICE_ATTR_PACKED SpiceLZPLTData {
+typedef struct SpiceLZPLTData {
     uint8_t flags;
     uint32_t data_size;
     SpicePalette *palette;
@@ -130,13 +128,13 @@ typedef struct SPICE_ATTR_PACKED SpiceLZPLTData {
     SpiceChunks *data;
 } SpiceLZPLTData;
 
-typedef struct SPICE_ATTR_PACKED SpiceZlibGlzRGBData {
+typedef struct SpiceZlibGlzRGBData {
     uint32_t glz_data_size;
     uint32_t data_size;
     SpiceChunks *data;
 } SpiceZlibGlzRGBData;
 
-typedef struct SPICE_ATTR_PACKED SpiceJPEGAlphaData {
+typedef struct SpiceJPEGAlphaData {
     uint8_t flags;
     uint32_t jpeg_size;
     uint32_t data_size;
@@ -144,7 +142,7 @@ typedef struct SPICE_ATTR_PACKED SpiceJPEGAlphaData {
 } SpiceJPEGAlphaData;
 
 
-typedef struct SPICE_ATTR_PACKED SpiceImage {
+typedef struct SpiceImage {
     SpiceImageDescriptor descriptor;
     union {
         SpiceBitmap         bitmap;
@@ -158,12 +156,12 @@ typedef struct SPICE_ATTR_PACKED SpiceImage {
     } u;
 } SpiceImage;
 
-typedef struct SPICE_ATTR_PACKED SpicePattern {
+typedef struct SpicePattern {
     SpiceImage *pat;
     SpicePoint pos;
 } SpicePattern;
 
-typedef struct SPICE_ATTR_PACKED SpiceBrush {
+typedef struct SpiceBrush {
     uint32_t type;
     union {
         uint32_t color;
@@ -171,19 +169,19 @@ typedef struct SPICE_ATTR_PACKED SpiceBrush {
     } u;
 } SpiceBrush;
 
-typedef struct SPICE_ATTR_PACKED SpiceQMask {
+typedef struct SpiceQMask {
     uint8_t flags;
     SpicePoint pos;
     SpiceImage *bitmap;
 } SpiceQMask;
 
-typedef struct SPICE_ATTR_PACKED SpiceFill {
+typedef struct SpiceFill {
     SpiceBrush brush;
     uint16_t rop_descriptor;
     SpiceQMask mask;
 } SpiceFill;
 
-typedef struct SPICE_ATTR_PACKED SpiceOpaque {
+typedef struct SpiceOpaque {
     SpiceImage *src_bitmap;
     SpiceRect src_area;
     SpiceBrush brush;
@@ -192,7 +190,7 @@ typedef struct SPICE_ATTR_PACKED SpiceOpaque {
     SpiceQMask mask;
 } SpiceOpaque;
 
-typedef struct SPICE_ATTR_PACKED SpiceCopy {
+typedef struct SpiceCopy {
     SpiceImage *src_bitmap;
     SpiceRect src_area;
     uint16_t rop_descriptor;
@@ -200,21 +198,21 @@ typedef struct SPICE_ATTR_PACKED SpiceCopy {
     SpiceQMask mask;
 } SpiceCopy, SpiceBlend;
 
-typedef struct SPICE_ATTR_PACKED SpiceTransparent {
+typedef struct SpiceTransparent {
     SpiceImage *src_bitmap;
     SpiceRect src_area;
     uint32_t src_color;
     uint32_t true_color;
 } SpiceTransparent;
 
-typedef struct SPICE_ATTR_PACKED SpiceAlphaBlnd {
+typedef struct SpiceAlphaBlnd {
     uint16_t alpha_flags;
     uint8_t alpha;
     SpiceImage *src_bitmap;
     SpiceRect src_area;
 } SpiceAlphaBlnd;
 
-typedef struct SPICE_ATTR_PACKED SpiceRop3 {
+typedef struct SpiceRop3 {
     SpiceImage *src_bitmap;
     SpiceRect src_area;
     SpiceBrush brush;
@@ -223,17 +221,17 @@ typedef struct SPICE_ATTR_PACKED SpiceRop3 {
     SpiceQMask mask;
 } SpiceRop3;
 
-typedef struct SPICE_ATTR_PACKED SpiceBlackness {
+typedef struct SpiceBlackness {
     SpiceQMask mask;
 } SpiceBlackness, SpiceInvers, SpiceWhiteness;
 
-typedef struct SPICE_ATTR_PACKED SpiceLineAttr {
+typedef struct SpiceLineAttr {
     uint8_t flags;
     uint8_t style_nseg;
     SPICE_FIXED28_4 *style;
 } SpiceLineAttr;
 
-typedef struct SPICE_ATTR_PACKED SpiceStroke {
+typedef struct SpiceStroke {
     SpicePath *path;
     SpiceLineAttr attr;
     SpiceBrush brush;
@@ -241,7 +239,7 @@ typedef struct SPICE_ATTR_PACKED SpiceStroke {
     uint16_t back_mode;
 } SpiceStroke;
 
-typedef struct SPICE_ATTR_PACKED SpiceRasterGlyph {
+typedef struct SpiceRasterGlyph {
     SpicePoint render_pos;
     SpicePoint glyph_origin;
     uint16_t width;
@@ -249,13 +247,13 @@ typedef struct SPICE_ATTR_PACKED SpiceRasterGlyph {
     uint8_t data[0];
 } SpiceRasterGlyph;
 
-typedef struct SPICE_ATTR_PACKED SpiceString {
+typedef struct SpiceString {
     uint16_t length;
     uint16_t flags;
     SpiceRasterGlyph *glyphs[0];
 } SpiceString;
 
-typedef struct SPICE_ATTR_PACKED SpiceText {
+typedef struct SpiceText {
     SpiceString *str;
     SpiceRect back_area;
     SpiceBrush fore_brush;
@@ -264,7 +262,7 @@ typedef struct SPICE_ATTR_PACKED SpiceText {
     uint16_t back_mode;
 } SpiceText;
 
-typedef struct SPICE_ATTR_PACKED SpiceCursorHeader {
+typedef struct SpiceCursorHeader {
     uint64_t unique;
     uint16_t type;
     uint16_t width;
@@ -273,6 +271,4 @@ typedef struct SPICE_ATTR_PACKED SpiceCursorHeader {
     uint16_t hot_spot_y;
 } SpiceCursorHeader;
 
-#include <spice/end-packed.h>
-
 #endif /* _H_SPICE_DRAW */
diff --git a/server/red_parse_qxl.h b/server/red_parse_qxl.h
index 2615e01..0d713e8 100644
--- a/server/red_parse_qxl.h
+++ b/server/red_parse_qxl.h
@@ -20,11 +20,10 @@
 #define RED_ABI_TRANSLATE_H
 
 #include <spice/qxl_dev.h>
-#include <spice/start-packed.h>
 #include "red_common.h"
 #include "red_memslots.h"
 
-typedef struct SPICE_ATTR_PACKED RedDrawable {
+typedef struct RedDrawable {
     QXLReleaseInfo *release_info;
     uint32_t surface_id;
     uint8_t effect;
@@ -55,27 +54,27 @@ typedef struct SPICE_ATTR_PACKED RedDrawable {
     } u;
 } RedDrawable;
 
-typedef struct SPICE_ATTR_PACKED RedUpdateCmd {
+typedef struct RedUpdateCmd {
     QXLReleaseInfo *release_info;
     SpiceRect area;
     uint32_t update_id;
     uint32_t surface_id;
 } RedUpdateCmd;
 
-typedef struct SPICE_ATTR_PACKED RedMessage {
+typedef struct RedMessage {
     QXLReleaseInfo *release_info;
     uint8_t *data;
 } RedMessage;
 
-typedef struct SPICE_ATTR_PACKED RedDataChunk RedDataChunk;
-struct SPICE_ATTR_PACKED RedDataChunk {
+typedef struct RedDataChunk RedDataChunk;
+struct RedDataChunk {
     uint32_t data_size;
     RedDataChunk *prev_chunk;
     RedDataChunk *next_chunk;
     uint8_t *data;
 };
 
-typedef struct SPICE_ATTR_PACKED RedSurfaceCreate {
+typedef struct RedSurfaceCreate {
     uint32_t format;
     uint32_t width;
     uint32_t height;
@@ -83,7 +82,7 @@ typedef struct SPICE_ATTR_PACKED RedSurfaceCreate {
     SPICE_ADDRESS data;
 } RedSurfaceCreate;
 
-typedef struct SPICE_ATTR_PACKED RedSurfaceCmd {
+typedef struct RedSurfaceCmd {
     QXLReleaseInfo *release_info;
     uint32_t surface_id;
     uint8_t type;
@@ -93,16 +92,16 @@ typedef struct SPICE_ATTR_PACKED RedSurfaceCmd {
     } u;
 } RedSurfaceCmd;
 
-typedef struct SPICE_ATTR_PACKED RedCursorCmd {
+typedef struct RedCursorCmd {
     QXLReleaseInfo *release_info;
     uint8_t type;
     union {
-        struct SPICE_ATTR_PACKED {
+        struct {
             SpicePoint16 position;
             uint8_t visible;
             SPICE_ADDRESS shape;
         } set;
-        struct SPICE_ATTR_PACKED {
+        struct {
             uint16_t length;
             uint16_t frequency;
         } trail;
commit 601aecc8ad96af0ee765dd194103f7adcf98da67
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Jul 8 14:19:45 2010 +0200

    Remove unused method declarations

diff --git a/client/canvas.h b/client/canvas.h
index 87bc060..4844c31 100644
--- a/client/canvas.h
+++ b/client/canvas.h
@@ -450,11 +450,6 @@ protected:
     ZlibDecoder& zlib_decoder() { return _zlib_decoder;}
 
 private:
-    void access_test(void* ptr, size_t size);
-    void localalize_ptr(SPICE_ADDRESS* data);
-    void localalize_image(SPICE_ADDRESS* in_bitmap);
-    void localalize_brush(SpiceBrush& brush);
-    void localalize_mask(SpiceQMask& mask);
     void begin_draw(SpiceMsgDisplayBase& base, int size, size_t min_size);
 
 protected:
commit 1d64d398447de90e12da7f6afacc05f07fa03b22
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Jul 8 14:17:24 2010 +0200

    Move SpiceChunks to mem.h

diff --git a/common/draw.h b/common/draw.h
index b8432a9..79ca596 100644
--- a/common/draw.h
+++ b/common/draw.h
@@ -33,6 +33,7 @@
 
 #include <spice/types.h>
 #include <spice/enums.h>
+#include <common/mem.h>
 
 #include <spice/start-packed.h>
 
@@ -101,23 +102,6 @@ typedef struct SPICE_ATTR_PACKED SpiceImageDescriptor {
     uint32_t height;
 } SpiceImageDescriptor;
 
-typedef struct SPICE_ATTR_PACKED SpiceChunk {
-    uint8_t *data;
-    uint32_t len;
-} SpiceChunk;
-
-enum {
-    SPICE_CHUNKS_FLAGS_UNSTABLE = (1<<0),
-    SPICE_CHUNKS_FLAGS_FREE = (1<<1)
-};
-
-typedef struct SPICE_ATTR_PACKED SpiceChunks {
-    uint32_t     data_size;
-    uint32_t     num_chunks;
-    uint32_t     flags;
-    SpiceChunk   chunk[0];
-} SpiceChunks;
-
 typedef struct SPICE_ATTR_PACKED SpiceBitmap {
     uint8_t format;
     uint8_t flags;
diff --git a/common/marshaller.h b/common/marshaller.h
index ab11742..e7e6637 100644
--- a/common/marshaller.h
+++ b/common/marshaller.h
@@ -20,7 +20,7 @@
 #define _H_MARSHALLER
 
 #include <spice/types.h>
-#include <common/draw.h> /* for SpiceChunk, temporary */
+#include <common/mem.h>
 #ifndef WIN32
 #include <sys/uio.h>
 #endif
diff --git a/common/mem.h b/common/mem.h
index 385ef55..5f0eb25 100644
--- a/common/mem.h
+++ b/common/mem.h
@@ -21,7 +21,23 @@
 
 #include <stdlib.h>
 #include <spice/macros.h>
-#include <common/draw.h> /* for SpiceChunks, temporary */
+
+typedef struct SpiceChunk {
+    uint8_t *data;
+    uint32_t len;
+} SpiceChunk;
+
+enum {
+    SPICE_CHUNKS_FLAGS_UNSTABLE = (1<<0),
+    SPICE_CHUNKS_FLAGS_FREE = (1<<1)
+};
+
+typedef struct SpiceChunks {
+    uint32_t     data_size;
+    uint32_t     num_chunks;
+    uint32_t     flags;
+    SpiceChunk   chunk[0];
+} SpiceChunks;
 
 char *spice_strdup(const char *str) SPICE_GNUC_MALLOC;
 char *spice_strndup(const char *str, size_t n_bytes) SPICE_GNUC_MALLOC;
commit 0659fb78972b5e9d0dc90a0270ef1dd4b59042ec
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Jul 8 13:56:01 2010 +0200

    Move in spice/draw.h from spice-protocol to common/

diff --git a/client/glz_decoder.h b/client/glz_decoder.h
index bf57252..f046f8c 100644
--- a/client/glz_decoder.h
+++ b/client/glz_decoder.h
@@ -23,9 +23,6 @@
 #include "glz_decoder_config.h"
 #include "glz_decoder_window.h"
 #include "canvas_base.h"
-#include <spice/draw.h>
-
-
 
 class GlzDecodeHandler {
 public:
diff --git a/client/monitor.h b/client/monitor.h
index 34089c0..39d957d 100644
--- a/client/monitor.h
+++ b/client/monitor.h
@@ -18,7 +18,7 @@
 #ifndef _H_MONITOR
 #define _H_MONITOR
 
-#include <spice/draw.h>
+#include <common/draw.h>
 
 class Monitor {
 public:
diff --git a/client/pixels_source.h b/client/pixels_source.h
index 6b898b2..6e24300 100644
--- a/client/pixels_source.h
+++ b/client/pixels_source.h
@@ -18,7 +18,7 @@
 #ifndef _H_PIXELS_SOURCE
 #define _H_PIXELS_SOURCE
 
-#include <spice/draw.h>
+#include <common/draw.h>
 
 #define PIXELES_SOURCE_OPAQUE_SIZE (20 * sizeof(void*))
 
diff --git a/common/canvas_base.c b/common/canvas_base.c
index 6a0c09c..ef60d21 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -22,7 +22,6 @@
 #include <stdio.h>
 #include <math.h>
 
-#include <spice/draw.h>
 #include <spice/macros.h>
 #include "quic.h"
 #include "lz.h"
diff --git a/common/canvas_base.h b/common/canvas_base.h
index 36199a7..55e1b33 100644
--- a/common/canvas_base.h
+++ b/common/canvas_base.h
@@ -23,7 +23,7 @@
 #include "pixman_utils.h"
 #include "lz.h"
 #include "region.h"
-#include <spice/draw.h>
+#include <common/draw.h>
 
 typedef void (*spice_destroy_fn_t)(void *data);
 
diff --git a/common/draw.h b/common/draw.h
new file mode 100644
index 0000000..b8432a9
--- /dev/null
+++ b/common/draw.h
@@ -0,0 +1,294 @@
+/*
+   Copyright (C) 2009 Red Hat, Inc.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are
+   met:
+
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in
+         the documentation and/or other materials provided with the
+         distribution.
+       * Neither the name of the copyright holder nor the names of its
+         contributors may be used to endorse or promote products derived
+         from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
+   IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+   PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef _H_SPICE_DRAW
+#define _H_SPICE_DRAW
+
+#include <spice/types.h>
+#include <spice/enums.h>
+
+#include <spice/start-packed.h>
+
+#define SPICE_GET_ADDRESS(addr) ((void *)(unsigned long)(addr))
+#define SPICE_SET_ADDRESS(addr, val) ((addr) = (unsigned long)(val))
+
+typedef int32_t SPICE_FIXED28_4;
+typedef uint64_t SPICE_ADDRESS;
+
+typedef struct SPICE_ATTR_PACKED SpicePointFix {
+    SPICE_FIXED28_4 x;
+    SPICE_FIXED28_4 y;
+} SpicePointFix;
+
+typedef struct SPICE_ATTR_PACKED SpicePoint {
+    int32_t x;
+    int32_t y;
+} SpicePoint;
+
+typedef struct SPICE_ATTR_PACKED SpicePoint16 {
+    int16_t x;
+    int16_t y;
+} SpicePoint16;
+
+typedef struct SPICE_ATTR_PACKED SpiceRect {
+    int32_t left;
+    int32_t top;
+    int32_t right;
+    int32_t bottom;
+} SpiceRect;
+
+typedef struct SPICE_ATTR_PACKED SpicePathSeg {
+    uint32_t flags;
+    uint32_t count;
+    SpicePointFix points[0];
+} SpicePathSeg;
+
+typedef struct SPICE_ATTR_PACKED SpicePath {
+  uint32_t num_segments;
+  SpicePathSeg *segments[0];
+} SpicePath;
+
+typedef struct SPICE_ATTR_PACKED SpiceClipRects {
+  uint32_t num_rects;
+  SpiceRect rects[0];
+} SpiceClipRects;
+
+typedef struct SPICE_ATTR_PACKED SpiceClip {
+    uint32_t type;
+    SpiceClipRects *rects;
+} SpiceClip;
+
+typedef struct SPICE_ATTR_PACKED SpicePalette {
+    uint64_t unique;
+    uint16_t num_ents;
+    uint32_t ents[0];
+} SpicePalette;
+
+#define SPICE_SURFACE_FMT_DEPTH(_d) ((_d) & 0x3f)
+
+typedef struct SPICE_ATTR_PACKED SpiceImageDescriptor {
+    uint64_t id;
+    uint8_t type;
+    uint8_t flags;
+    uint32_t width;
+    uint32_t height;
+} SpiceImageDescriptor;
+
+typedef struct SPICE_ATTR_PACKED SpiceChunk {
+    uint8_t *data;
+    uint32_t len;
+} SpiceChunk;
+
+enum {
+    SPICE_CHUNKS_FLAGS_UNSTABLE = (1<<0),
+    SPICE_CHUNKS_FLAGS_FREE = (1<<1)
+};
+
+typedef struct SPICE_ATTR_PACKED SpiceChunks {
+    uint32_t     data_size;
+    uint32_t     num_chunks;
+    uint32_t     flags;
+    SpiceChunk   chunk[0];
+} SpiceChunks;
+
+typedef struct SPICE_ATTR_PACKED SpiceBitmap {
+    uint8_t format;
+    uint8_t flags;
+    uint32_t x;
+    uint32_t y;
+    uint32_t stride;
+    SpicePalette *palette;
+    uint64_t palette_id;
+    SpiceChunks *data;
+} SpiceBitmap;
+
+typedef struct SPICE_ATTR_PACKED SpiceSurface {
+    uint32_t surface_id;
+} SpiceSurface;
+
+typedef struct SPICE_ATTR_PACKED SpiceQUICData {
+    uint32_t data_size;
+    SpiceChunks *data;
+} SpiceQUICData, SpiceLZRGBData, SpiceJPEGData;
+
+typedef struct SPICE_ATTR_PACKED SpiceLZPLTData {
+    uint8_t flags;
+    uint32_t data_size;
+    SpicePalette *palette;
+    uint64_t palette_id;
+    SpiceChunks *data;
+} SpiceLZPLTData;
+
+typedef struct SPICE_ATTR_PACKED SpiceZlibGlzRGBData {
+    uint32_t glz_data_size;
+    uint32_t data_size;
+    SpiceChunks *data;
+} SpiceZlibGlzRGBData;
+
+typedef struct SPICE_ATTR_PACKED SpiceJPEGAlphaData {
+    uint8_t flags;
+    uint32_t jpeg_size;
+    uint32_t data_size;
+    SpiceChunks *data;
+} SpiceJPEGAlphaData;
+
+
+typedef struct SPICE_ATTR_PACKED SpiceImage {
+    SpiceImageDescriptor descriptor;
+    union {
+        SpiceBitmap         bitmap;
+        SpiceQUICData       quic;
+        SpiceSurface        surface;
+        SpiceLZRGBData      lz_rgb;
+        SpiceLZPLTData      lz_plt;
+        SpiceJPEGData       jpeg;
+        SpiceZlibGlzRGBData zlib_glz;
+        SpiceJPEGAlphaData  jpeg_alpha;
+    } u;
+} SpiceImage;
+
+typedef struct SPICE_ATTR_PACKED SpicePattern {
+    SpiceImage *pat;
+    SpicePoint pos;
+} SpicePattern;
+
+typedef struct SPICE_ATTR_PACKED SpiceBrush {
+    uint32_t type;
+    union {
+        uint32_t color;
+        SpicePattern pattern;
+    } u;
+} SpiceBrush;
+
+typedef struct SPICE_ATTR_PACKED SpiceQMask {
+    uint8_t flags;
+    SpicePoint pos;
+    SpiceImage *bitmap;
+} SpiceQMask;
+
+typedef struct SPICE_ATTR_PACKED SpiceFill {
+    SpiceBrush brush;
+    uint16_t rop_descriptor;
+    SpiceQMask mask;
+} SpiceFill;
+
+typedef struct SPICE_ATTR_PACKED SpiceOpaque {
+    SpiceImage *src_bitmap;
+    SpiceRect src_area;
+    SpiceBrush brush;
+    uint16_t rop_descriptor;
+    uint8_t scale_mode;
+    SpiceQMask mask;
+} SpiceOpaque;
+
+typedef struct SPICE_ATTR_PACKED SpiceCopy {
+    SpiceImage *src_bitmap;
+    SpiceRect src_area;
+    uint16_t rop_descriptor;
+    uint8_t scale_mode;
+    SpiceQMask mask;
+} SpiceCopy, SpiceBlend;
+
+typedef struct SPICE_ATTR_PACKED SpiceTransparent {
+    SpiceImage *src_bitmap;
+    SpiceRect src_area;
+    uint32_t src_color;
+    uint32_t true_color;
+} SpiceTransparent;
+
+typedef struct SPICE_ATTR_PACKED SpiceAlphaBlnd {
+    uint16_t alpha_flags;
+    uint8_t alpha;
+    SpiceImage *src_bitmap;
+    SpiceRect src_area;
+} SpiceAlphaBlnd;
+
+typedef struct SPICE_ATTR_PACKED SpiceRop3 {
+    SpiceImage *src_bitmap;
+    SpiceRect src_area;
+    SpiceBrush brush;
+    uint8_t rop3;
+    uint8_t scale_mode;
+    SpiceQMask mask;
+} SpiceRop3;
+
+typedef struct SPICE_ATTR_PACKED SpiceBlackness {
+    SpiceQMask mask;
+} SpiceBlackness, SpiceInvers, SpiceWhiteness;
+
+typedef struct SPICE_ATTR_PACKED SpiceLineAttr {
+    uint8_t flags;
+    uint8_t style_nseg;
+    SPICE_FIXED28_4 *style;
+} SpiceLineAttr;
+
+typedef struct SPICE_ATTR_PACKED SpiceStroke {
+    SpicePath *path;
+    SpiceLineAttr attr;
+    SpiceBrush brush;
+    uint16_t fore_mode;
+    uint16_t back_mode;
+} SpiceStroke;
+
+typedef struct SPICE_ATTR_PACKED SpiceRasterGlyph {
+    SpicePoint render_pos;
+    SpicePoint glyph_origin;
+    uint16_t width;
+    uint16_t height;
+    uint8_t data[0];
+} SpiceRasterGlyph;
+
+typedef struct SPICE_ATTR_PACKED SpiceString {
+    uint16_t length;
+    uint16_t flags;
+    SpiceRasterGlyph *glyphs[0];
+} SpiceString;
+
+typedef struct SPICE_ATTR_PACKED SpiceText {
+    SpiceString *str;
+    SpiceRect back_area;
+    SpiceBrush fore_brush;
+    SpiceBrush back_brush;
+    uint16_t fore_mode;
+    uint16_t back_mode;
+} SpiceText;
+
+typedef struct SPICE_ATTR_PACKED SpiceCursorHeader {
+    uint64_t unique;
+    uint16_t type;
+    uint16_t width;
+    uint16_t height;
+    uint16_t hot_spot_x;
+    uint16_t hot_spot_y;
+} SpiceCursorHeader;
+
+#include <spice/end-packed.h>
+
+#endif /* _H_SPICE_DRAW */
diff --git a/common/gdi_canvas.h b/common/gdi_canvas.h
index 3fdf07e..b3d4b15 100644
--- a/common/gdi_canvas.h
+++ b/common/gdi_canvas.h
@@ -21,7 +21,6 @@
 
 #include <stdint.h>
 
-#include <spice/draw.h>
 #include "pixman_utils.h"
 #include "canvas_base.h"
 #include "region.h"
diff --git a/common/gl_canvas.h b/common/gl_canvas.h
index dfb59bb..d7125e6 100644
--- a/common/gl_canvas.h
+++ b/common/gl_canvas.h
@@ -17,7 +17,6 @@
 */
 
 #include "glc.h"
-#include <spice/draw.h>
 #include "canvas_base.h"
 #include "region.h"
 
diff --git a/common/lines.h b/common/lines.h
index 33c8ea9..8a60c03 100644
--- a/common/lines.h
+++ b/common/lines.h
@@ -52,7 +52,7 @@ SOFTWARE.
 #include <pixman_utils.h>
 #include <stdlib.h>
 #include <string.h>
-#include <spice/draw.h>
+#include <common/draw.h>
 
 typedef struct lineGC lineGC;
 
diff --git a/common/lz.h b/common/lz.h
index 6f796f1..fb61e10 100644
--- a/common/lz.h
+++ b/common/lz.h
@@ -8,7 +8,7 @@
 
 #include "lz_common.h"
 #include "lz_config.h"
-#include <spice/draw.h>
+#include <common/draw.h>
 
 typedef void *LzContext;
 
diff --git a/common/marshaller.h b/common/marshaller.h
index 5118934..ab11742 100644
--- a/common/marshaller.h
+++ b/common/marshaller.h
@@ -20,7 +20,7 @@
 #define _H_MARSHALLER
 
 #include <spice/types.h>
-#include <spice/draw.h> /* for SpiceChunk, temporary */
+#include <common/draw.h> /* for SpiceChunk, temporary */
 #ifndef WIN32
 #include <sys/uio.h>
 #endif
diff --git a/common/mem.h b/common/mem.h
index ebf2fb8..385ef55 100644
--- a/common/mem.h
+++ b/common/mem.h
@@ -21,7 +21,7 @@
 
 #include <stdlib.h>
 #include <spice/macros.h>
-#include <spice/draw.h> /* for SpiceChunks, temporary */
+#include <common/draw.h> /* for SpiceChunks, temporary */
 
 char *spice_strdup(const char *str) SPICE_GNUC_MALLOC;
 char *spice_strndup(const char *str, size_t n_bytes) SPICE_GNUC_MALLOC;
diff --git a/common/messages.h b/common/messages.h
index 7575f07..4cbd80e 100644
--- a/common/messages.h
+++ b/common/messages.h
@@ -32,6 +32,7 @@
 #define _H_MESSAGES
 
 #include <spice/protocol.h>
+#include <common/draw.h>
 
 typedef struct SpiceMsgData {
     uint32_t data_size;
diff --git a/common/pixman_utils.h b/common/pixman_utils.h
index 24ecee3..45a58ca 100644
--- a/common/pixman_utils.h
+++ b/common/pixman_utils.h
@@ -24,7 +24,7 @@
 #define PIXMAN_DONT_DEFINE_STDINT
 #include <pixman.h>
 
-#include <spice/draw.h>
+#include <common/draw.h>
 
 /* This lists all possible 2 argument binary raster ops.
  * This enum has the same values as the X11 GXcopy type
diff --git a/common/rect.h b/common/rect.h
index 802c76b..7d8e752 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -19,7 +19,7 @@
 #ifndef _H_RECT
 #define _H_RECT
 
-#include <spice/draw.h>
+#include <common/draw.h>
 #include <spice/macros.h>
 
 static inline void rect_sect(SpiceRect* r, const SpiceRect* bounds)
diff --git a/common/region.h b/common/region.h
index 223370d..c90e06f 100644
--- a/common/region.h
+++ b/common/region.h
@@ -20,7 +20,7 @@
 #define _H_REGION
 
 #include <stdint.h>
-#include <spice/draw.h>
+#include <common/draw.h>
 #include <pixman_utils.h>
 
 typedef pixman_region32_t QRegion;
diff --git a/common/rop3.h b/common/rop3.h
index 9c86397..15f31d4 100644
--- a/common/rop3.h
+++ b/common/rop3.h
@@ -21,7 +21,7 @@
 
 #include <stdint.h>
 
-#include <spice/draw.h>
+#include <common/draw.h>
 #include "pixman_utils.h"
 
 void do_rop3_with_pattern(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos,
diff --git a/common/sw_canvas.h b/common/sw_canvas.h
index d4573bb..2d55118 100644
--- a/common/sw_canvas.h
+++ b/common/sw_canvas.h
@@ -21,7 +21,7 @@
 
 #include <stdint.h>
 
-#include <spice/draw.h>
+#include <common/draw.h>
 #include "pixman_utils.h"
 #include "canvas_base.h"
 #include "region.h"
commit 3c0329d27f692d418fa6bd0955dd5e0c242618a6
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Jul 8 13:24:15 2010 +0200

    Handle the new QXLCursorHeader type

diff --git a/server/red_worker.c b/server/red_worker.c
index e95d51a..dfd445a 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -6391,7 +6391,12 @@ static void fill_cursor(CursorChannel *cursor_channel, SpiceCursor *red_cursor,
         qxl_cursor = (QXLCursor *)get_virt(&channel->worker->mem_slots, cursor_cmd->u.set.shape,
                                            sizeof(QXLCursor), cursor->group_id);
         red_cursor->flags = 0;
-        red_cursor->header = qxl_cursor->header;
+        red_cursor->header.unique = qxl_cursor->header.unique;
+        red_cursor->header.type = qxl_cursor->header.type;
+        red_cursor->header.width = qxl_cursor->header.width;
+        red_cursor->header.height = qxl_cursor->header.height;
+        red_cursor->header.hot_spot_x = qxl_cursor->header.hot_spot_x;
+        red_cursor->header.hot_spot_y = qxl_cursor->header.hot_spot_y;
 
         if (red_cursor->header.unique) {
             if (red_cursor_cache_find(cursor_channel, red_cursor->header.unique)) {
@@ -9964,7 +9969,7 @@ typedef struct __attribute__ ((__packed__)) CursorData {
     SpiceCursor _cursor;
 } CursorData;
 
-static LocalCursor *_new_local_cursor(SpiceCursorHeader *header, int data_size, SpicePoint16 position)
+static LocalCursor *_new_local_cursor(QXLCursorHeader *header, int data_size, SpicePoint16 position)
 {
     LocalCursor *local;
 
@@ -9974,8 +9979,13 @@ static LocalCursor *_new_local_cursor(SpiceCursorHeader *header, int data_size,
     local->base.refs = 1;
     local->base.type = CURSOR_TYPE_LOCAL;
 
-    local->red_cursor.header = *header;
     local->red_cursor.header.unique = 0;
+    local->red_cursor.header.type = header->type;
+    local->red_cursor.header.width = header->width;
+    local->red_cursor.header.height = header->height;
+    local->red_cursor.header.hot_spot_x = header->hot_spot_x;
+    local->red_cursor.header.hot_spot_y = header->hot_spot_y;
+
     local->red_cursor.flags = 0;
     local->position = position;
     local->data_size = data_size;
commit aa3d3db9f4581314e6ab10a0db21fee1dcd28f28
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Jul 8 13:11:31 2010 +0200

    Use QXLPHYSICAL, not SPICE_ADDRESS in qxl parser

diff --git a/server/red_parse_qxl.c b/server/red_parse_qxl.c
index 85caa88..09f6b90 100644
--- a/server/red_parse_qxl.c
+++ b/server/red_parse_qxl.c
@@ -24,7 +24,7 @@
 
 #if 0
 static void hexdump_qxl(RedMemSlotInfo *slots, int group_id,
-                        SPICE_ADDRESS addr, uint8_t bytes)
+                        QXLPHYSICAL addr, uint8_t bytes)
 {
     uint8_t *hex;
     int i;
@@ -101,7 +101,7 @@ static size_t red_get_data_chunks_ptr(RedMemSlotInfo *slots, int group_id,
 }
 
 static size_t red_get_data_chunks(RedMemSlotInfo *slots, int group_id,
-                                  RedDataChunk *red, SPICE_ADDRESS addr)
+                                  RedDataChunk *red, QXLPHYSICAL addr)
 {
     QXLDataChunk *qxl;
     int memslot_id = get_memslot_id(slots, addr);
@@ -143,7 +143,7 @@ void red_get_rect_ptr(SpiceRect *red, QXLRect *qxl)
 }
 
 static SpicePath *red_get_path(RedMemSlotInfo *slots, int group_id,
-                               SPICE_ADDRESS addr)
+                               QXLPHYSICAL addr)
 {
     RedDataChunk chunks;
     QXLPathSeg *start, *end;
@@ -220,7 +220,7 @@ static SpicePath *red_get_path(RedMemSlotInfo *slots, int group_id,
 }
 
 static SpiceClipRects *red_get_clip_rects(RedMemSlotInfo *slots, int group_id,
-                                          SPICE_ADDRESS addr)
+                                          QXLPHYSICAL addr)
 {
     RedDataChunk chunks;
     QXLClipRects *qxl;
@@ -255,7 +255,7 @@ static SpiceClipRects *red_get_clip_rects(RedMemSlotInfo *slots, int group_id,
 }
 
 static SpiceChunks *red_get_image_data_flat(RedMemSlotInfo *slots, int group_id,
-                                            SPICE_ADDRESS addr, size_t size)
+                                            QXLPHYSICAL addr, size_t size)
 {
     SpiceChunks *data;
 
@@ -291,7 +291,7 @@ static SpiceChunks *red_get_image_data_chunked(RedMemSlotInfo *slots, int group_
 }
 
 static SpiceImage *red_get_image(RedMemSlotInfo *slots, int group_id,
-                                 SPICE_ADDRESS addr)
+                                 QXLPHYSICAL addr)
 {
     RedDataChunk chunks;
     QXLImage *qxl;
@@ -589,7 +589,7 @@ static void red_put_stroke(SpiceStroke *red)
 }
 
 static SpiceString *red_get_string(RedMemSlotInfo *slots, int group_id,
-                                   SPICE_ADDRESS addr)
+                                   QXLPHYSICAL addr)
 {
     RedDataChunk chunks;
     QXLString *qxl;
@@ -735,7 +735,7 @@ static void red_put_clip(SpiceClip *red)
 }
 
 void red_get_drawable(RedMemSlotInfo *slots, int group_id,
-                      RedDrawable *red, SPICE_ADDRESS addr)
+                      RedDrawable *red, QXLPHYSICAL addr)
 {
     QXLDrawable *qxl;
     int i;
@@ -808,7 +808,7 @@ void red_get_drawable(RedMemSlotInfo *slots, int group_id,
 }
 
 void red_get_compat_drawable(RedMemSlotInfo *slots, int group_id,
-                             RedDrawable *red, SPICE_ADDRESS addr)
+                             RedDrawable *red, QXLPHYSICAL addr)
 {
     QXLCompatDrawable *qxl;
 
@@ -915,7 +915,7 @@ void red_put_drawable(RedDrawable *red)
 }
 
 void red_get_update_cmd(RedMemSlotInfo *slots, int group_id,
-                        RedUpdateCmd *red, SPICE_ADDRESS addr)
+                        RedUpdateCmd *red, QXLPHYSICAL addr)
 {
     QXLUpdateCmd *qxl;
 
@@ -933,7 +933,7 @@ void red_put_update_cmd(RedUpdateCmd *red)
 }
 
 void red_get_message(RedMemSlotInfo *slots, int group_id,
-                     RedMessage *red, SPICE_ADDRESS addr)
+                     RedMessage *red, QXLPHYSICAL addr)
 {
     QXLMessage *qxl;
 
@@ -954,7 +954,7 @@ void red_put_message(RedMessage *red)
 }
 
 void red_get_surface_cmd(RedMemSlotInfo *slots, int group_id,
-                         RedSurfaceCmd *red, SPICE_ADDRESS addr)
+                         RedSurfaceCmd *red, QXLPHYSICAL addr)
 {
     QXLSurfaceCmd *qxl;
 
@@ -982,7 +982,7 @@ void red_put_surface_cmd(RedSurfaceCmd *red)
 }
 
 void red_get_cursor_cmd(RedMemSlotInfo *slots, int group_id,
-                        RedCursorCmd *red, SPICE_ADDRESS addr)
+                        RedCursorCmd *red, QXLPHYSICAL addr)
 {
     QXLCursorCmd *qxl;
 
diff --git a/server/red_parse_qxl.h b/server/red_parse_qxl.h
index 7c4fa0c..2615e01 100644
--- a/server/red_parse_qxl.h
+++ b/server/red_parse_qxl.h
@@ -114,26 +114,26 @@ typedef struct SPICE_ATTR_PACKED RedCursorCmd {
 void red_get_rect_ptr(SpiceRect *red, QXLRect *qxl);
 
 void red_get_drawable(RedMemSlotInfo *slots, int group_id,
-                      RedDrawable *red, SPICE_ADDRESS addr);
+                      RedDrawable *red, QXLPHYSICAL addr);
 void red_get_compat_drawable(RedMemSlotInfo *slots, int group_id,
-                             RedDrawable *red, SPICE_ADDRESS addr);
+                             RedDrawable *red, QXLPHYSICAL addr);
 void red_put_drawable(RedDrawable *red);
 void red_put_image(SpiceImage *red);
 
 void red_get_update_cmd(RedMemSlotInfo *slots, int group_id,
-                        RedUpdateCmd *red, SPICE_ADDRESS addr);
+                        RedUpdateCmd *red, QXLPHYSICAL addr);
 void red_put_update_cmd(RedUpdateCmd *red);
 
 void red_get_message(RedMemSlotInfo *slots, int group_id,
-                     RedMessage *red, SPICE_ADDRESS addr);
+                     RedMessage *red, QXLPHYSICAL addr);
 void red_put_message(RedMessage *red);
 
 void red_get_surface_cmd(RedMemSlotInfo *slots, int group_id,
-                         RedSurfaceCmd *red, SPICE_ADDRESS addr);
+                         RedSurfaceCmd *red, QXLPHYSICAL addr);
 void red_put_surface_cmd(RedSurfaceCmd *red);
 
 void red_get_cursor_cmd(RedMemSlotInfo *slots, int group_id,
-                        RedCursorCmd *red, SPICE_ADDRESS addr);
+                        RedCursorCmd *red, QXLPHYSICAL addr);
 void red_put_cursor_cmd(RedCursorCmd *red);
 
 #endif
commit f0f623ddc0f0cc6b647ed432af23bb8564fb4f5c
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Jul 8 13:07:17 2010 +0200

    codegen: No SPICE_ADDRESS types left, drop @c_ptr

diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py
index 1ae1911..e8afabb 100644
--- a/python_modules/demarshal.py
+++ b/python_modules/demarshal.py
@@ -82,9 +82,8 @@ def write_parser_helpers(writer):
     writer.begin_block("struct PointerInfo")
     writer.variable_def("uint64_t", "offset")
     writer.variable_def("parse_func_t", "parse")
-    writer.variable_def("void *", "dest")
+    writer.variable_def("void **", "dest")
     writer.variable_def("uint32_t", "nelements")
-    writer.variable_def("int", "is_ptr")
     writer.end_block(semicolon=True)
 
 def write_read_primitive(writer, start, container, name, scope):
@@ -195,7 +194,7 @@ def write_validate_struct_function(writer, struct):
 
     writer.set_is_generated("validator", validate_function)
     writer = writer.function_helper()
-    scope = writer.function(validate_function, "static intptr_t", "uint8_t *message_start, uint8_t *message_end, SPICE_ADDRESS offset, int minor")
+    scope = writer.function(validate_function, "static intptr_t", "uint8_t *message_start, uint8_t *message_end, uint64_t offset, int minor")
     scope.variable_def("uint8_t *", "start = message_start + offset")
     scope.variable_def("SPICE_GNUC_UNUSED uint8_t *", "pos");
     scope.variable_def("size_t", "mem_size", "nw_size");
@@ -809,16 +808,14 @@ def write_array_parser(writer, nelements, array, dest, scope):
                     writer.assign("end", "(uint8_t *)SPICE_ALIGN((size_t)end, 4)")
 
 def write_parse_pointer(writer, t, at_end, dest, member_name, scope):
-    as_c_ptr = t.has_attr("c_ptr")
     target_type = t.target_type
     writer.assign("ptr_info[n_ptr].offset", "consume_%s(&in)" % t.primitive_type())
     writer.assign("ptr_info[n_ptr].parse", write_parse_ptr_function(writer, target_type))
     if at_end:
-        writer.assign("ptr_info[n_ptr].dest", "end")
-        writer.increment("end", "sizeof(void *)" if as_c_ptr else "sizeof(SPICE_ADDRESS)");
+        writer.assign("ptr_info[n_ptr].dest", "(void **)end")
+        writer.increment("end", "sizeof(void *)");
     else:
-        writer.assign("ptr_info[n_ptr].dest", "&%s" % dest.get_ref(member_name))
-    writer.assign("ptr_info[n_ptr].is_ptr", "1" if as_c_ptr else "0")
+        writer.assign("ptr_info[n_ptr].dest", "(void **)&%s" % dest.get_ref(member_name))
     if target_type.is_array():
         nelements = read_array_len(writer, member_name, target_type, dest, scope)
         writer.assign("ptr_info[n_ptr].nelements", nelements)
@@ -932,20 +929,13 @@ def write_ptr_info_check(writer):
         with writer.for_loop(index, "n_ptr") as scope:
             offset = "ptr_info[%s].offset" % index
             function = "ptr_info[%s].parse" % index
-            is_ptr = "ptr_info[%s].is_ptr" % index
             dest = "ptr_info[%s].dest" % index
             with writer.if_block("%s == 0" % offset, newline=False):
-                with writer.if_block(is_ptr, newline=False):
-                    writer.assign("*(void **)(%s)" % dest, "NULL")
-                with writer.block(" else"):
-                    writer.assign("*(SPICE_ADDRESS *)(%s)" % dest, "0")
+                writer.assign("*%s" % dest, "NULL")
             with writer.block(" else"):
                 writer.comment("Align to 32 bit").newline()
                 writer.assign("end", "(uint8_t *)SPICE_ALIGN((size_t)end, 4)")
-                with writer.if_block(is_ptr, newline=False):
-                    writer.assign("*(void **)(%s)" % dest, "(void *)end")
-                with writer.block(" else"):
-                    writer.assign("*(SPICE_ADDRESS *)(%s)" % dest, "(SPICE_ADDRESS)end")
+                writer.assign("*%s" % dest, "(void *)end")
                 writer.assign("end", "%s(message_start, message_end, end, &ptr_info[%s], minor)" % (function, index))
                 writer.error_check("end == NULL")
     writer.newline()
diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py
index 715544f..5e18aa3 100644
--- a/python_modules/ptypes.py
+++ b/python_modules/ptypes.py
@@ -60,7 +60,7 @@ class FixedSize:
 # only to attributes that affect pointer or array attributes, as these
 # are member local types, unlike e.g. a Struct that may be used by
 # other members
-propagated_attributes=["ptr_array", "c_ptr", "nonnull", "chunk"]
+propagated_attributes=["ptr_array", "nonnull", "chunk"]
 
 class Type:
     def __init__(self):
@@ -469,7 +469,10 @@ class PointerType(Type):
         return self.pointer_size
 
     def c_type(self):
-        return "SPICE_ADDRESS"
+        if self.pointer_size == 4:
+            return "uint32_t"
+        else:
+            return "uint64_t"
 
     def has_pointer(self):
         return True
diff --git a/spice.proto b/spice.proto
index bd56eb2..f6aa34e 100644
--- a/spice.proto
+++ b/spice.proto
@@ -400,7 +400,7 @@ struct Clip {
     clip_type type;
     switch (type) {
     case RECTS:
-        ClipRects *rects @outvar(cliprects) @c_ptr @marshall @nonnull;
+        ClipRects *rects @outvar(cliprects) @marshall @nonnull;
     } u @anon;
 };
 
@@ -437,7 +437,7 @@ struct BitmapData {
     case PAL_FROM_CACHE:
 	uint64 palette_id;
     default:
-	Palette *palette @outvar(bitmap) @c_ptr;
+	Palette *palette @outvar(bitmap);
     } pal @anon;
     uint8 *data[image_size(8, stride, y)] @chunk; /* pointer to array, not array of pointers as in C */
 } @ctype(SpiceBitmap);
@@ -454,7 +454,7 @@ struct LZPLTData {
     case PAL_FROM_CACHE:
 	uint64 palette_id;
     default:
-	Palette *palette @nonnull @outvar(lzplt) @c_ptr;
+	Palette *palette @nonnull @outvar(lzplt);
     } pal @anon;
     uint8 data[data_size] @nomarshal @chunk;
 };
@@ -508,7 +508,7 @@ struct Image {
 };
 
 struct Pattern {
-    Image *pat @nonnull @c_ptr;
+    Image *pat @nonnull;
     Point pos;
 };
 
@@ -525,7 +525,7 @@ struct Brush {
 struct QMask {
     mask_flags flags;
     Point pos;
-    Image *bitmap @c_ptr;
+    Image *bitmap;
 };
 
 struct LineAttr {
@@ -536,7 +536,7 @@ struct LineAttr {
    } u1 @anon;
    switch (flags) {
    case STYLED:
-        fixed28_4 *style[style_nseg] @c_ptr;
+        fixed28_4 *style[style_nseg];
    } u2 @anon;
 };
 
@@ -654,7 +654,7 @@ channel DisplayChannel : BaseChannel {
     message {
 	DisplayBase base;
 	struct Opaque {
-	    Image *src_bitmap @c_ptr;
+	    Image *src_bitmap;
 	    Rect src_area;
 	    Brush brush;
 	    ropd rop_descriptor;
@@ -666,7 +666,7 @@ channel DisplayChannel : BaseChannel {
     message {
 	DisplayBase base;
 	struct Copy {
-	    Image *src_bitmap @c_ptr;
+	    Image *src_bitmap;
 	    Rect src_area;
 	    ropd rop_descriptor;
 	    image_scale_mode scale_mode;
@@ -677,7 +677,7 @@ channel DisplayChannel : BaseChannel {
     message {
 	DisplayBase base;
 	struct Blend {
-	    Image *src_bitmap @c_ptr;
+	    Image *src_bitmap;
 	    Rect src_area;
 	    ropd rop_descriptor;
 	    image_scale_mode scale_mode;
@@ -709,7 +709,7 @@ channel DisplayChannel : BaseChannel {
     message {
 	DisplayBase base;
 	struct Rop3 {
-	    Image *src_bitmap @c_ptr;
+	    Image *src_bitmap;
 	    Rect src_area;
 	    Brush brush;
 	    uint8 rop3;
@@ -721,7 +721,7 @@ channel DisplayChannel : BaseChannel {
     message {
 	DisplayBase base;
 	struct Stroke {
-	    Path *path @c_ptr @marshall @nonnull;
+	    Path *path @marshall @nonnull;
 	    LineAttr attr;
 	    Brush brush;
 	    uint16 fore_mode;
@@ -744,7 +744,7 @@ channel DisplayChannel : BaseChannel {
     message {
 	DisplayBase base;
 	struct Transparent {
-	    Image *src_bitmap @c_ptr;
+	    Image *src_bitmap;
 	    Rect src_area;
 	    uint32 src_color;
 	    uint32 true_color;
@@ -756,7 +756,7 @@ channel DisplayChannel : BaseChannel {
 	struct AlphaBlnd {
 	    alpha_flags alpha_flags;
 	    uint8 alpha;
-	    Image *src_bitmap @c_ptr;
+	    Image *src_bitmap;
 	    Rect src_area;
 	} data;
     } draw_alpha_blend;
diff --git a/spice1.proto b/spice1.proto
index 23ce9f1..d1efb55 100644
--- a/spice1.proto
+++ b/spice1.proto
@@ -382,7 +382,7 @@ struct Clip {
     clip_type type;
     switch (type) {
     case RECTS:
-        ClipRects *rects @outvar(cliprects) @c_ptr;
+        ClipRects *rects @outvar(cliprects);
     default:
         uint64 data @zero;
     } u @anon;
@@ -421,7 +421,7 @@ struct BitmapData {
     case PAL_FROM_CACHE:
 	uint64 palette_id;
     default:
-	Palette *palette @outvar(bitmap) @c_ptr;
+	Palette *palette @outvar(bitmap);
     } pal @anon;
     uint8 *data[image_size(8, stride, y)] @chunk; /* pointer to array, not array of pointers as in C */
 } @ctype(SpiceBitmap);
@@ -438,7 +438,7 @@ struct LZPLTData {
     case PAL_FROM_CACHE:
 	uint64 palette_id;
     default:
-	Palette *palette @nonnull @outvar(lzplt) @c_ptr;
+	Palette *palette @nonnull @outvar(lzplt);
     } pal @anon;
     uint8 data[data_size] @nomarshal @chunk;
 };
@@ -466,7 +466,7 @@ struct Image {
 };
 
 struct Pattern {
-    Image *pat @nonnull @c_ptr;
+    Image *pat @nonnull;
     Point pos;
 };
 
@@ -483,7 +483,7 @@ struct Brush {
 struct QMask {
     mask_flags flags;
     Point pos;
-    Image *bitmap @c_ptr;
+    Image *bitmap;
 };
 
 struct LineAttr {
@@ -493,7 +493,7 @@ struct LineAttr {
     uint8 style_nseg;
     fixed28_4 width @zero;
     fixed28_4 miter_limit @zero;
-    fixed28_4 *style[style_nseg] @c_ptr;
+    fixed28_4 *style[style_nseg];
 };
 
 struct RasterGlyphA1 {
@@ -611,7 +611,7 @@ channel DisplayChannel : BaseChannel {
     message {
 	DisplayBase base;
 	struct Opaque {
-	    Image *src_bitmap @c_ptr;
+	    Image *src_bitmap;
 	    Rect src_area;
 	    Brush brush;
 	    ropd rop_descriptor;
@@ -623,7 +623,7 @@ channel DisplayChannel : BaseChannel {
     message {
 	DisplayBase base;
 	struct Copy {
-	    Image *src_bitmap @c_ptr;
+	    Image *src_bitmap;
 	    Rect src_area;
 	    ropd rop_descriptor;
 	    image_scale_mode scale_mode;
@@ -634,7 +634,7 @@ channel DisplayChannel : BaseChannel {
     message {
 	DisplayBase base;
 	struct Blend {
-	    Image *src_bitmap @c_ptr;
+	    Image *src_bitmap;
 	    Rect src_area;
 	    ropd rop_descriptor;
 	    image_scale_mode scale_mode;
@@ -666,7 +666,7 @@ channel DisplayChannel : BaseChannel {
     message {
 	DisplayBase base;
 	struct Rop3 {
-	    Image *src_bitmap @c_ptr;
+	    Image *src_bitmap;
 	    Rect src_area;
 	    Brush brush;
 	    uint8 rop3;
@@ -701,7 +701,7 @@ channel DisplayChannel : BaseChannel {
     message {
 	DisplayBase base;
 	struct Transparent {
-	    Image *src_bitmap @c_ptr;
+	    Image *src_bitmap;
 	    Rect src_area;
 	    uint32 src_color;
 	    uint32 true_color;
@@ -713,7 +713,7 @@ channel DisplayChannel : BaseChannel {
 	struct AlphaBlnd {
 	    int8 alpha_flags @virtual(0);
 	    uint8 alpha;
-	    Image *src_bitmap @c_ptr;
+	    Image *src_bitmap;
 	    Rect src_area;
 	} data;
     } draw_alpha_blend;
commit 31d2d6e4e485f1addece7139c82b4f3e64b1bd91
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Jul 8 12:43:33 2010 +0200

    Properly parse QXLLineAttrs.style

diff --git a/common/canvas_base.c b/common/canvas_base.c
index a1378a0..6a0c09c 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -3027,7 +3027,7 @@ static void canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox,
 
     dashed = 0;
     if (stroke->attr.flags & SPICE_LINE_FLAGS_STYLED) {
-        SPICE_FIXED28_4 *style = (SPICE_FIXED28_4*)SPICE_GET_ADDRESS(stroke->attr.style);
+        SPICE_FIXED28_4 *style = stroke->attr.style;
         int nseg;
 
         dashed = 1;
diff --git a/common/gdi_canvas.c b/common/gdi_canvas.c
index 9c52002..845ddd5 100644
--- a/common/gdi_canvas.c
+++ b/common/gdi_canvas.c
@@ -1590,9 +1590,8 @@ static void gdi_canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox, Spi
     }
 }
 
-static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, uint8_t nseg, SPICE_ADDRESS addr, int start_is_gap)
+static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, uint8_t nseg, SPICE_FIXED28_4* style, int start_is_gap)
 {
-    SPICE_FIXED28_4* style = (SPICE_FIXED28_4*)SPICE_GET_ADDRESS(addr);
     double offset = 0;
     uint32_t *local_style;
     int i;
diff --git a/server/red_parse_qxl.c b/server/red_parse_qxl.c
index ee099a0..85caa88 100644
--- a/server/red_parse_qxl.c
+++ b/server/red_parse_qxl.c
@@ -557,24 +557,35 @@ static void red_put_rop3(SpiceRop3 *red)
 static void red_get_stroke_ptr(RedMemSlotInfo *slots, int group_id,
                                SpiceStroke *red, QXLStroke *qxl)
 {
-   red->path = red_get_path(slots, group_id, qxl->path);
-   red->attr.flags       = qxl->attr.flags;
-   if (red->attr.flags & SPICE_LINE_FLAGS_STYLED) {
-       red->attr.style_nseg  = qxl->attr.style_nseg;
-       red->attr.style       = qxl->attr.style;
-   } else {
-       red->attr.style_nseg  = 0;
-       red->attr.style       = 0;
-   }
-   red_get_brush_ptr(slots, group_id, &red->brush, &qxl->brush);
-   red->fore_mode        = qxl->fore_mode;
-   red->back_mode        = qxl->back_mode;
+    red->path = red_get_path(slots, group_id, qxl->path);
+    red->attr.flags       = qxl->attr.flags;
+    if (red->attr.flags & SPICE_LINE_FLAGS_STYLED) {
+        int style_nseg;
+        uint8_t *buf;
+
+        style_nseg = qxl->attr.style_nseg;
+        red->attr.style = spice_malloc_n(style_nseg, sizeof(SPICE_FIXED28_4));
+        red->attr.style_nseg  = style_nseg;
+        ASSERT(qxl->attr.style);
+        buf = (uint8_t *)get_virt(slots, qxl->attr.style,
+                                  style_nseg * sizeof(QXLFIXED), group_id);
+        memcpy(red->attr.style, buf, style_nseg * sizeof(QXLFIXED));
+    } else {
+        red->attr.style_nseg  = 0;
+        red->attr.style       = NULL;
+    }
+    red_get_brush_ptr(slots, group_id, &red->brush, &qxl->brush);
+    red->fore_mode        = qxl->fore_mode;
+    red->back_mode        = qxl->back_mode;
 }
 
 static void red_put_stroke(SpiceStroke *red)
 {
     red_put_brush(&red->brush);
     free(red->path);
+    if (red->attr.flags & SPICE_LINE_FLAGS_STYLED) {
+        free(red->attr.style);
+    }
 }
 
 static SpiceString *red_get_string(RedMemSlotInfo *slots, int group_id,
diff --git a/server/red_worker.c b/server/red_worker.c
index 8c36c13..e95d51a 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -4093,33 +4093,10 @@ static void localize_mask(RedWorker *worker, SpiceQMask *mask, SpiceImage *image
     }
 }
 
-static void localize_attr(RedWorker *worker, SpiceLineAttr *attr, uint32_t group_id)
-{
-    if (attr->style_nseg) {
-        uint8_t *buf;
-        uint8_t *data;
-
-        ASSERT(attr->style);
-        buf = (uint8_t *)get_virt(&worker->mem_slots, attr->style, attr->style_nseg * sizeof(uint32_t),
-                                  group_id);
-        data = spice_malloc_n(attr->style_nseg, sizeof(uint32_t));
-        memcpy(data, buf, attr->style_nseg * sizeof(uint32_t));
-        attr->style = (QXLPHYSICAL)data;
-    }
-}
-
-static void unlocalize_attr(SpiceLineAttr *attr)
-{
-    if (attr->style_nseg) {
-        free((void *)attr->style);
-        attr->style = 0;
-    }
-}
-
 static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
 {
     RedSurface *surface;
-    SpiceCanvas *canvas; 
+    SpiceCanvas *canvas;
     SpiceClip clip = drawable->red_drawable->clip;
 
     surface = &worker->surfaces[drawable->surface_id];
@@ -4227,10 +4204,8 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
         SpiceStroke stroke = drawable->red_drawable->u.stroke;
         SpiceImage img1;
         localize_brush(worker, &stroke.brush, &img1);
-        localize_attr(worker, &stroke.attr, drawable->group_id);
         canvas->ops->draw_stroke(canvas,
                                  &drawable->red_drawable->bbox, &clip, &stroke);
-        unlocalize_attr(&stroke.attr);
         break;
     }
     case QXL_DRAW_TEXT: {
@@ -6388,15 +6363,11 @@ static void fill_mask(DisplayChannel *display_channel, SpiceMarshaller *m,
 
 static void fill_attr(DisplayChannel *display_channel, SpiceMarshaller *m, SpiceLineAttr *attr, uint32_t group_id)
 {
-    RedChannel *channel = &display_channel->base;
-    uint32_t *style;
     int i;
 
     if (m && attr->style_nseg) {
-        style = (uint32_t *)get_virt(&channel->worker->mem_slots, attr->style,
-                                     attr->style_nseg * sizeof(uint32_t), group_id);
         for (i = 0 ; i < attr->style_nseg; i++) {
-            spice_marshaller_add_uint32(m, style[i]);
+            spice_marshaller_add_uint32(m, attr->style[i]);
         }
     }
 }
diff --git a/spice.proto b/spice.proto
index e16250f..bd56eb2 100644
--- a/spice.proto
+++ b/spice.proto
@@ -536,7 +536,7 @@ struct LineAttr {
    } u1 @anon;
    switch (flags) {
    case STYLED:
-        fixed28_4 *style[style_nseg];
+        fixed28_4 *style[style_nseg] @c_ptr;
    } u2 @anon;
 };
 
diff --git a/spice1.proto b/spice1.proto
index 7bbccb7..23ce9f1 100644
--- a/spice1.proto
+++ b/spice1.proto
@@ -493,7 +493,7 @@ struct LineAttr {
     uint8 style_nseg;
     fixed28_4 width @zero;
     fixed28_4 miter_limit @zero;
-    fixed28_4 *style[style_nseg];
+    fixed28_4 *style[style_nseg] @c_ptr;
 };
 
 struct RasterGlyphA1 {


More information about the Spice-commits mailing list