pb_bufmgr_cache: flush cache when create_buffer fails and try again
authorMarek Olšák <maraeo@gmail.com>
Fri, 7 Oct 2011 22:27:16 +0000 (00:27 +0200)
committerMarek Olšák <maraeo@gmail.com>
Sat, 8 Oct 2011 16:54:28 +0000 (18:54 +0200)
NOTE: This is a candidate for the stable branches.

src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c

index 58721c068e2a8f984d89ecf56de5db8c34c91e42..0e6896afd0a86841229cc398b275c45accec93ee 100644 (file)
@@ -324,6 +324,13 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
       return NULL;
    
    buf->buffer = mgr->provider->create_buffer(mgr->provider, size, desc);
+
+   /* Empty the cache and try again. */
+   if (!buf->buffer) {
+      mgr->base.flush(&mgr->base);
+      buf->buffer = mgr->provider->create_buffer(mgr->provider, size, desc);
+   }
+
    if(!buf->buffer) {
       FREE(buf);
       return NULL;