[Spice-devel] [spice-protocol PATCH 14/46] qxlhw change: qxl_surface: use qxlhw_push_surface_cmd

Alon Levy alevy at redhat.com
Tue Apr 10 04:50:10 PDT 2012


---
 src/qxl_surface.c |   44 +++++++++++++++-----------------------------
 1 file changed, 15 insertions(+), 29 deletions(-)

diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index 1747dca..137c1c7 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -356,34 +356,21 @@ qxl_surface_cache_create_primary (surface_cache_t	*cache,
     return surface;
 }
 
-static struct QXLSurfaceCmd *
-make_surface_cmd (surface_cache_t *cache, uint32_t id, QXLSurfaceCmdType type)
+static void
+init_surface_cmd (struct QXLSurfaceCmd *cmd, surface_cache_t *cache,
+                  uint32_t id, QXLSurfaceCmdType type)
 {
-    struct QXLSurfaceCmd *cmd;
-    qxl_screen_t *qxl = cache->qxl;
-
-    qxl_garbage_collect (qxl);
-    
-    cmd = qxl_allocnf (qxl, sizeof *cmd);
-
-    cmd->release_info.id = pointer_to_u64 (cmd) | 2;
     cmd->type = type;
     cmd->flags = 0;
     cmd->surface_id = id;
-    
-    return cmd;
 }
 
 static void
 push_surface_cmd (surface_cache_t *cache, struct QXLSurfaceCmd *cmd)
 {
-    struct QXLCommand command;
     qxl_screen_t *qxl = cache->qxl;
 
-    command.type = QXL_CMD_SURFACE;
-    command.data = physical_address (qxl, cmd, qxl->main_mem_slot);
-    
-    qxl_ring_push (qxl->command_ring, &command);
+    qxlhw_push_surface_cmd (qxl->hw, cmd);
 }
 
 enum ROPDescriptor
@@ -529,7 +516,7 @@ surface_send_create (surface_cache_t *cache,
 {
     SpiceBitmapFmt format;
     pixman_format_code_t pformat;
-    struct QXLSurfaceCmd *cmd;
+    struct QXLSurfaceCmd cmd;
     int stride;
     uint32_t *dev_addr;
     int n_attempts = 0;
@@ -592,17 +579,16 @@ retry:
     surface->address = address;    
     surface->end = (char *)address + stride * height;
     
-    cmd = make_surface_cmd (cache, surface->id, QXL_SURFACE_CMD_CREATE);
+    init_surface_cmd (&cmd, cache, surface->id, QXL_SURFACE_CMD_CREATE);
 
-    cmd->u.surface_create.format = format;
-    cmd->u.surface_create.width = width;
-    cmd->u.surface_create.height = height;
-    cmd->u.surface_create.stride = - stride;
+    cmd.u.surface_create.format = format;
+    cmd.u.surface_create.width = width;
+    cmd.u.surface_create.height = height;
+    cmd.u.surface_create.stride = -stride;
 
-    cmd->u.surface_create.data =
-      physical_address (qxl, surface->address, qxl->vram_mem_slot);
+    cmd.u.surface_create.data = (QXLPHYSICAL)surface->address;
 
-    push_surface_cmd (cache, cmd);
+    push_surface_cmd (cache, &cmd);
 
     dev_addr = (uint32_t *)((uint8_t *)surface->address + stride * (height - 1));
 
@@ -701,16 +687,16 @@ unlink_surface (qxl_surface_t *surface)
 static void
 send_destroy (qxl_surface_t *surface)
 {
-    struct QXLSurfaceCmd *cmd;
+    struct QXLSurfaceCmd cmd;
 
     if (surface->dev_image)
 	pixman_image_unref (surface->dev_image);
     if (surface->host_image)
 	pixman_image_unref (surface->host_image);
     
-    cmd = make_surface_cmd (surface->cache, surface->id, QXL_SURFACE_CMD_DESTROY);
+    init_surface_cmd (&cmd, surface->cache, surface->id, QXL_SURFACE_CMD_DESTROY);
     
-    push_surface_cmd (surface->cache, cmd);
+    push_surface_cmd (surface->cache, &cmd);
 }
 
 static void
-- 
1.7.9.3



More information about the Spice-devel mailing list