summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sna/kgem.c72
-rw-r--r--src/sna/sna_blt.c1
-rw-r--r--src/sna/sna_tiling.c2
3 files changed, 51 insertions, 24 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 21f958c9..00d0723b 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -4830,20 +4830,28 @@ bool kgem_check_bo_fenced(struct kgem *kgem, struct kgem_bo *bo)
if (kgem->nfence >= kgem->fence_max)
return false;
- size = 3*kgem->aperture_fenced;
- if (kgem->aperture_total == kgem->aperture_mappable)
- size += kgem->aperture;
- if (size > kgem->aperture_mappable &&
- kgem_ring_is_idle(kgem, kgem->ring))
- return false;
+ if (kgem->aperture_fenced) {
+ size = 3*kgem->aperture_fenced;
+ if (kgem->aperture_total == kgem->aperture_mappable)
+ size += kgem->aperture;
+ if (size > kgem->aperture_mappable &&
+ kgem_ring_is_idle(kgem, kgem->ring)) {
+ DBG(("%s: opportunistic fence flush\n", __FUNCTION__));
+ return false;
+ }
+ }
size = kgem->aperture_fenced;
size += kgem_bo_fenced_size(kgem, bo);
- size *= 2;
+ if (kgem->gen < 033)
+ size *= 2;
if (kgem->aperture_total == kgem->aperture_mappable)
size += kgem->aperture;
- if (size > kgem->aperture_mappable)
+ if (size > kgem->aperture_mappable) {
+ DBG(("%s: estimated fence space required [%d] exceed aperture [%d]\n",
+ __FUNCTION__, size, kgem->aperture_mappable));
return false;
+ }
}
return true;
@@ -4866,20 +4874,28 @@ bool kgem_check_bo_fenced(struct kgem *kgem, struct kgem_bo *bo)
if (kgem->nfence >= kgem->fence_max)
return false;
- size = 3*kgem->aperture_fenced;
- if (kgem->aperture_total == kgem->aperture_mappable)
- size += kgem->aperture;
- if (size > kgem->aperture_mappable &&
- kgem_ring_is_idle(kgem, kgem->ring))
- return false;
+ if (kgem->aperture_fenced) {
+ size = 3*kgem->aperture_fenced;
+ if (kgem->aperture_total == kgem->aperture_mappable)
+ size += kgem->aperture;
+ if (size > kgem->aperture_mappable &&
+ kgem_ring_is_idle(kgem, kgem->ring)) {
+ DBG(("%s: opportunistic fence flush\n", __FUNCTION__));
+ return false;
+ }
+ }
size = kgem->aperture_fenced;
size += kgem_bo_fenced_size(kgem, bo);
- size *= 2;
+ if (kgem->gen < 033)
+ size *= 2;
if (kgem->aperture_total == kgem->aperture_mappable)
size += kgem->aperture;
- if (size > kgem->aperture_mappable)
+ if (size > kgem->aperture_mappable) {
+ DBG(("%s: estimated fence space required [%d] exceed aperture [%d]\n",
+ __FUNCTION__, size, kgem->aperture_mappable));
return false;
+ }
}
if (kgem->aperture + kgem->aperture_fenced + num_pages(bo) > kgem->aperture_high) {
@@ -4948,20 +4964,28 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...)
if (kgem->nfence + num_fence > kgem->fence_max)
return false;
- size = 3*kgem->aperture_fenced;
- if (kgem->aperture_total == kgem->aperture_mappable)
- size += kgem->aperture;
- if (size > kgem->aperture_mappable &&
- kgem_ring_is_idle(kgem, kgem->ring))
- return false;
+ if (kgem->aperture_fenced) {
+ size = 3*kgem->aperture_fenced;
+ if (kgem->aperture_total == kgem->aperture_mappable)
+ size += kgem->aperture;
+ if (size > kgem->aperture_mappable &&
+ kgem_ring_is_idle(kgem, kgem->ring)) {
+ DBG(("%s: opportunistic fence flush\n", __FUNCTION__));
+ return false;
+ }
+ }
size = kgem->aperture_fenced;
size += fenced_size;
- size *= 2;
+ if (kgem->gen < 033)
+ size *= 2;
if (kgem->aperture_total == kgem->aperture_mappable)
size += kgem->aperture;
- if (size > kgem->aperture_mappable)
+ if (size > kgem->aperture_mappable) {
+ DBG(("%s: estimated fence space required [%d] exceed aperture [%d]\n",
+ __FUNCTION__, size, kgem->aperture_mappable));
return false;
+ }
}
if (num_pages == 0)
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index 576b7856..39ff0f6e 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -3282,6 +3282,7 @@ bool sna_blt_copy_boxes(struct sna *sna, uint8_t alu,
!kgem_check_many_bo_fenced(kgem, dst_bo, src_bo, NULL)) {
kgem_submit(kgem);
if (!kgem_check_many_bo_fenced(kgem, dst_bo, src_bo, NULL))
+ DBG(("%s: not enough room in aperture, fallback to tiling copy\n", __FUNCTION__));
return sna_tiling_blt_copy_boxes(sna, alu,
src_bo, src_dx, src_dy,
dst_bo, dst_dx, dst_dy,
diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c
index 3bbcec70..b0a48dd3 100644
--- a/src/sna/sna_tiling.c
+++ b/src/sna/sna_tiling.c
@@ -718,6 +718,8 @@ bool sna_tiling_blt_copy_boxes(struct sna *sna, uint8_t alu,
}
if (max_size > sna->kgem.max_copy_tile_size)
max_size = sna->kgem.max_copy_tile_size;
+ if (sna->kgem.gen < 033)
+ max_size /= 2; /* accommodate fence alignment */
pixman_region_init_rects(&region, box, nbox);