winsys/radeon: clear the buffer cache on allocation failure and try again
authorMarek Olšák <marek.olsak@amd.com>
Wed, 9 Dec 2015 21:36:26 +0000 (22:36 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 11 Dec 2015 14:25:13 +0000 (15:25 +0100)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/winsys/radeon/drm/radeon_drm_bo.c

index 8e86f746217aba1c75659200271f4b89ac0aca0b..b9716e50229f52aa13219adcf8e79c473f11d21a 100644 (file)
@@ -767,8 +767,13 @@ radeon_winsys_bo_create(struct radeon_winsys *rws,
     }
 
     bo = radeon_create_bo(ws, size, alignment, usage, domain, flags);
-    if (!bo)
-        return NULL;
+    if (!bo) {
+        /* Clear the cache and try again. */
+        pb_cache_release_all_buffers(&ws->bo_cache);
+        bo = radeon_create_bo(ws, size, alignment, usage, domain, flags);
+        if (!bo)
+            return NULL;
+    }
 
     bo->use_reusable_pool = use_reusable_pool;