[Spice-devel] [spice-protocol PATCH 23/46] remove qxl_allocnf (garbage collect still used)

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


---
 src/qxl.h        |    2 --
 src/qxl_driver.c |   47 -----------------------------------------------
 2 files changed, 49 deletions(-)

diff --git a/src/qxl.h b/src/qxl.h
index ef51469..03bb74e 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -374,8 +374,6 @@ void		  qxl_drop_image_cache (qxl_screen_t	       *qxl);
 /*
  * Malloc
  */
-void *             qxl_allocnf         (qxl_screen_t *qxl,
-					unsigned long        size);
 int		   qxl_garbage_collect (qxl_screen_t *qxl);
 
 /*
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 9755c87..32b7b46 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -204,53 +204,6 @@ qxl_garbage_collect (qxl_screen_t *qxl)
     return i;
 }
 
-void *
-qxl_allocnf (qxl_screen_t *qxl, unsigned long size)
-{
-    void *result;
-    int n_attempts = 0;
-    struct QXLRect rect;
-#if 0
-    static int nth_oom = 1;
-#endif
-
-    qxl_garbage_collect (qxl);
-    
-    while (!(result = qxl_alloc (qxl->mem, size)))
-    {
-	/* Rather than go out of memory, we simply tell the
-	 * device to dump everything
-	 */
-	rect.top = 0;
-	rect.bottom = qxl->virtual_y;
-	rect.left = 0;
-	rect.right = qxl->virtual_x;
-        qxlhw_update_area(qxl->hw, 0 /* Only primary for now */, rect);
-	
-#if 0
- 	ErrorF ("eliminated memory (%d)\n", nth_oom++);
-#endif
-
-	if (!qxl_garbage_collect (qxl))
-	{
-	    if (qxlhw_handle_oom (qxl->hw))
-	    {
-		n_attempts = 0;
-	    }
-	    else if (++n_attempts == 1000)
-	    {
-		ErrorF ("Out of memory allocating %ld bytes\n", size);
-		qxl_mem_dump_stats (qxl->mem, "Out of mem - stats\n");
-		
-		fprintf (stderr, "Out of memory\n");
-		exit (1);
-	    }
-	}
-    }
-    
-    return result;
-}
-
 static Bool
 qxl_blank_screen(ScreenPtr pScreen, int mode)
 {
-- 
1.7.9.3



More information about the Spice-devel mailing list