summaryrefslogtreecommitdiff
path: root/src/sna
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-10-30 09:55:57 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-10-30 13:42:44 +0000
commit59531ba31aa479497cb76b67ea972d1cfa6aec79 (patch)
treefcb9ea38b9b2a03137b50aa045115f551f7c7a63 /src/sna
parent87655e7df4847542db8da6c8b61006c95b936185 (diff)
sna: Check for wedged after submitting
If we submit prior to an operation, check that we didn't just wedge the GPU. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r--src/sna/gen2_render.c8
-rw-r--r--src/sna/gen3_render.c10
-rw-r--r--src/sna/gen4_render.c11
-rw-r--r--src/sna/gen5_render.c14
-rw-r--r--src/sna/gen7_render.c19
-rw-r--r--src/sna/kgem.c3
-rw-r--r--src/sna/sna_blt.c4
7 files changed, 54 insertions, 15 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c
index a0ba8ca8..1a4c36aa 100644
--- a/src/sna/gen2_render.c
+++ b/src/sna/gen2_render.c
@@ -2809,7 +2809,8 @@ gen2_render_fill_boxes(struct sna *sna,
if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
kgem_submit(&sna->kgem);
- assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
+ if (!kgem_check_bo(&sna->kgem, dst_bo, NULL))
+ return false;
}
gen2_emit_fill_composite_state(sna, &tmp, pixel);
@@ -3040,10 +3041,13 @@ gen2_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo,
if (!kgem_check_bo(&sna->kgem, bo, NULL)) {
kgem_submit(&sna->kgem);
+
if (gen2_render_fill_one_try_blt(sna, dst, bo, color,
x1, y1, x2, y2, alu))
return true;
- assert(kgem_check_bo(&sna->kgem, bo, NULL));
+
+ if (!kgem_check_bo(&sna->kgem, bo, NULL))
+ return false;
}
tmp.op = alu;
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index cec35f45..dc20c02f 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -5949,7 +5949,8 @@ gen3_render_fill_boxes(struct sna *sna,
if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
kgem_submit(&sna->kgem);
- assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
+ if (!kgem_check_bo(&sna->kgem, dst_bo, NULL))
+ return false;
}
gen3_align_vertex(sna, &tmp);
@@ -6095,7 +6096,8 @@ gen3_render_fill(struct sna *sna, uint8_t alu,
if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
kgem_submit(&sna->kgem);
- assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
+ if (!kgem_check_bo(&sna->kgem, dst_bo, NULL))
+ return false;
}
tmp->blt = gen3_render_fill_op_blt;
@@ -6176,9 +6178,13 @@ gen3_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo,
if (!kgem_check_bo(&sna->kgem, bo, NULL)) {
kgem_submit(&sna->kgem);
+
if (gen3_render_fill_one_try_blt(sna, dst, bo, color,
x1, y1, x2, y2, alu))
return true;
+
+ if (!kgem_check_bo(&sna->kgem, bo, NULL))
+ return false;
}
gen3_align_vertex(sna, &tmp);
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index f737c339..5d959914 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -1388,7 +1388,8 @@ gen4_render_video(struct sna *sna,
if (!kgem_check_bo(&sna->kgem, tmp.dst.bo, frame->bo, NULL)) {
kgem_submit(&sna->kgem);
- assert(kgem_check_bo(&sna->kgem, tmp.dst.bo, frame->bo, NULL));
+ if (!kgem_check_bo(&sna->kgem, tmp.dst.bo, frame->bo, NULL))
+ return false;
}
gen4_align_vertex(sna, &tmp);
@@ -2656,7 +2657,8 @@ gen4_render_fill_boxes(struct sna *sna,
if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
kgem_submit(&sna->kgem);
- assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
+ if (!kgem_check_bo(&sna->kgem, dst_bo, NULL))
+ return false;
}
gen4_align_vertex(sna, &tmp);
@@ -2761,7 +2763,10 @@ gen4_render_fill(struct sna *sna, uint8_t alu,
if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
kgem_submit(&sna->kgem);
- assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
+ if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
+ kgem_bo_destroy(&sna->kgem, op->base.src.bo);
+ return false;
+ }
}
gen4_align_vertex(sna, &op->base);
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index f9dd6aed..e20b0d03 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -1386,7 +1386,8 @@ gen5_render_video(struct sna *sna,
if (!kgem_check_bo(&sna->kgem, tmp.dst.bo, frame->bo, NULL)) {
kgem_submit(&sna->kgem);
- assert(kgem_check_bo(&sna->kgem, tmp.dst.bo, frame->bo, NULL));
+ if (!kgem_check_bo(&sna->kgem, tmp.dst.bo, frame->bo, NULL))
+ return false;
}
gen5_align_vertex(sna, &tmp);
@@ -2686,7 +2687,10 @@ gen5_render_fill_boxes(struct sna *sna,
if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
kgem_submit(&sna->kgem);
- assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
+ if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
+ kgem_bo_destroy(&sna->kgem, tmp.src.bo);
+ return false;
+ }
}
gen5_align_vertex(sna, &tmp);
@@ -2856,7 +2860,10 @@ gen5_render_fill(struct sna *sna, uint8_t alu,
if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
kgem_submit(&sna->kgem);
- assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
+ if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
+ kgem_bo_destroy(&sna->kgem, op->base.src.bo);
+ return false;
+ }
}
gen5_align_vertex(sna, &op->base);
@@ -2951,7 +2958,6 @@ gen5_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo,
kgem_bo_destroy(&sna->kgem, tmp.src.bo);
return false;
}
- assert(kgem_check_bo(&sna->kgem, bo, NULL));
}
gen5_align_vertex(sna, &tmp);
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index d597e17c..b8c46c0d 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -1868,7 +1868,9 @@ gen7_render_video(struct sna *sna,
kgem_set_mode(&sna->kgem, KGEM_RENDER, tmp.dst.bo);
if (!kgem_check_bo(&sna->kgem, tmp.dst.bo, frame->bo, NULL)) {
kgem_submit(&sna->kgem);
- assert(kgem_check_bo(&sna->kgem, tmp.dst.bo, frame->bo, NULL));
+ if (!kgem_check_bo(&sna->kgem, tmp.dst.bo, frame->bo, NULL))
+ return false;
+
_kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
@@ -3327,7 +3329,12 @@ gen7_render_fill_boxes(struct sna *sna,
kgem_set_mode(&sna->kgem, KGEM_RENDER, dst_bo);
if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
kgem_submit(&sna->kgem);
- assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
+ if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
+ kgem_bo_destroy(&sna->kgem, tmp.src.bo);
+ if (tmp.redirect.real_bo)
+ kgem_bo_destroy(&sna->kgem, tmp.dst.bo);
+ return false;
+ }
_kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
@@ -3502,7 +3509,11 @@ gen7_render_fill(struct sna *sna, uint8_t alu,
kgem_set_mode(&sna->kgem, KGEM_RENDER, dst_bo);
if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
kgem_submit(&sna->kgem);
- assert(kgem_check_bo(&sna->kgem, dst_bo, NULL));
+ if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
+ kgem_bo_destroy(&sna->kgem, op->base.src.bo);
+ return false;
+ }
+
_kgem_set_mode(&sna->kgem, KGEM_RENDER);
}
@@ -3581,7 +3592,7 @@ gen7_render_fill_one(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo,
kgem_set_mode(&sna->kgem, KGEM_RENDER, bo);
if (!kgem_check_bo(&sna->kgem, bo, NULL)) {
kgem_submit(&sna->kgem);
- if (kgem_check_bo(&sna->kgem, bo, NULL)) {
+ if (!kgem_check_bo(&sna->kgem, bo, NULL)) {
kgem_bo_destroy(&sna->kgem, tmp.src.bo);
return false;
}
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 4606dc75..6afbec76 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -4717,6 +4717,9 @@ static bool aperture_check(struct kgem *kgem, unsigned num_pages)
static inline bool kgem_flush(struct kgem *kgem, bool flush)
{
+ if (unlikely(kgem->wedged))
+ return false;
+
if (kgem->nreloc == 0)
return true;
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index 277f53ec..94486bc8 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -173,6 +173,8 @@ static bool sna_blt_fill_init(struct sna *sna,
if (!kgem_check_reloc(kgem, 1)) {
_kgem_submit(kgem);
+ if (!kgem_check_bo_fenced(kgem, bo))
+ return false;
_kgem_set_mode(kgem, KGEM_BLT);
}
@@ -2734,6 +2736,8 @@ bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu,
if (!kgem_check_reloc(kgem, 1)) {
_kgem_submit(kgem);
+ if (!kgem_check_bo_fenced(&sna->kgem, bo))
+ return false;
_kgem_set_mode(kgem, KGEM_BLT);
}