sna/gen7: Be paranoid and force a pipecontrol stall at least every 4 flushes

The documentation warns of potential GPU hangs if we emit more than 4
pipecontrol flushes without a CS stall. This is highly unlikely given
how frequently we must inject stalls into the pipeline, but force a
stall just in case!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-11-12 10:54:36 +00:00
parent b2492fa45b
commit 13fa1f1a26
2 changed files with 12 additions and 3 deletions

View File

@ -1069,6 +1069,7 @@ gen7_emit_pipe_invalidate(struct sna *sna)
GEN7_PIPE_CONTROL_CS_STALL);
OUT_BATCH(0);
OUT_BATCH(0);
sna->render_state.gen7.pipe_controls_since_stall = 0;
}
inline static void
@ -1077,9 +1078,11 @@ gen7_emit_pipe_flush(struct sna *sna, bool need_stall)
unsigned stall;
stall = 0;
if (need_stall)
stall = (GEN7_PIPE_CONTROL_CS_STALL |
GEN7_PIPE_CONTROL_STALL_AT_SCOREBOARD);
if (need_stall) {
stall = GEN7_PIPE_CONTROL_CS_STALL;
sna->render_state.gen7.pipe_controls_since_stall = 0;
} else
sna->render_state.gen7.pipe_controls_since_stall++;
OUT_BATCH(GEN7_PIPE_CONTROL | (4 - 2));
OUT_BATCH(GEN7_PIPE_CONTROL_WC_FLUSH | stall);
@ -1095,6 +1098,7 @@ gen7_emit_pipe_stall(struct sna *sna)
GEN7_PIPE_CONTROL_STALL_AT_SCOREBOARD);
OUT_BATCH(0);
OUT_BATCH(0);
sna->render_state.gen7.pipe_controls_since_stall = 0;
}
static void
@ -1124,6 +1128,9 @@ gen7_emit_state(struct sna *sna,
need_stall &= gen7_emit_drawing_rectangle(sna, op);
if (ALWAYS_STALL)
need_stall = true;
if (sna->kgem.gen < 075 &&
sna->render_state.gen7.pipe_controls_since_stall >= 3)
need_stall = true;
if (need_invalidate) {
gen7_emit_pipe_invalidate(sna);
@ -3746,6 +3753,7 @@ gen7_render_clear(struct sna *sna, PixmapPtr dst, struct kgem_bo *bo)
}
static void gen7_render_reset(struct sna *sna)
{
sna->render_state.gen7.pipe_controls_since_stall = 0;
sna->render_state.gen7.emit_flush = false;
sna->render_state.gen7.needs_invariant = true;
sna->render_state.gen7.ve_id = 3 << 2;

View File

@ -508,6 +508,7 @@ struct gen7_render_state {
uint16_t last_primitive;
int16_t floats_per_vertex;
uint16_t surface_table;
uint16_t pipe_controls_since_stall;
bool needs_invariant;
bool emit_flush;