[Mesa-dev] [PATCH 3/4] winsys/radeon: clear the buffer cache on mmap failure and try again
Marek Olšák
maraeo at gmail.com
Wed Dec 9 13:58:38 PST 2015
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index a5f8aeb..5ba01b9 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -361,9 +361,16 @@ void *radeon_bo_do_map(struct radeon_bo *bo)
ptr = os_mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED,
bo->rws->fd, args.addr_ptr);
if (ptr == MAP_FAILED) {
- pipe_mutex_unlock(bo->map_mutex);
- fprintf(stderr, "radeon: mmap failed, errno: %i\n", errno);
- return NULL;
+ /* Clear the cache and try again. */
+ pb_cache_release_all_buffers(&bo->rws->bo_cache);
+
+ ptr = os_mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED,
+ bo->rws->fd, args.addr_ptr);
+ if (ptr == MAP_FAILED) {
+ pipe_mutex_unlock(bo->map_mutex);
+ fprintf(stderr, "radeon: mmap failed, errno: %i\n", errno);
+ return NULL;
+ }
}
bo->ptr = ptr;
bo->map_count = 1;
--
2.1.4
More information about the mesa-dev
mailing list