winsys/amdgpu: clear the buffer cache on mmap failure and try again
authorMarek Olšák <marek.olsak@amd.com>
Wed, 9 Dec 2015 21:45:56 +0000 (22:45 +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 90f3a9f35d0be53f411ec370562ee7df1a6ee586..a8447731dc9ef62b6b31f6ca8675bbf393054e65 100644 (file)
@@ -229,6 +229,11 @@ static void *amdgpu_bo_map(struct pb_buffer *buf,
        return bo->user_ptr;
 
    r = amdgpu_bo_cpu_map(bo->bo, &cpu);
+   if (r) {
+      /* Clear the cache and try again. */
+      pb_cache_release_all_buffers(&bo->ws->bo_cache);
+      r = amdgpu_bo_cpu_map(bo->bo, &cpu);
+   }
    return r ? NULL : cpu;
 }