[Spice-devel] [PATCH 5/7] Add union to SurfaceInfo to put in next_free pointer

alexl at redhat.com alexl at redhat.com
Tue Aug 24 01:41:12 PDT 2010


From: Alexander Larsson <alexl at redhat.com>

---
 display/driver.c  |    2 +-
 display/qxldd.h   |   10 +++++++---
 display/surface.c |    2 +-
 display/surface.h |    2 +-
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/display/driver.c b/display/driver.c
index 1c8e1f6..f088df5 100644
--- a/display/driver.c
+++ b/display/driver.c
@@ -1268,7 +1268,7 @@ VOID APIENTRY DrvDeleteDeviceBitmap(DHSURF dhsurf)
     surface = (SurfaceInfo *)dhsurf;
     surface_id = GetSurfaceIdFromInfo(surface);
 
-    DeleteDeviceBitmap(surface->pdev, surface_id, DEVICE_BITMAP_ALLOCATION_TYPE_VRAM);
+    DeleteDeviceBitmap(surface->u.pdev, surface_id, DEVICE_BITMAP_ALLOCATION_TYPE_VRAM);
 }
 
 #ifdef CALL_TEST
diff --git a/display/qxldd.h b/display/qxldd.h
index 868a1a9..7c5b6ec 100644
--- a/display/qxldd.h
+++ b/display/qxldd.h
@@ -169,10 +169,14 @@ typedef struct DrawArea {
    UINT8 *base_mem;
 } DrawArea;
 
-typedef struct SurfaceInfo {
+typedef struct SurfaceInfo SurfaceInfo;
+struct SurfaceInfo {
     DrawArea draw_area;
-    PDev *pdev;
-} SurfaceInfo;
+    union {
+        PDev *pdev;
+        SurfaceInfo *next_free;
+    } u;
+};
 
 typedef struct DevRes {   
     MspaceInfo mspaces[NUM_MSPACES];
diff --git a/display/surface.c b/display/surface.c
index d9fc6f4..54e0d0c 100644
--- a/display/surface.c
+++ b/display/surface.c
@@ -119,7 +119,7 @@ HBITMAP CreateDeviceBitmap(PDev *pdev, SIZEL size, ULONG format, QXLPHYSICAL *ph
         goto out_error2;
     }
 
-    GetSurfaceInfo(pdev, surface_id)->pdev = pdev;
+    GetSurfaceInfo(pdev, surface_id)->u.pdev = pdev;
 
     QXLGetSurface(pdev, phys_mem, size.cx, size.cy, depth,
                   &stride, base_mem, allocation_type);
diff --git a/display/surface.h b/display/surface.h
index dfda502..5504793 100644
--- a/display/surface.h
+++ b/display/surface.h
@@ -7,7 +7,7 @@ static _inline UINT32 GetSurfaceIdFromInfo(SurfaceInfo *info)
 {
   PDev *pdev;
 
-  pdev = info->pdev;
+  pdev = info->u.pdev;
   if (info == &pdev->surface0_info) {
     return 0;
   }
-- 
1.7.2.1



More information about the Spice-devel mailing list