summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-04-03 19:17:19 +0200
committerMarek Olšák <[email protected]>2011-04-03 19:32:27 +0200
commit652bf121f2124ec92b74f6e3e40e6aefcc1c50dc (patch)
tree2f3299a1729b40e2b0a3c578b7b373a2e94ccd72 /src/gallium/winsys
parent437c748bf5072d2bded77a00c74c51cdb8b510e5 (diff)
r300g: avoid mapping the same buffer twice
Shouldn't happen, but you never know.
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_bo.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index eb7225b8738..4fd82201418 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -191,6 +191,11 @@ static void *radeon_bo_map_internal(struct pb_buffer *_buf,
/* Map the buffer. */
pipe_mutex_lock(bo->map_mutex);
+ /* Return the pointer if it's already mapped (in case of a race). */
+ if (bo->ptr) {
+ pipe_mutex_unlock(bo->map_mutex);
+ return bo->ptr;
+ }
args.handle = bo->handle;
args.offset = 0;
args.size = (uint64_t)bo->size;