xf86-video-intel: src/sna/kgem.c
Chris Wilson
ickle at kemper.freedesktop.org
Fri Oct 5 04:43:00 PDT 2012
src/sna/kgem.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
New commits:
commit 3680aa4976407886eb4be9878d5296d5a1fadccf
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Oct 5 12:33:32 2012 +0100
sna: Do not create an unsnooped CPU mapping for readbacks
Otherwise we notice that we have a CPU mmap during read synchronized and
presume that we need not take any further action. However...
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index bc2e66e..8c9cb6c 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -4755,6 +4755,8 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
init_buffer_from_bo(bo, old);
bo->need_io = flags & KGEM_BUFFER_WRITE;
} else {
+ unsigned hint;
+
if (use_snoopable_buffer(kgem, flags)) {
bo = create_snoopable_buffer(kgem, alloc);
if (bo)
@@ -4765,10 +4767,12 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
if (bo == NULL)
return NULL;
- old = search_linear_cache(kgem, alloc,
- CREATE_INACTIVE | CREATE_CPU_MAP);
+ hint = CREATE_INACTIVE;
+ if (flags & KGEM_BUFFER_WRITE)
+ hint |= CREATE_CPU_MAP;
+ old = search_linear_cache(kgem, alloc, hint);
if (old) {
- DBG(("%s: reusing cpu map handle=%d for buffer\n",
+ DBG(("%s: reusing handle=%d for buffer\n",
__FUNCTION__, old->handle));
alloc = num_pages(old);
@@ -4791,9 +4795,9 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
assert(!bo->need_io);
assert(bo->base.refcnt == 1);
- bo->mem = kgem_bo_map__cpu(kgem, &bo->base);
- if (bo->mem != NULL) {
- if (flags & KGEM_BUFFER_WRITE)
+ if (flags & KGEM_BUFFER_WRITE) {
+ bo->mem = kgem_bo_map__cpu(kgem, &bo->base);
+ if (bo->mem != NULL)
kgem_bo_sync__cpu(kgem, &bo->base);
goto init;
}
@@ -4967,6 +4971,8 @@ void kgem_buffer_read_sync(struct kgem *kgem, struct kgem_bo *_bo)
bo->base.domain,
kgem_busy(kgem, bo->base.handle)));
+ assert(!IS_CPU_MAP(bo->base.map) || bo->base.snoop || kgem->has_llc);
+
VG_CLEAR(set_domain);
set_domain.handle = bo->base.handle;
set_domain.write_domain = 0;
More information about the xorg-commit
mailing list