diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-29 15:04:09 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-29 16:08:30 +0100 |
commit | 6ab2a3acf71b5204c399c7649e5601c93a99f25f (patch) | |
tree | 66e3c3c27203410c95119989af4631ca5d377cc6 /src/sna/kgem.h | |
parent | 9026bb954646c0425360c2236e26c79d097142cd (diff) |
sna: Improve checks for coherent access through CPU mappings
Refactor the CPU mapping tests to a single function, and remember to
test for a pending GPU write (i.e. bo->exec).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/kgem.h')
-rw-r--r-- | src/sna/kgem.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/sna/kgem.h b/src/sna/kgem.h index d1a391ab..c7c7fce2 100644 --- a/src/sna/kgem.h +++ b/src/sna/kgem.h @@ -564,6 +564,22 @@ static inline bool kgem_bo_can_map(struct kgem *kgem, struct kgem_bo *bo) return kgem_bo_size(bo) <= kgem->aperture_mappable / 4; } +static inline bool kgem_bo_can_map__cpu(struct kgem *kgem, + struct kgem_bo *bo, + bool write) +{ + if (bo->scanout) + return false; + + if (kgem->has_llc) + return true; + + if (bo->domain != DOMAIN_CPU) + return false; + + return !write || bo->exec == NULL; +} + static inline bool kgem_bo_is_snoop(struct kgem_bo *bo) { assert(bo->refcnt); |