4f338c9b introduced logic to trigger a flush rather than overflowing
cmdstream buffer. But the threshold was too low, triggering flushes
where they were not needed. This caused problems with games like
xonotic.
Part of the problem is that we need to mark all state dirty between
cmdstream submit ioctls, because we cannot rely on state being
preserved across ioctls. But even with that, there are still some
problems that are still being debugged. For now:
1) correctly mark all state dirty
2) introduce FD_MESA_DEBUG flush flag to force rendering to be flushed
between each draw, to trigger problems (so that I can debug)
3) use a more reasonable threshold so for normal usecases we don't
trigger the problems
This at least corrects the regression, but there is still more debugging
to do.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
struct fd_ringbuffer *rings[8];
unsigned rings_idx;
+ /* NOTE: currently using a single ringbuffer for both draw and
+ * tiling commands, we need to make sure we need to leave enough
+ * room at the end to append the tiling commands when we flush.
+ * 0x7000 dwords should be a couple times more than we ever need
+ * so should be a nice concervative threshold.
+ */
+#define FD_TILING_COMMANDS_DWORDS 0x7000
+
/* normal draw/clear cmds: */
struct fd_ringbuffer *ring;
struct fd_ringmarker *draw_start, *draw_end;
* now we need to do this hack and trigger flush if we are running
* low on remaining space for cmds:
*/
- if ((ctx->ring->cur - ctx->ring->start) > ctx->ring->size/8)
+ if (((ctx->ring->cur - ctx->ring->start) >
+ (ctx->ring->size/4 - FD_TILING_COMMANDS_DWORDS)) ||
+ (fd_mesa_debug & FD_DBG_FLUSH))
fd_context_render(pctx);
}
ctx->max_scissor.minx = ctx->max_scissor.miny = ~0;
ctx->max_scissor.maxx = ctx->max_scissor.maxy = 0;
- /* Note that because the per-tile setup and mem2gmem/gmem2mem are emitted
- * after the draw/clear calls, but executed before, we need to preemptively
- * flag some state as dirty before the first draw/clear call.
- *
- * TODO maybe we need to mark all state as dirty to not worry about state
- * being clobbered by other contexts?
- */
- ctx->dirty |= FD_DIRTY_ZSA |
- FD_DIRTY_RASTERIZER |
- FD_DIRTY_FRAMEBUFFER |
- FD_DIRTY_SAMPLE_MASK |
- FD_DIRTY_VIEWPORT |
- FD_DIRTY_CONSTBUF |
- FD_DIRTY_PROG |
- FD_DIRTY_SCISSOR |
- /* probably only needed if we need to mem2gmem on the next
- * draw.. but not sure if there is a good way to know?
- */
- FD_DIRTY_VERTTEX |
- FD_DIRTY_FRAGTEX |
- FD_DIRTY_BLEND;
-
- if (fd_mesa_debug & FD_DBG_DGMEM)
- ctx->dirty = 0xffffffff;
+ ctx->dirty = ~0;
}
{"msgs", FD_DBG_MSGS, "Print debug messages"},
{"disasm", FD_DBG_DISASM, "Dump TGSI and adreno shader disassembly"},
{"dclear", FD_DBG_DCLEAR, "Mark all state dirty after clear"},
- {"dgmem", FD_DBG_DGMEM, "Mark all state dirty after GMEM tile pass"},
+ {"flush", FD_DBG_FLUSH, "Force flush after every draw"},
{"dscis", FD_DBG_DSCIS, "Disable scissor optimization"},
{"direct", FD_DBG_DIRECT, "Force inline (SS_DIRECT) state loads"},
{"dbypass", FD_DBG_DBYPASS,"Disable GMEM bypass"},
#define FD_DBG_MSGS 0x0001
#define FD_DBG_DISASM 0x0002
#define FD_DBG_DCLEAR 0x0004
-#define FD_DBG_DGMEM 0x0008
+#define FD_DBG_FLUSH 0x0008
#define FD_DBG_DSCIS 0x0010
#define FD_DBG_DIRECT 0x0020
#define FD_DBG_DBYPASS 0x0040