[Spice-devel] [PATCH 6/8] Move surface in use check to helper function

alexl at redhat.com alexl at redhat.com
Fri Aug 20 11:54:38 PDT 2010


From: Alexander Larsson <alexl at redhat.com>

This way we can change the surface in use implementation later.
---
 display/surface.c |    2 +-
 display/surface.h |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/display/surface.c b/display/surface.c
index d9fc6f4..adbbe14 100644
--- a/display/surface.c
+++ b/display/surface.c
@@ -163,7 +163,7 @@ VOID DeleteDeviceBitmap(PDev *pdev, UINT32 surface_id, UINT8 allocation_type)
     FreeDrawArea(drawarea);
 
     if (allocation_type != DEVICE_BITMAP_ALLOCATION_TYPE_SURF0 &&
-        pdev->Res.surfaces_used[surface_id]) {
+        SurfaceInUse(pdev, surface_id)) {
         QXLSurfaceCmd *surface;
 
         surface = SurfaceCmd(pdev, QXL_SURFACE_CMD_DESTROY, surface_id);
diff --git a/display/surface.h b/display/surface.h
index dfda502..14c67b0 100644
--- a/display/surface.h
+++ b/display/surface.h
@@ -51,6 +51,11 @@ static UINT32 GetFreeSurface(PDev *pdev)
     return 0;
 }
 
+static BOOL SurfaceInUse(PDev *pdev, UINT32 id)
+{
+  return pdev->Res.surfaces_used[id];
+}
+
 enum {
     DEVICE_BITMAP_ALLOCATION_TYPE_SURF0,
     DEVICE_BITMAP_ALLOCATION_TYPE_DEVRAM,
-- 
1.7.2.1



More information about the Spice-devel mailing list