[Spice-devel] [PATCH 2/9] qxl: pass qxl instead of surface cache to some functions

Dave Airlie airlied at gmail.com
Mon Feb 25 20:32:05 PST 2013


This is more preparation work for adding bo abstraction layer.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/qxl.h         |  4 ++--
 src/qxl_driver.c  |  2 +-
 src/qxl_surface.c | 13 +++++++------
 src/qxl_uxa.c     |  2 +-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/qxl.h b/src/qxl.h
index 941a2ad..2d1840a 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -346,10 +346,10 @@ int               qxl_ring_cons        (struct qxl_ring        *ring);
  * Surface
  */
 surface_cache_t *   qxl_surface_cache_create (qxl_screen_t *qxl);
-qxl_surface_t *	    qxl_surface_cache_create_primary (surface_cache_t *qxl,
+qxl_surface_t *	    qxl_surface_cache_create_primary (qxl_screen_t *qxl,
 						struct QXLMode *mode);
 void *              qxl_surface_get_host_bits(qxl_surface_t *surface);
-qxl_surface_t *	    qxl_surface_create (surface_cache_t *qxl,
+qxl_surface_t *	    qxl_surface_create (qxl_screen_t *qxl,
 					int	      width,
 					int	      height,
 					int	      bpp);
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index e488020..9a8de82 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -484,7 +484,7 @@ qxl_create_primary(qxl_screen_t *qxl)
     pm->y_mili = 0; // TODO
     pm->orientation = 0; // ? supported by us for single head usage? more TODO
 
-    return qxl_surface_cache_create_primary (qxl->surface_cache, &qxl->primary_mode);
+    return qxl_surface_cache_create_primary (qxl, &qxl->primary_mode);
 }
 
 static Bool
diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index 84f221b..d95054b 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -315,17 +315,17 @@ qxl_surface_recycle (surface_cache_t *cache, uint32_t id)
  * will be the containing virtual size.
  */
 qxl_surface_t *
-qxl_surface_cache_create_primary (surface_cache_t	*cache,
+qxl_surface_cache_create_primary (qxl_screen_t *qxl,
 				  struct QXLMode	*mode)
 {
     struct QXLRam *ram_header =
-	(void *)((unsigned long)cache->qxl->ram + cache->qxl->rom->ram_header_offset);
+	(void *)((unsigned long)qxl->ram + qxl->rom->ram_header_offset);
     struct QXLSurfaceCreate *create = &(ram_header->create_surface);
     pixman_format_code_t format;
     uint8_t *dev_addr;
     pixman_image_t *dev_image, *host_image;
     qxl_surface_t *surface;
-    qxl_screen_t *qxl = cache->qxl;
+    surface_cache_t *cache = qxl->surface_cache;
 
     if (mode->bits == 16)
     {
@@ -656,14 +656,15 @@ retry:
 }
 
 qxl_surface_t *
-qxl_surface_create (surface_cache_t *    cache,
+qxl_surface_create (qxl_screen_t *qxl,
 		    int			 width,
 		    int			 height,
 		    int			 bpp)
 {
     qxl_surface_t *surface;
+    surface_cache_t *cache = qxl->surface_cache;
 
-    if (!cache->qxl->enable_surfaces)
+    if (!qxl->enable_surfaces)
 	return NULL;
     
     if ((bpp & 3) != 0)
@@ -1208,7 +1209,7 @@ qxl_surface_cache_replace_all (surface_cache_t *cache, void *data)
 	int height = pixman_image_get_height (ev->image);
 	qxl_surface_t *surface;
 
-	surface = qxl_surface_create (cache, width, height, ev->bpp);
+	surface = qxl_surface_create (cache->qxl, width, height, ev->bpp);
 
 	assert (surface->host_image);
 	assert (surface->dev_image);
diff --git a/src/qxl_uxa.c b/src/qxl_uxa.c
index e81df4f..fd70488 100644
--- a/src/qxl_uxa.c
+++ b/src/qxl_uxa.c
@@ -358,7 +358,7 @@ qxl_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usage)
 	goto fallback;
     }
 
-    surface = qxl_surface_create (qxl->surface_cache, w, h, depth);
+    surface = qxl_surface_create (qxl, w, h, depth);
 
     if (surface)
     {
-- 
1.8.1.2



More information about the Spice-devel mailing list