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.
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;
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;
}