diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-08-27 20:50:08 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-08-27 20:51:35 +0100 |
commit | 26c731efc2048663b6a19a7ed7db0e94243ab30f (patch) | |
tree | ac874a136a2809858e3aa1038a9e3fef25bb5327 | |
parent | 2cbf88980ede50370b97f32e565dea33db16ac44 (diff) |
sna: Ensure that we create a GTT mapping for the inplace upload buffer
As the code will optimistically convert a request for a GTT mapping into
a CPU mapping if the object is still in the CPU domain, we need to
overrule that in this case where we explicitly want to write directly
into the GTT and furthermore keep the buffer around in an upload cache.
References: https://bugs.freedesktop.org/show_bug.cgi?id=51422
References: https://bugs.freedesktop.org/show_bug.cgi?id=52299
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index c9ab2c27..dc7c95dc 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -4377,6 +4377,9 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem, if (old) { DBG(("%s: reusing handle=%d for buffer\n", __FUNCTION__, old->handle)); + assert(kgem_bo_is_mappable(kgem, old)); + assert(!old->snoop); + assert(old->rq == NULL); bo = buffer_alloc(); if (bo == NULL) @@ -4388,7 +4391,7 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem, assert(bo->mmapped); assert(bo->base.refcnt == 1); - bo->mem = kgem_bo_map(kgem, &bo->base); + bo->mem = kgem_bo_map__gtt(kgem, &bo->base); if (bo->mem) { alloc = num_pages(&bo->base); goto init; @@ -4398,6 +4401,8 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem, } } } +#else + flags &= ~KGEM_BUFFER_INPLACE; #endif /* Be more parsimonious with pwrite/pread/cacheable buffers */ if ((flags & KGEM_BUFFER_INPLACE) == 0) |