diff options
author | Henri Verbeet <[email protected]> | 2010-09-19 19:27:30 +0200 |
---|---|---|
committer | Henri Verbeet <[email protected]> | 2010-09-19 19:43:05 +0200 |
commit | b68030e9f8211e5905c81b4c7f8de5780f48b655 (patch) | |
tree | e7a54cebc8907781b5e88998e6202450e10f7aaf /src/gallium | |
parent | a1d9a58b825825723f1c5f7705f2ed3ef834038a (diff) |
r600g: Check for other references before checking for existing mappings in radeon_bo_pb_map_internal().
Having a non-NULL data pointer doesn't imply it's safe to reuse that mapping,
it may have been unmapped but not flushed yet.
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/winsys/r600/drm/radeon_bo_pb.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index 65ba96233d5..8cf6a781306 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo_pb.c +++ b/src/gallium/winsys/r600/drm/radeon_bo_pb.c @@ -53,11 +53,16 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, unsigned flags, void *ctx) { struct radeon_bo_pb *buf = radeon_bo_pb(_buf); - - if (flags & PB_USAGE_DONTBLOCK) { - if (p_atomic_read(&buf->bo->reference.count) > 1) + + if (p_atomic_read(&buf->bo->reference.count) > 1) { + if (flags & PB_USAGE_DONTBLOCK) { return NULL; + } + if (ctx) { + r600_flush_ctx(ctx); + } } + if (buf->bo->data != NULL) { LIST_DELINIT(&buf->maplist); return buf->bo->data; @@ -69,9 +74,6 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, return NULL; } - if (p_atomic_read(&buf->bo->reference.count) > 1 && ctx) { - r600_flush_ctx(ctx); - } if (radeon_bo_map(buf->mgr->radeon, buf->bo)) { return NULL; } |