[Spice-devel] [PATCH 5/6] use structs from spice-protocol qxl_dev.h

Alon Levy alevy at redhat.com
Thu Feb 10 11:05:06 PST 2011


A bunch of renames and just plain removal (where the
struct was never used):
 * s/qxl_cursor_cmd/QXLCursorCmd/
 * s/qxl_mode/QXLMode/
 * s/qxl_command/QXLCommand/
 * remove qxl_command_ext
 * s/qxl_rect/QXLRect/
 * s/qxl_release_info/QXLReleaseInfo/
 * remove QXLReleaseInfo_ext (prev qxl_release_info_ext)
 * s/qxl_clip/QXLClip/
 * s/qxl_point/QXLPoint/
 * s/qxl_pattern/QXLPattern/
 * s/qxl_point16/QXLPoint16/
 * s/qxl_brush/QXLBrush/
 * s/qxl_mask/QXLQMask/
 * s/QXL_BRUSH/SPICE_BRUSH/
 * s/QXL_IMAGE/SPICE_IMAGE/
 * s/qxl_image_descriptor/QXLImageDescriptor/
 * s/qxl_data_chunk/QXLDataChunk/
 * s/qxl_bitmap_format/SpiceBitmapFmt/
 * s/qxl_bitmap/QXLBitmap/
 * s/qxl_image/QXLImage/
 * s/qxl_fill/QXLFill/
 * s/qxl_opaque/QXLOpaque/
 * s/qxl_copy/QXLCopy/
 * s/qxl_transparent/QXLTransparent/
 * s/qxl_alpha_blend/QXLAlphaBlend/
 * s/qxl_copy_bits/QXLCopyBits/
 * s/qxl_blend/QXLBlend/
 * s/qxl_rop3/QXLRop3/
 * s/qxl_line_attr/QXLLineAttr/
 * s/qxl_stroke/QXLStroke/
 * s/qxl_text/QXLText/
 * use QXLBlackness,QXLInvers (typo needs fixing later), QXLWhiteness
 * s/QXL_CLIP_TYPE/SPICE_CLIP_TYPE/
 * s/qxl_compat_drawable/QXLCompatDrawable/
 * s/qxl_drawable/QXLDrawable/
 * s/qxl_surface_cmd/QXLSurfaceCmd/
 * remove qxl_compat_update_cmd
 * remove qxl_update_cmd
 * remove QXL_CURSOR_DEVICE_DATA_SIZE
 * s/CURSOR_TYPE/SPICE_CURSOR_TYPE/
 * s/qxl_cursor/QXLCursor/
 * s/qxl_rom/QXLRom/
 * remove QXL_SURF_TYPE_PRIMARY
 * s/qxl_surface_create/QXLSurfaceCreate/
---
 src/qxl.h         |  447 ++---------------------------------------------------
 src/qxl_cursor.c  |   24 ++--
 src/qxl_driver.c  |   30 ++--
 src/qxl_image.c   |   44 +++---
 src/qxl_surface.c |   68 ++++----
 5 files changed, 93 insertions(+), 520 deletions(-)

diff --git a/src/qxl.h b/src/qxl.h
index 8a04522..526f145 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -55,419 +55,6 @@
 
 #pragma pack(push,1)
 
-/* I/O port definitions */
-
-struct qxl_mode {
-    uint32_t id;
-    uint32_t x_res;
-    uint32_t y_res;
-    uint32_t bits;
-    uint32_t stride;
-    uint32_t x_mili;
-    uint32_t y_mili;
-    uint32_t orientation;
-};
-
-struct qxl_command {
-    uint64_t data;
-    uint32_t type;
-    uint32_t pad;
-};
-
-struct qxl_command_ext {
-    struct qxl_command	cmd;
-    uint32_t		group_id;
-    uint32_t		flags;
-};
-
-struct qxl_rect {
-    uint32_t top;
-    uint32_t left;
-    uint32_t bottom;
-    uint32_t right;
-};
-
-union qxl_release_info {
-    uint64_t id;
-    uint64_t next;
-};
-
-struct qxl_release_info_ext {
-    union qxl_release_info *	info;
-    uint32_t			group_id;
-};
-
-struct qxl_clip {
-    uint32_t type;
-    uint64_t address;
-};
-
-struct qxl_point {
-    int x;
-    int y;
-};
-
-struct qxl_pattern {
-    uint64_t pat;
-    struct qxl_point pos;
-};
-
-typedef enum
-{
-    QXL_BRUSH_TYPE_NONE,
-    QXL_BRUSH_TYPE_SOLID,
-    QXL_BRUSH_TYPE_PATTERN
-} qxl_brush_type;
-
-struct qxl_brush {
-    uint32_t type;
-    union {
-	uint32_t color;
-	struct qxl_pattern pattern;
-    } u;
-};
-
-struct qxl_mask {
-    unsigned char flags;
-    struct qxl_point pos;
-    uint64_t bitmap;
-};
-
-typedef enum {
-    QXL_IMAGE_TYPE_BITMAP,
-    QXL_IMAGE_TYPE_QUIC,
-    QXL_IMAGE_TYPE_PNG,
-    QXL_IMAGE_TYPE_LZ_PLT = 100,
-    QXL_IMAGE_TYPE_LZ_RGB,
-    QXL_IMAGE_TYPE_GLZ_RGB,
-    QXL_IMAGE_TYPE_FROM_CACHE,
-    QXL_IMAGE_TYPE_SURFACE,
-    QXL_IMAGE_TYPE_JPEG,
-    QXL_IMAGE_TYPE_FROM_CACHE_LOSSLESS,
-    QXL_IMAGE_TYPE_JPEG_ALPHA
-} qxl_image_type;
-
-struct qxl_image_descriptor
-{
-    uint64_t id;
-    uint8_t type;
-    uint8_t flags;
-    uint32_t width;
-    uint32_t height;
-};
-
-struct qxl_data_chunk {
-    uint32_t data_size;
-    uint64_t prev_chunk;
-    uint64_t next_chunk;
-    uint8_t data[0];
-};
-
-typedef enum
-{
-    QXL_BITMAP_FMT_INVALID,
-    QXL_BITMAP_FMT_1BIT_LE,
-    QXL_BITMAP_FMT_1BIT_BE,
-    QXL_BITMAP_FMT_4BIT_LE,
-    QXL_BITMAP_FMT_4BIT_BE,
-    QXL_BITMAP_FMT_8BIT,
-    QXL_BITMAP_FMT_16BIT,
-    QXL_BITMAP_FMT_24BIT,
-    QXL_BITMAP_FMT_32BIT,
-    QXL_BITMAP_FMT_RGBA,
-} qxl_bitmap_format;
-
-struct qxl_bitmap {
-    uint8_t format;
-    uint8_t flags;		
-    uint32_t x;			/* actually width */
-    uint32_t y;			/* actually height */
-    uint32_t stride;		/* in bytes */
-    uint64_t palette;		/* Can be NULL */
-    uint64_t data;		/* A qxl_data_chunk that actually contains the data */
-};
-
-struct qxl_image {
-    struct qxl_image_descriptor descriptor;
-    union
-    {
-	struct qxl_bitmap bitmap;
-        uint32_t surface_id;
-    } u;
-};
-
-struct qxl_fill {
-    struct qxl_brush brush;
-    unsigned short rop_descriptor;
-    struct qxl_mask mask;
-};
-
-struct qxl_opaque {
-    uint64_t src_bitmap;
-    struct qxl_rect src_area;
-    struct qxl_brush brush;
-    unsigned short rop_descriptor;
-    unsigned char scale_mode;
-    struct qxl_mask mask;
-};
-
-struct qxl_copy {
-    uint64_t src_bitmap;
-    struct qxl_rect src_area;
-    unsigned short rop_descriptor;
-    unsigned char scale_mode;
-    struct qxl_mask mask;
-};
-
-struct qxl_transparent {
-    uint64_t src_bitmap;
-    struct qxl_rect src_area;
-    uint32_t src_color;
-    uint32_t true_color;
-};
-
-struct qxl_alpha_blend {
-    unsigned char alpha;
-    uint64_t src_bitmap;
-    struct qxl_rect src_area;
-};
-
-struct qxl_copy_bits {
-    struct qxl_point src_pos;
-};
-
-struct qxl_blend { /* same as copy */
-    uint64_t src_bitmap;
-    struct qxl_rect src_area;
-    unsigned short rop_descriptor;
-    unsigned char scale_mode;
-    struct qxl_mask mask;
-};
-
-struct qxl_rop3 {
-    uint64_t src_bitmap;
-    struct qxl_rect src_area;
-    struct qxl_brush brush;
-    unsigned char rop3;
-    unsigned char scale_mode;
-    struct qxl_mask mask;
-};
-
-struct qxl_line_attr {
-    unsigned char flags;
-    unsigned char join_style;
-    unsigned char end_style;
-    unsigned char style_nseg;
-    int width;
-    int miter_limit;
-    uint64_t style;
-};
-
-struct qxl_stroke {
-    uint64_t path;
-    struct qxl_line_attr attr;
-    struct qxl_brush brush;
-    unsigned short fore_mode;
-    unsigned short back_mode;
-};
-
-struct qxl_text {
-    uint64_t str;
-    struct qxl_rect back_area;
-    struct qxl_brush fore_brush;
-    struct qxl_brush back_brush;
-    unsigned short fore_mode;
-    unsigned short back_mode;
-};
-
-struct qxl_blackness {
-    struct qxl_mask mask;
-};
-
-struct qxl_inverse {
-    struct qxl_mask mask;
-};
-
-struct qxl_whiteness {
-    struct qxl_mask mask;
-};
-
-/* Effects */
-
-typedef enum
-{
-    QXL_CLIP_TYPE_NONE,
-    QXL_CLIP_TYPE_RECTS,
-    QXL_CLIP_TYPE_PATH,
-} qxl_clip_type;
-
-/* QXL 1 */
-struct qxl_compat_drawable {
-    union qxl_release_info	release_info;
-    uint8_t			effect;
-    uint8_t			type;
-    uint8_t			self_bitmap;
-    struct qxl_rect		bitmap_area;
-    struct qxl_rect		bbox;
-    struct qxl_clip		clip;
-    uint32_t			mm_time;
-    union {
-	struct qxl_fill		fill;
-	struct qxl_opaque	opaque;
-	struct qxl_copy		copy;
-	struct qxl_transparent	transparent;
-	struct qxl_alpha_blend	alpha_blend;
-	struct qxl_copy_bits	copy_bits;
-	struct qxl_blend	blend;
-	struct qxl_rop3		rop3;
-	struct qxl_stroke	stroke;
-	struct qxl_text		text;
-	struct qxl_blackness	blackness;
-	struct qxl_inverse	inverse;
-	struct qxl_whiteness	whiteness;
-    } u;
-};
-
-/* QXL 2 */
-struct qxl_drawable {
-    union qxl_release_info	release_info;
-    uint32_t			surface_id;
-    uint8_t			effect;
-    uint8_t			type;
-    uint8_t			self_bitmap;
-    struct qxl_rect		self_bitmap_area;
-    struct qxl_rect		bbox;
-    struct qxl_clip		clip;
-    uint32_t			mm_time;
-    int32_t			surfaces_dest[3];
-    struct qxl_rect		surfaces_rects[3];
-    union {
-	struct qxl_fill		fill;
-	struct qxl_opaque	opaque;
-	struct qxl_copy		copy;
-	struct qxl_transparent	transparent;
-	struct qxl_alpha_blend	alpha_blend;
-	struct qxl_copy_bits	copy_bits;
-	struct qxl_blend	blend;
-	struct qxl_rop3		rop3;
-	struct qxl_stroke	stroke;
-	struct qxl_text		text;
-	struct qxl_blackness	blackness;
-	struct qxl_inverse	inverse;
-	struct qxl_whiteness	whiteness;
-    } u;
-};
-
-struct qxl_surface_info
-{
-    uint32_t format;
-    uint32_t width;
-    uint32_t height;
-    int32_t stride;
-    uint64_t physical;
-};
-
-struct qxl_surface_cmd {
-    union qxl_release_info release_info;
-    uint32_t surface_id;
-    uint8_t type;
-    uint32_t flags;
-    union
-    {
-	struct qxl_surface_info surface_create;
-    } u;
-};
-    
-
-struct qxl_compat_update_cmd {
-    union qxl_release_info release_info;
-    struct qxl_rect area;
-    uint32_t update_id;
-};
-
-struct qxl_update_cmd {
-    union qxl_release_info	release_info;
-    struct qxl_rect		area;
-    uint32_t			update_id;
-    uint32_t			surface_id;
-};
-
-struct qxl_point16 {
-    int16_t x;
-    int16_t y;
-};
-
-#define QXL_CURSOR_DEVICE_DATA_SIZE 128
-
-enum {
-    CURSOR_TYPE_ALPHA,
-    CURSOR_TYPE_MONO,
-    CURSOR_TYPE_COLOR4,
-    CURSOR_TYPE_COLOR8,
-    CURSOR_TYPE_COLOR16,
-    CURSOR_TYPE_COLOR24,
-    CURSOR_TYPE_COLOR32,
-};
-
-struct qxl_cursor_header {
-    uint64_t unique;
-    uint16_t type;
-    uint16_t width;
-    uint16_t height;
-    uint16_t hot_spot_x;
-    uint16_t hot_spot_y;
-};
-
-struct qxl_cursor
-{
-    struct qxl_cursor_header header;
-    uint32_t data_size;
-    struct qxl_data_chunk chunk;
-};
-
-struct qxl_cursor_cmd {
-    union qxl_release_info release_info;
-    uint8_t type;
-    union {
-	struct {
-	    struct qxl_point16 position;
-	    unsigned char visible;
-	    uint64_t shape;
-	} set;
-	struct {
-	    uint16_t length;
-	    uint16_t frequency;
-	} trail;
-	struct qxl_point16 position;
-    } u;
-    uint8_t device_data[QXL_CURSOR_DEVICE_DATA_SIZE];
-};
-
-struct qxl_rom {
-    uint32_t magic;
-    uint32_t id;
-    uint32_t update_id;
-    uint32_t compression_level;
-    uint32_t log_level;
-    uint32_t mode;			/* qxl 1 */
-    uint32_t modes_offset;
-    uint32_t num_pages;
-    uint32_t pages_offset;		/* qxl 1 */
-    uint32_t draw_area_offset;		/* qxl 1 */
-    uint32_t surface0_area_size;	/* qxl 1 name: draw_area_size */
-    uint32_t ram_header_offset;
-    uint32_t mm_clock;
-    /* Appended for qxl-2 */
-    uint32_t n_surfaces;
-    uint64_t flags;
-    uint8_t  slots_start;
-    uint8_t  slots_end;
-    uint8_t  slot_gen_bits;
-    uint8_t  slot_id_bits;
-    uint8_t  slot_generation;
-    uint8_t padding[3];
-};
-
 struct qxl_ring_header {
     uint32_t num_items;
     uint32_t prod;
@@ -476,20 +63,6 @@ struct qxl_ring_header {
     uint32_t notify_on_cons;
 };
 
-#define QXL_SURF_TYPE_PRIMARY 0
-
-struct qxl_surface_create {
-    uint32_t	width;
-    uint32_t	height;
-    int32_t	stride;
-    uint32_t	depth;
-    uint32_t	position;
-    uint32_t	mouse_mode;
-    uint32_t	flags;
-    uint32_t	type;
-    uint64_t	mem;
-};
-
 #define QXL_LOG_BUF_SIZE 4096
 
 struct qxl_ram_header {
@@ -498,17 +71,17 @@ struct qxl_ram_header {
     uint32_t			int_mask;
     unsigned char		log_buf[QXL_LOG_BUF_SIZE];
     struct qxl_ring_header	cmd_ring_hdr;
-    struct qxl_command		cmd_ring[32];
+    struct QXLCommand		cmd_ring[32];
     struct qxl_ring_header	cursor_ring_hdr;
-    struct qxl_command		cursor_ring[32];
+    struct QXLCommand		cursor_ring[32];
     struct qxl_ring_header	release_ring_hdr;
     uint64_t			release_ring[8];
-    struct qxl_rect		update_area;
+    struct QXLRect		update_area;
     /* appended for qxl-2 */
     uint32_t			update_surface;
     uint64_t			mem_slot_start;
     uint64_t			mem_slot_end;
-    struct qxl_surface_create	create_surface;
+    struct QXLSurfaceCreate	create_surface;
     uint64_t			flags;
 };
 
@@ -536,14 +109,14 @@ struct _qxl_screen_t
     void *			ram_physical;
     void *			vram;	/* Surface RAM */
     void *			vram_physical;
-    struct qxl_rom *		rom;    /* Parameter RAM */
+    struct QXLRom *		rom;    /* Parameter RAM */
     
     struct qxl_ring *		command_ring;
     struct qxl_ring *		cursor_ring;
     struct qxl_ring *		release_ring;
     
     int				num_modes;
-    struct qxl_mode *		modes;
+    struct QXLMode *		modes;
     int				io_base;
     void *			surface0_area;
     long			surface0_size;
@@ -553,7 +126,7 @@ struct _qxl_screen_t
     int				virtual_y;
     void *			fb;
     int				stride;
-    struct qxl_mode *		current_mode;
+    struct QXLMode *		current_mode;
     qxl_surface_t *		primary;
     
     int				bytes_per_pixel;
@@ -664,7 +237,7 @@ void              qxl_ring_wait_idle   (struct qxl_ring        *ring);
  */
 surface_cache_t *   qxl_surface_cache_create (qxl_screen_t *qxl);
 qxl_surface_t *	    qxl_surface_cache_create_primary (surface_cache_t *qxl,
-						struct qxl_mode *mode);
+						struct QXLMode *mode);
 qxl_surface_t *	    qxl_surface_create (surface_cache_t *qxl,
 					int	      width,
 					int	      height,
@@ -748,7 +321,7 @@ get_ram_header (qxl_screen_t *qxl)
 /*
  * Images
  */
-struct qxl_image *qxl_image_create     (qxl_screen_t           *qxl,
+struct QXLImage *qxl_image_create     (qxl_screen_t           *qxl,
 					const uint8_t          *data,
 					int                     x,
 					int                     y,
@@ -757,7 +330,7 @@ struct qxl_image *qxl_image_create     (qxl_screen_t           *qxl,
 					int                     stride,
 					int                     Bpp);
 void              qxl_image_destroy    (qxl_screen_t           *qxl,
-					struct qxl_image       *image);
+					struct QXLImage       *image);
 void		  qxl_drop_image_cache (qxl_screen_t	       *qxl);
 
 
diff --git a/src/qxl_cursor.c b/src/qxl_cursor.c
index 836a3f3..c42e8fa 100644
--- a/src/qxl_cursor.c
+++ b/src/qxl_cursor.c
@@ -20,7 +20,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  */
-/** \file qxl_image.c
+/** \file qxl_cursor.c
  * \author Søren Sandmann <sandmann at redhat.com>
  */
 
@@ -29,9 +29,9 @@
 #include <cursorstr.h>
 
 static void
-push_cursor (qxl_screen_t *qxl, struct qxl_cursor_cmd *cursor)
+push_cursor (qxl_screen_t *qxl, struct QXLCursorCmd *cursor)
 {
-    struct qxl_command cmd;
+    struct QXLCommand cmd;
 
     /* See comment on push_command() in qxl_driver.c */
     if (qxl->pScrn->vtSema)
@@ -43,11 +43,11 @@ push_cursor (qxl_screen_t *qxl, struct qxl_cursor_cmd *cursor)
     }
 }
 
-static struct qxl_cursor_cmd *
+static struct QXLCursorCmd *
 qxl_alloc_cursor_cmd(qxl_screen_t *qxl)
 {
-    struct qxl_cursor_cmd *cmd =
-	qxl_allocnf (qxl, sizeof(struct qxl_cursor_cmd));
+    struct QXLCursorCmd *cmd =
+	qxl_allocnf (qxl, sizeof(struct QXLCursorCmd));
 
     cmd->release_info.id = pointer_to_u64 (cmd) | 1;
     
@@ -58,7 +58,7 @@ static void
 qxl_set_cursor_position(ScrnInfoPtr pScrn, int x, int y)
 {
     qxl_screen_t *qxl = pScrn->driverPrivate;
-    struct qxl_cursor_cmd *cmd = qxl_alloc_cursor_cmd(qxl);
+    struct QXLCursorCmd *cmd = qxl_alloc_cursor_cmd(qxl);
 
     qxl->cur_x = x;
     qxl->cur_y = y;
@@ -89,12 +89,12 @@ qxl_load_cursor_argb (ScrnInfoPtr pScrn, CursorPtr pCurs)
     int h = pCurs->bits->height;
     int size = w * h * sizeof (CARD32);
 
-    struct qxl_cursor_cmd *cmd = qxl_alloc_cursor_cmd (qxl);
-    struct qxl_cursor *cursor =
-	qxl_allocnf(qxl, sizeof(struct qxl_cursor) + size);
+    struct QXLCursorCmd *cmd = qxl_alloc_cursor_cmd (qxl);
+    struct QXLCursor *cursor =
+	qxl_allocnf(qxl, sizeof(struct QXLCursor) + size);
 
     cursor->header.unique = 0;
-    cursor->header.type = CURSOR_TYPE_ALPHA;
+    cursor->header.type = SPICE_CURSOR_TYPE_ALPHA;
     cursor->header.width = w;
     cursor->header.height = h;
     /* I wonder if we can just tell the client that the hotspot is 0, 0
@@ -156,7 +156,7 @@ static void
 qxl_hide_cursor(ScrnInfoPtr pScrn)
 {
     qxl_screen_t *qxl = pScrn->driverPrivate;
-    struct qxl_cursor_cmd *cursor = qxl_alloc_cursor_cmd(qxl);
+    struct QXLCursorCmd *cursor = qxl_alloc_cursor_cmd(qxl);
 
     cursor->type = QXL_CURSOR_HIDE;
 
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index d1ad499..b6a5e4e 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -58,10 +58,10 @@ qxl_garbage_collect (qxl_screen_t *qxl)
 	     */
 #define POINTER_MASK ((1 << 2) - 1)
 	    
-	    union qxl_release_info *info = u64_to_pointer (id & ~POINTER_MASK);
-	    struct qxl_cursor_cmd *cmd = (struct qxl_cursor_cmd *)info;
-	    struct qxl_drawable *drawable = (struct qxl_drawable *)info;
-	    struct qxl_surface_cmd *surface_cmd = (struct qxl_surface_cmd *)info;
+	    union QXLReleaseInfo *info = u64_to_pointer (id & ~POINTER_MASK);
+	    struct QXLCursorCmd *cmd = (struct QXLCursorCmd *)info;
+	    struct QXLDrawable *drawable = (struct qxl_drawable *)info;
+	    struct QXLSurfaceCmd *surface_cmd = (struct QXLSurfaceCmd *)info;
 	    int is_cursor = FALSE;
 	    int is_surface = FALSE;
 	    int is_drawable = FALSE;
@@ -75,19 +75,19 @@ qxl_garbage_collect (qxl_screen_t *qxl)
 
 	    if (is_cursor && cmd->type == QXL_CURSOR_SET)
 	    {
-		struct qxl_cursor *cursor = (void *)virtual_address (
+		struct QXLCursor *cursor = (void *)virtual_address (
 		    qxl, u64_to_pointer (cmd->u.set.shape), qxl->main_mem_slot);
 		
 		qxl_free (qxl->mem, cursor);
 	    }
 	    else if (is_drawable && drawable->type == QXL_DRAW_COPY)
 	    {
-		struct qxl_image *image = virtual_address (
+		struct QXLImage *image = virtual_address (
 		    qxl, u64_to_pointer (drawable->u.copy.src_bitmap), qxl->main_mem_slot);
 		
-		if (image->descriptor.type == QXL_IMAGE_TYPE_SURFACE)
+		if (image->descriptor.type == SPICE_IMAGE_TYPE_SURFACE)
 		{
-		    qxl_surface_unref (qxl->surface_cache, image->u.surface_id);
+		    qxl_surface_unref (qxl->surface_cache, image->surface_image.surface_id);
 		    qxl_surface_cache_sanity_check (qxl->surface_cache);
 		    qxl_free (qxl->mem, image);
 		}
@@ -281,7 +281,7 @@ qxl_map_memory(qxl_screen_t *qxl, int scrnIndex)
     xf86DrvMsg(scrnIndex, X_INFO, "rom at %p\n", qxl->rom);
     
     qxl->num_modes = *(uint32_t *)((uint8_t *)qxl->rom + qxl->rom->modes_offset);
-    qxl->modes = (struct qxl_mode *)(((uint8_t *)qxl->rom) + qxl->rom->modes_offset + 4);
+    qxl->modes = (struct QXLMode *)(((uint8_t *)qxl->rom) + qxl->rom->modes_offset + 4);
     qxl->surface0_area = qxl->ram;
     qxl->surface0_size = qxl->rom->surface0_area_size;
 
@@ -429,7 +429,7 @@ qxl_switch_mode(int scrnIndex, DisplayModePtr p, int flags)
 {
     qxl_screen_t *qxl = xf86Screens[scrnIndex]->driverPrivate;
     int mode_index = (int)(unsigned long)p->Private;
-    struct qxl_mode *m = qxl->modes + mode_index;
+    struct QXLMode *m = qxl->modes + mode_index;
     ScreenPtr pScreen;
     void *evacuated;
 
@@ -904,10 +904,10 @@ qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     qxl->io_pages_physical = (void *)((unsigned long)qxl->ram_physical);
     
     qxl->command_ring = qxl_ring_create (&(ram_header->cmd_ring_hdr),
-					 sizeof (struct qxl_command),
+					 sizeof (struct QXLCommand),
 					 32, qxl->io_base + QXL_IO_NOTIFY_CMD);
     qxl->cursor_ring = qxl_ring_create (&(ram_header->cursor_ring_hdr),
-					sizeof (struct qxl_command),
+					sizeof (struct QXLCommand),
 					32, qxl->io_base + QXL_IO_NOTIFY_CURSOR);
     qxl->release_ring = qxl_ring_create (&(ram_header->release_ring_hdr),
 					 sizeof (uint64_t),
@@ -1013,7 +1013,7 @@ print_modes (qxl_screen_t *qxl, int scrnIndex)
     
     for (i = 0; i < qxl->num_modes; ++i)
     {
-	struct qxl_mode *m = qxl->modes + i;
+	struct QXLMode *m = qxl->modes + i;
 	
 	xf86DrvMsg (scrnIndex, X_INFO,
 		    "%d: %dx%d, %d bits, stride %d, %dmm x %dmm, orientation %d\n",
@@ -1026,7 +1026,7 @@ static Bool
 qxl_check_device(ScrnInfoPtr pScrn, qxl_screen_t *qxl)
 {
     int scrnIndex = pScrn->scrnIndex;
-    struct qxl_rom *rom = qxl->rom;
+    struct QXLRom *rom = qxl->rom;
     struct qxl_ram_header *ram_header = (void *)((unsigned long)qxl->ram + rom->ram_header_offset);
     
     CHECK_POINT();
@@ -1077,7 +1077,7 @@ qxl_find_native_mode(ScrnInfoPtr pScrn, DisplayModePtr p)
     
     for (i = 0; i < qxl->num_modes; i++) 
     {
-	struct qxl_mode *m = qxl->modes + i;
+	struct QXLMode *m = qxl->modes + i;
 	
 	if (m->x_res == p->HDisplay &&
 	    m->y_res == p->VDisplay &&
diff --git a/src/qxl_image.c b/src/qxl_image.c
index 2e1a70b..04074d0 100644
--- a/src/qxl_image.c
+++ b/src/qxl_image.c
@@ -20,7 +20,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  */
-/** \file qxl_image.c
+/** \file QXLImage.c
  * \author Søren Sandmann <sandmann at redhat.com>
  */
 
@@ -34,7 +34,7 @@ typedef struct image_info_t image_info_t;
 
 struct image_info_t
 {
-    struct qxl_image *image;
+    struct QXLImage *image;
     int ref_count;
     image_info_t *next;
 };
@@ -74,7 +74,7 @@ lookup_image_info (unsigned int hash,
 
     while (info)
     {
-	struct qxl_image *image = info->image;
+	struct QXLImage *image = info->image;
 
 	if (image->descriptor.id == hash		&&
 	    image->descriptor.width == width		&&
@@ -121,7 +121,7 @@ remove_image_info (image_info_t *info)
     free (info);
 }
 
-struct qxl_image *
+struct QXLImage *
 qxl_image_create (qxl_screen_t *qxl, const uint8_t *data,
 		  int x, int y, int width, int height,
 		  int stride, int Bpp)
@@ -146,11 +146,11 @@ qxl_image_create (qxl_screen_t *qxl, const uint8_t *data,
 
 	for (i = 0; i < height; ++i)
 	{
-	    struct qxl_data_chunk *chunk;
+	    struct QXLDataChunk *chunk;
 	    const uint8_t *src_line = data + i * stride;
 	    uint32_t *dest_line;
 		
-	    chunk = virtual_address (qxl, u64_to_pointer (info->image->u.bitmap.data), qxl->main_mem_slot);
+	    chunk = virtual_address (qxl, u64_to_pointer (info->image->bitmap.data), qxl->main_mem_slot);
 	    
 	    dest_line = (uint32_t *)chunk->data + width * i;
 
@@ -173,8 +173,8 @@ qxl_image_create (qxl_screen_t *qxl, const uint8_t *data,
     }
     else
     {
-	struct qxl_image *image;
-	struct qxl_data_chunk *chunk;
+	struct QXLImage *image;
+	struct QXLDataChunk *chunk;
 	int dest_stride = width * Bpp;
 
 #if 0
@@ -198,7 +198,7 @@ qxl_image_create (qxl_screen_t *qxl, const uint8_t *data,
 	image = qxl_allocnf (qxl, sizeof *image);
 
 	image->descriptor.id = 0;
-	image->descriptor.type = QXL_IMAGE_TYPE_BITMAP;
+	image->descriptor.type = SPICE_IMAGE_TYPE_BITMAP;
 	
 	image->descriptor.flags = 0;
 	image->descriptor.width = width;
@@ -206,25 +206,25 @@ qxl_image_create (qxl_screen_t *qxl, const uint8_t *data,
 
 	if (Bpp == 2)
 	{
-	    image->u.bitmap.format = QXL_BITMAP_FMT_16BIT;
+	    image->bitmap.format = SPICE_BITMAP_FMT_16BIT;
 	}
 	else if (Bpp == 1)
 	{
-	    image->u.bitmap.format = QXL_BITMAP_FMT_8BIT;
+	    image->bitmap.format = SPICE_BITMAP_FMT_8BIT;
 	}
 	else if (Bpp == 4)
 	{
-	    image->u.bitmap.format = QXL_BITMAP_FMT_32BIT;
+	    image->bitmap.format = SPICE_BITMAP_FMT_32BIT;
 	}
 	else
 	  abort();
 
-	image->u.bitmap.flags = QXL_BITMAP_TOP_DOWN;
-	image->u.bitmap.x = width;
-	image->u.bitmap.y = height;
-	image->u.bitmap.stride = width * Bpp;
-	image->u.bitmap.palette = 0;
-	image->u.bitmap.data = physical_address (qxl, chunk, qxl->main_mem_slot);
+	image->bitmap.flags = SPICE_BITMAP_FLAGS_TOP_DOWN;
+	image->bitmap.x = width;
+	image->bitmap.y = height;
+	image->bitmap.stride = width * Bpp;
+	image->bitmap.palette = 0;
+	image->bitmap.data = physical_address (qxl, chunk, qxl->main_mem_slot);
 
 #if 0
 	ErrorF ("%p has size %d %d\n", image, width, height);
@@ -238,7 +238,7 @@ qxl_image_create (qxl_screen_t *qxl, const uint8_t *data,
 	    info->ref_count = 1;
 
 	    image->descriptor.id = hash;
-	    image->descriptor.flags = QXL_IMAGE_CACHE;
+	    image->descriptor.flags = SPICE_IMAGE_CACHE;
 
 #if 0
 	    ErrorF ("added with hash %u\n", hash);
@@ -252,12 +252,12 @@ qxl_image_create (qxl_screen_t *qxl, const uint8_t *data,
 
 void
 qxl_image_destroy (qxl_screen_t *qxl,
-		   struct qxl_image *image)
+		   struct QXLImage *image)
 {
-    struct qxl_data_chunk *chunk;
+    struct QXLDataChunk *chunk;
     image_info_t *info;
 
-    chunk = virtual_address (qxl, u64_to_pointer (image->u.bitmap.data), qxl->main_mem_slot);
+    chunk = virtual_address (qxl, u64_to_pointer (image->bitmap.data), qxl->main_mem_slot);
     
     info = lookup_image_info (image->descriptor.id,
 			      image->descriptor.width,
diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index f03922a..0ada697 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -227,7 +227,7 @@ print_cache_info (surface_cache_t *cache)
 }
 
 static void
-get_formats (int bpp, qxl_bitmap_format *format, pixman_format_code_t *pformat)
+get_formats (int bpp, SpiceBitmapFmt *format, pixman_format_code_t *pformat)
 {
     switch (bpp)
     {
@@ -341,11 +341,11 @@ qxl_surface_recycle (surface_cache_t *cache, uint32_t id)
 
 qxl_surface_t *
 qxl_surface_cache_create_primary (surface_cache_t	*cache,
-				  struct qxl_mode	*mode)
+				  struct QXLMode	*mode)
 {
     struct qxl_ram_header *ram_header =
 	(void *)((unsigned long)cache->qxl->ram + cache->qxl->rom->ram_header_offset);
-    struct qxl_surface_create *create = &(ram_header->create_surface);
+    struct QXLSurfaceCreate *create = &(ram_header->create_surface);
     pixman_format_code_t format;
     uint8_t *dev_addr;
     pixman_image_t *dev_image, *host_image;
@@ -370,7 +370,7 @@ qxl_surface_cache_create_primary (surface_cache_t	*cache,
     create->width = mode->x_res;
     create->height = mode->y_res;
     create->stride = - mode->stride;
-    create->depth = mode->bits;
+    create->format = mode->bits;
     create->position = 0; /* What is this? The Windows driver doesn't use it */
     create->flags = 0;
     create->type = QXL_SURF_TYPE_PRIMARY;
@@ -405,10 +405,10 @@ qxl_surface_cache_create_primary (surface_cache_t	*cache,
     return surface;
 }
 
-static struct qxl_surface_cmd *
+static struct QXLSurfaceCmd *
 make_surface_cmd (surface_cache_t *cache, uint32_t id, QXLSurfaceCmdType type)
 {
-    struct qxl_surface_cmd *cmd;
+    struct QXLSurfaceCmd *cmd;
     qxl_screen_t *qxl = cache->qxl;
 
     qxl_garbage_collect (qxl);
@@ -424,9 +424,9 @@ make_surface_cmd (surface_cache_t *cache, uint32_t id, QXLSurfaceCmdType type)
 }
 
 static void
-push_surface_cmd (surface_cache_t *cache, struct qxl_surface_cmd *cmd)
+push_surface_cmd (surface_cache_t *cache, struct QXLSurfaceCmd *cmd)
 {
-    struct qxl_command command;
+    struct QXLCommand command;
     qxl_screen_t *qxl = cache->qxl;
 
     command.type = QXL_CMD_SURFACE;
@@ -450,12 +450,12 @@ enum ROPDescriptor
     ROPD_INVERS_RES = (1 <<10),
 };
 
-static struct qxl_drawable *
+static struct QXLDrawable *
 make_drawable (qxl_screen_t *qxl, int surface, uint8_t type,
-	       const struct qxl_rect *rect
+	       const struct QXLRect *rect
 	       /* , pRegion clip */)
 {
-    struct qxl_drawable *drawable;
+    struct QXLDrawable *drawable;
     int i;
     
     drawable = qxl_allocnf (qxl, sizeof *drawable);
@@ -472,7 +472,7 @@ make_drawable (qxl_screen_t *qxl, int surface, uint8_t type,
     drawable->self_bitmap_area.bottom = 0;
     drawable->self_bitmap_area.right = 0;
     /* FIXME: add clipping */
-    drawable->clip.type = QXL_CLIP_TYPE_NONE;
+    drawable->clip.type = SPICE_CLIP_TYPE_NONE;
     
     /*
      * surfaces_dest[i] should apparently be filled out with the
@@ -492,9 +492,9 @@ make_drawable (qxl_screen_t *qxl, int surface, uint8_t type,
 }
 
 static void
-push_drawable (qxl_screen_t *qxl, struct qxl_drawable *drawable)
+push_drawable (qxl_screen_t *qxl, struct QXLDrawable *drawable)
 {
-    struct qxl_command cmd;
+    struct QXLCommand cmd;
     
     /* When someone runs "init 3", the device will be 
      * switched into VGA mode and there is nothing we
@@ -516,13 +516,13 @@ push_drawable (qxl_screen_t *qxl, struct qxl_drawable *drawable)
 
 static void
 submit_fill (qxl_screen_t *qxl, int id,
-	     const struct qxl_rect *rect, uint32_t color)
+	     const struct QXLRect *rect, uint32_t color)
 {
-    struct qxl_drawable *drawable;
+    struct QXLDrawable *drawable;
     
     drawable = make_drawable (qxl, id, QXL_DRAW_FILL, rect);
     
-    drawable->u.fill.brush.type = QXL_BRUSH_TYPE_SOLID;
+    drawable->u.fill.brush.type = SPICE_BRUSH_TYPE_SOLID;
     drawable->u.fill.brush.u.color = color;
     drawable->u.fill.rop_descriptor = ROPD_OP_PUT;
     drawable->u.fill.mask.flags = 0;
@@ -578,9 +578,9 @@ surface_send_create (surface_cache_t *cache,
 		     int	      height,
 		     int	      bpp)
 {
-    qxl_bitmap_format format;
+    SpiceBitmapFmt format;
     pixman_format_code_t pformat;
-    struct qxl_surface_cmd *cmd;
+    struct QXLSurfaceCmd *cmd;
     int stride;
     uint32_t *dev_addr;
     int n_attempts = 0;
@@ -653,7 +653,7 @@ retry2:
     cmd->u.surface_create.height = height;
     cmd->u.surface_create.stride = - stride;
 
-    cmd->u.surface_create.physical = 
+    cmd->u.surface_create.data =
       physical_address (qxl, surface->address, qxl->vram_mem_slot);
 
     push_surface_cmd (cache, cmd);
@@ -754,7 +754,7 @@ unlink_surface (qxl_surface_t *surface)
 static void
 send_destroy (qxl_surface_t *surface)
 {
-    struct qxl_surface_cmd *cmd;
+    struct QXLSurfaceCmd *cmd;
 
     if (surface->dev_image)
 	pixman_image_unref (surface->dev_image);
@@ -1010,7 +1010,7 @@ qxl_surface_prepare_access (qxl_surface_t  *surface,
 }
 
 static void
-translate_rect (struct qxl_rect *rect)
+translate_rect (struct QXLRect *rect)
 {
     rect->right -= rect->left;
     rect->bottom -= rect->top;
@@ -1020,9 +1020,9 @@ translate_rect (struct qxl_rect *rect)
 static void
 upload_box (qxl_surface_t *surface, int x1, int y1, int x2, int y2)
 {
-    struct qxl_rect rect;
-    struct qxl_drawable *drawable;
-    struct qxl_image *image;
+    struct QXLRect rect;
+    struct QXLDrawable *drawable;
+    struct QXLImage *image;
     qxl_screen_t *qxl = surface->cache->qxl;
     uint32_t *data;
     int stride;
@@ -1255,7 +1255,7 @@ qxl_surface_solid (qxl_surface_t *destination,
 		   int	          y2)
 {
     qxl_screen_t *qxl = destination->cache->qxl;
-    struct qxl_rect qrect;
+    struct QXLRect qrect;
     uint32_t p;
 
     qrect.top = y1;
@@ -1310,8 +1310,8 @@ qxl_surface_copy (qxl_surface_t *dest,
 		  int width, int height)
 {
     qxl_screen_t *qxl = dest->cache->qxl;
-    struct qxl_drawable *drawable;
-    struct qxl_rect qrect;
+    struct QXLDrawable *drawable;
+    struct QXLRect qrect;
 
 #if 0
     print_region (" copy src", &(dest->u.copy_src->access_region));
@@ -1336,15 +1336,15 @@ qxl_surface_copy (qxl_surface_t *dest,
     }
     else
     {
-	struct qxl_image *image = qxl_allocnf (qxl, sizeof *image);
+	struct QXLImage *image = qxl_allocnf (qxl, sizeof *image);
 
 	dest->u.copy_src->ref_count++;
 
 	image->descriptor.id = 0;
-	image->descriptor.type = QXL_IMAGE_TYPE_SURFACE;
+	image->descriptor.type = SPICE_IMAGE_TYPE_SURFACE;
 	image->descriptor.width = 0;
 	image->descriptor.height = 0;
-	image->u.surface_id = dest->u.copy_src->id;
+	image->surface_image.surface_id = dest->u.copy_src->id;
 
 	drawable = make_drawable (qxl, dest->id, QXL_DRAW_COPY, &qrect);
 
@@ -1397,10 +1397,10 @@ qxl_surface_put_image (qxl_surface_t *dest,
 		       int x, int y, int width, int height,
 		       const char *src, int src_pitch)
 {
-    struct qxl_drawable *drawable;
+    struct QXLDrawable *drawable;
     qxl_screen_t *qxl = dest->cache->qxl;
-    struct qxl_rect rect;
-    struct qxl_image *image;
+    struct QXLRect rect;
+    struct QXLImage *image;
     
     rect.left = x;
     rect.right = x + width;
-- 
1.7.4



More information about the Spice-devel mailing list