summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-07-02 21:17:54 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-07-02 21:23:17 +0100
commit24c9bac7eb6e17b55044d719bab74d16fd68c450 (patch)
tree83605867a2a0ddeaed1eb75ed7cc0f3494a93d42
parent710bb0d37c681f2ffdeaf263b6ee7d9488670bc0 (diff)
sna: Limit the size of the tiling object to be smaller than either the originals
When we tile, we do so in order to fit an operation involving two objects larger than the aperture. If we then choose an intermediate tiling object that is larger than either of those two, the error will persist and we will be forced to recuse. In the worst case, this will provide an upper bound to the recursion. Reported-by: Bruno Prémont <bonbons@linux-vserver.org> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 68a65009..431fe979 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -635,6 +635,7 @@ static inline bool sna_pixmap_is_scanout(struct sna *sna, PixmapPtr pixmap)
static inline int sna_max_tile_copy_size(struct sna *sna, struct kgem_bo *src, struct kgem_bo *dst)
{
+ int min_object;
int max_size;
max_size = sna->kgem.aperture_high * PAGE_SIZE;
@@ -646,6 +647,13 @@ static inline int sna_max_tile_copy_size(struct sna *sna, struct kgem_bo *src, s
if (max_size > sna->kgem.max_copy_tile_size)
max_size = sna->kgem.max_copy_tile_size;
+
+ min_object = MIN(kgem_bo_size(src), kgem_bo_size(dst)) / 2;
+ if (max_size > min_object)
+ max_size = min_object;
+ if (max_size <= 4096)
+ max_size = 0;
+
DBG(("%s: using max tile size of %d\n", __FUNCTION__, max_size));
return max_size;
}