diff options
author | Jerome Glisse <[email protected]> | 2010-09-20 17:21:37 -0400 |
---|---|---|
committer | Jerome Glisse <[email protected]> | 2010-09-20 17:21:37 -0400 |
commit | 4fc5050f82a6b59a86370f44c64e7592ff621f6f (patch) | |
tree | fc9c5271687c7433d1e8a581c7d921bb97e8556e | |
parent | 0f099f2906773690210661fb533e207626dc8e40 (diff) |
r600g: add back reference check when mapping buffer
Signed-off-by: Jerome Glisse <[email protected]>
-rw-r--r-- | src/gallium/targets/dri-r600/target.c | 2 | ||||
-rw-r--r-- | src/gallium/winsys/r600/drm/radeon_bo_pb.c | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/gallium/targets/dri-r600/target.c b/src/gallium/targets/dri-r600/target.c index eb268d5bc01..2c1b2f5be45 100644 --- a/src/gallium/targets/dri-r600/target.c +++ b/src/gallium/targets/dri-r600/target.c @@ -4,7 +4,7 @@ #include "r600/drm/r600_drm_public.h" #include "r600/r600_public.h" -#if 1 +#if 0 static struct pipe_screen * create_screen(int fd) { diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c b/src/gallium/winsys/r600/drm/radeon_bo_pb.c index 148cf6d81d2..897938c2caf 100644 --- a/src/gallium/winsys/r600/drm/radeon_bo_pb.c +++ b/src/gallium/winsys/r600/drm/radeon_bo_pb.c @@ -55,7 +55,6 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, struct radeon_bo_pb *buf = radeon_bo_pb(_buf); struct pipe_context *pctx = ctx; -//printf("%s:%d ************************************************\n", __func__, __LINE__); if (flags & PB_USAGE_UNSYNCHRONIZED) { if (!buf->bo->data && radeon_bo_map(buf->mgr->radeon, buf->bo)) { return NULL; @@ -64,11 +63,13 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf, return buf->bo->data; } - if (flags & PB_USAGE_DONTBLOCK) { - return NULL; - } - if (ctx) { - pctx->flush(pctx, 0, NULL); + if (p_atomic_read(&buf->bo->reference.count) > 1) { + if (flags & PB_USAGE_DONTBLOCK) { + return NULL; + } + if (ctx) { + pctx->flush(pctx, 0, NULL); + } } if (flags & PB_USAGE_DONTBLOCK) { |