freedreno: Move FD_MESA_DEBUG cases out of draw_vbo

If the debug options are enabled, just plug in a debug version of
draw_vbo with the additional checks.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21274>
This commit is contained in:
Rob Clark 2023-02-11 08:03:35 -08:00 committed by Marge Bot
parent 8942f4b734
commit c938101bb5
2 changed files with 22 additions and 9 deletions

View file

@ -535,11 +535,6 @@ fd_batch_resource_read_slowpath(struct fd_batch *batch, struct fd_resource *rsc)
void
fd_batch_check_size(struct fd_batch *batch)
{
if (FD_DBG(FLUSH)) {
fd_batch_flush(batch);
return;
}
if (batch->num_draws > 100000) {
fd_batch_flush(batch);
return;

View file

@ -390,9 +390,6 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
ctx->streamout.offsets[i] += draws[0].count;
}
if (FD_DBG(DDRAW))
fd_context_all_dirty(ctx);
assert(!batch->flushed);
fd_batch_unlock_submit(batch);
@ -403,6 +400,22 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
pipe_resource_reference(&indexbuf, NULL);
}
static void
fd_draw_vbo_dbg(struct pipe_context *pctx, const struct pipe_draw_info *info,
unsigned drawid_offset,
const struct pipe_draw_indirect_info *indirect,
const struct pipe_draw_start_count_bias *draws, unsigned num_draws)
in_dt
{
fd_draw_vbo(pctx, info, drawid_offset, indirect, draws, num_draws);
if (FD_DBG(DDRAW))
fd_context_all_dirty(fd_context(pctx));
if (FD_DBG(FLUSH))
pctx->flush(pctx, NULL, 0);
}
static void
batch_clear_tracking(struct fd_batch *batch, unsigned buffers) assert_dt
{
@ -609,7 +622,12 @@ fd_launch_grid(struct pipe_context *pctx,
void
fd_draw_init(struct pipe_context *pctx)
{
pctx->draw_vbo = fd_draw_vbo;
if (FD_DBG(DDRAW) || FD_DBG(FLUSH)) {
pctx->draw_vbo = fd_draw_vbo_dbg;
} else {
pctx->draw_vbo = fd_draw_vbo;
}
pctx->clear = fd_clear;
pctx->clear_render_target = fd_clear_render_target;
pctx->clear_depth_stencil = fd_clear_depth_stencil;