r300g: avoid mapping the same buffer twice

Shouldn't happen, but you never know.
This commit is contained in:
Marek Olšák 2011-04-03 19:17:19 +02:00
parent 437c748bf5
commit 652bf121f2
1 changed files with 5 additions and 0 deletions

View File

@ -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;