winsys/amdgpu: 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/amdgpu/drm/amdgpu_bo.c

index daf41fcc6a33a581218db3595762c0c590e2007c..90f3a9f35d0be53f411ec370562ee7df1a6ee586 100644 (file)
@@ -495,8 +495,13 @@ amdgpu_bo_create(struct radeon_winsys *rws,
 
    /* Create a new one. */
    bo = amdgpu_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 = amdgpu_create_bo(ws, size, alignment, usage, domain, flags);
+      if (!bo)
+         return NULL;
+   }
 
    bo->use_reusable_pool = use_reusable_pool;
    return &bo->base;