summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-03-02 20:18:32 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-03-02 20:18:32 +0000
commit599cd0e8ef3080fc735860bef4e47107c1c05f9a (patch)
tree234dc6f5bf006b57c5c3279a3521564a7826714a
parent4918e309dfadaf14da6997468f08db03ac0a6327 (diff)
sna: Align allocations with partial buffers to 64 bytes.
A magic number required for so many functions of the GPU. In this particular case it is likely to be that the offset of a texture in the GTT has to have a minimum alignment of 64 bytes. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46415 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index cc80278f..f9133693 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -3391,6 +3391,7 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
__FUNCTION__, bo->write, flags));
continue;
}
+ assert(bo->mmapped || bo->need_io);
} else {
if (bo->write & KGEM_BUFFER_WRITE) {
DBG(("%s: skip write %x buffer, need %x\n",
@@ -3548,6 +3549,9 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
list_init(&bo->base.list);
free(old);
+ assert(bo->base.tiling == I915_TILING_NONE);
+ assert(num_pages(&bo->base) >= NUM_PAGES(size));
+
bo->mem = kgem_bo_map(kgem, &bo->base);
if (bo->mem) {
bo->need_io = false;
@@ -3564,11 +3568,11 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
}
}
#else
- alloc = ALIGN(size, 64*1024) / PAGE_SIZE;
+ flags &= ~KGEM_BUFFER_INPLACE;
#endif
/* Be more parsimonious with pwrite/pread buffers */
if ((flags & KGEM_BUFFER_INPLACE) == 0)
- alloc = PAGE_ALIGN(size) / PAGE_SIZE;
+ alloc = NUM_PAGES(size);
flags &= ~KGEM_BUFFER_INPLACE;
if (kgem->has_vmap) {
@@ -3700,6 +3704,7 @@ init:
__FUNCTION__, alloc, bo->base.handle));
done:
+ bo->used = ALIGN(bo->used, 64);
/* adjust the position within the list to maintain decreasing order */
alloc = bytes(&bo->base) - bo->used;
{