r600g: add back reference check when mapping buffer

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
This commit is contained in:
Jerome Glisse 2010-09-20 17:21:37 -04:00
parent 0f099f2906
commit 4fc5050f82
2 changed files with 8 additions and 7 deletions

View File

@ -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)
{

View File

@ -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) {