diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-29 10:59:20 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-29 10:59:20 +0000 |
commit | 20e57914089d6959529ad222e04853f5ffcb364f (patch) | |
tree | 4745b917bd74d3971bab7a74780738bdd74eaa00 | |
parent | 56155c91afb5a0dcafe4dbc22ade3b7c0c977674 (diff) |
sna: Fix assertion around flushing of mmap(PROT_READ)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index fd189cf4..58b9b67d 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -1804,16 +1804,18 @@ void *kgem_bo_map(struct kgem *kgem, struct kgem_bo *bo, int prot) { void *ptr; - assert(!kgem_busy(kgem, bo->handle)); + assert(prot == PROT_READ || !kgem_busy(kgem, bo->handle)); ptr = gem_mmap(kgem->fd, bo->handle, bo->size, prot); if (ptr == NULL) return NULL; - assert(!kgem_busy(kgem, bo->handle)); - bo->needs_flush = false; - if (bo->gpu) - kgem_retire(kgem); + if (prot & PROT_WRITE) { + assert(!kgem_busy(kgem, bo->handle)); + bo->needs_flush = false; + if (bo->gpu) + kgem_retire(kgem); + } return ptr; } |