[Spice-commits] 3 commits - display/driver.rc display/qxldd.h display/res.c

Alexander Larsson alexl at kemper.freedesktop.org
Sun Sep 12 23:39:52 PDT 2010


 display/driver.rc |    4 ++--
 display/qxldd.h   |    2 +-
 display/res.c     |    8 +++++++-
 3 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit ed9f3ffb9deb96b8aca3dbac62523f58bc434524
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Sep 9 18:20:57 2010 +0200

    Sync dll version with inf file
    
    It seems we bumped the inf file version without changing the version
    encoded in the dll.

diff --git a/display/driver.rc b/display/driver.rc
index 20b0f4f..e5ebfa2 100644
--- a/display/driver.rc
+++ b/display/driver.rc
@@ -16,12 +16,12 @@
 #define VER_FILEDESCRIPTION_STR     "Red Hat QXL Display Driver"
 #define VER_INTERNALNAME_STR        "qxldd.dll"
 #define VER_ORIGINALFILENAME_STR    VER_INTERNALNAME_STR
-#define VER_FILEVERSION_STR         "1.3.0.0"
+#define VER_FILEVERSION_STR         "1.4.0.0"
 #define VER_PRODUCTNAME_STR         "Spice"
 #define VER_PRODUCTVERSION_STR      VER_FILEVERSION_STR
 
 #undef  VER_PRODUCTVERSION
-#define VER_PRODUCTVERSION           1,3,0,0
+#define VER_PRODUCTVERSION           1,4,0,0
 
 #define VER_COMPANYNAME_STR         "Red Hat Inc."
 #define VER_LEGALCOPYRIGHT_STR      "© Red Hat Inc. All rights reserved."
commit e6b08d7efcb7157924173e43a555adab966b3eac
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Sep 9 18:14:29 2010 +0200

    Protect release_ring with malloc_sem
    
    We need to protect the release ring against concurrent access, so
    we need a semaphore for it. Since we already hold the malloc_sem in
    almost all cases we access the ring we just extend its use to cover
    all the places its used.

diff --git a/display/qxldd.h b/display/qxldd.h
index 82886a9..b225c3d 100644
--- a/display/qxldd.h
+++ b/display/qxldd.h
@@ -180,7 +180,7 @@ struct SurfaceInfo {
 
 typedef struct DevRes {   
     MspaceInfo mspaces[NUM_MSPACES];
-    HSEMAPHORE malloc_sem;
+    HSEMAPHORE malloc_sem; /* Also protects release ring */
 
     BOOL need_init;
     UINT64 free_outputs;
diff --git a/display/res.c b/display/res.c
index 71b6f80..9c60782 100644
--- a/display/res.c
+++ b/display/res.c
@@ -238,6 +238,7 @@ static void QXLSleep(PDev* pdev, int msec)
     DEBUG_PRINT((pdev, 19, "%s: 0x%lx exit\n", __FUNCTION__, pdev));
 }
 
+/* Called with malloc_sem held */
 static void WaitForReleaseRing(PDev* pdev)
 {
     int wait;
@@ -283,6 +284,7 @@ static void WaitForReleaseRing(PDev* pdev)
     DEBUG_PRINT((pdev, 16, "%s: 0x%lx, done\n", __FUNCTION__, pdev));
 }
 
+/* Called with malloc_sem held */
 static void FlushReleaseRing(PDev *pdev)
 {
     UINT64 output;
@@ -1354,11 +1356,14 @@ static CacheImage *AllocCacheImage(PDev* pdev)
 {
     RingItem *item;
     while (!(item = RingGetTail(pdev, &pdev->Res.dynamic->cache_image_lru))) {
+	/* malloc_sem protects release_ring too */
+        EngAcquireSemaphore(pdev->Res.malloc_sem);
         if (pdev->Res.free_outputs == 0 &&
             SPICE_RING_IS_EMPTY(pdev->release_ring)) {
             WaitForReleaseRing(pdev);
         }
         FlushReleaseRing(pdev);
+	EngReleaseSemaphore(pdev->Res.malloc_sem);
     }
     RingRemove(pdev, item);
     return CONTAINEROF(item, CacheImage, lru_link);
commit febcbbc2149d4ed0a86fc38440067413e12a1193
Author: Alexander Larsson <alexl at redhat.com>
Date:   Thu Sep 9 17:58:07 2010 +0200

    Don't leak resources
    
    Ensure we break from the release loop if num_to_release got to zero.
    This fixes a leak of resources as we otherwise threw away the whole list
    of things to free and started on the next one.

diff --git a/display/res.c b/display/res.c
index d466ce7..71b6f80 100644
--- a/display/res.c
+++ b/display/res.c
@@ -299,7 +299,8 @@ static void FlushReleaseRing(PDev *pdev)
             }
         }
 
-        if (SPICE_RING_IS_EMPTY(pdev->release_ring)) {
+        if (output != 0 ||
+            SPICE_RING_IS_EMPTY(pdev->release_ring)) {
             break;
         }
 


More information about the Spice-commits mailing list