freedreno: Split out helper for updating sw stats
And while we're at it, handle the num_draws > 1 case, to prepare for plumbing num_draws further down. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9581>
This commit is contained in:
parent
66985973aa
commit
e9652630c7
|
@ -225,6 +225,36 @@ batch_draw_tracking(struct fd_batch *batch, const struct pipe_draw_info *info,
|
|||
fd_screen_unlock(ctx->screen);
|
||||
}
|
||||
|
||||
static void
|
||||
update_draw_stats(struct fd_context *ctx, const struct pipe_draw_info *info,
|
||||
const struct pipe_draw_start_count *draws, unsigned num_draws)
|
||||
assert_dt
|
||||
{
|
||||
/* Counting prims in sw doesn't work for GS and tesselation. For older
|
||||
* gens we don't have those stages and don't have the hw counters enabled,
|
||||
* so keep the count accurate for non-patch geometry.
|
||||
*/
|
||||
unsigned prims = 0;
|
||||
if ((info->mode != PIPE_PRIM_PATCHES) &&
|
||||
(info->mode != PIPE_PRIM_MAX)) {
|
||||
for (unsigned i = 0; i < num_draws; i++) {
|
||||
prims += u_reduced_prims_for_vertices(info->mode, draws[i].count);
|
||||
}
|
||||
}
|
||||
|
||||
ctx->stats.draw_calls++;
|
||||
|
||||
/* TODO prims_emitted should be clipped when the stream-out buffer is
|
||||
* not large enough. See max_tf_vtx().. probably need to move that
|
||||
* into common code. Although a bit more annoying since a2xx doesn't
|
||||
* use ir3 so no common way to get at the pipe_stream_output_info
|
||||
* which is needed for this calculation.
|
||||
*/
|
||||
if (ctx->streamout.num_targets > 0)
|
||||
ctx->stats.prims_emitted += prims;
|
||||
ctx->stats.prims_generated += prims;
|
||||
}
|
||||
|
||||
static void
|
||||
fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
|
||||
const struct pipe_draw_indirect_info *indirect,
|
||||
|
@ -318,28 +348,7 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
|
|||
batch->back_blit = ctx->in_shadow;
|
||||
batch->num_draws++;
|
||||
|
||||
/* Counting prims in sw doesn't work for GS and tesselation. For older
|
||||
* gens we don't have those stages and don't have the hw counters enabled,
|
||||
* so keep the count accurate for non-patch geometry.
|
||||
*/
|
||||
unsigned prims;
|
||||
if ((info->mode != PIPE_PRIM_PATCHES) &&
|
||||
(info->mode != PIPE_PRIM_MAX))
|
||||
prims = u_reduced_prims_for_vertices(info->mode, draws[0].count);
|
||||
else
|
||||
prims = 0;
|
||||
|
||||
ctx->stats.draw_calls++;
|
||||
|
||||
/* TODO prims_emitted should be clipped when the stream-out buffer is
|
||||
* not large enough. See max_tf_vtx().. probably need to move that
|
||||
* into common code. Although a bit more annoying since a2xx doesn't
|
||||
* use ir3 so no common way to get at the pipe_stream_output_info
|
||||
* which is needed for this calculation.
|
||||
*/
|
||||
if (ctx->streamout.num_targets > 0)
|
||||
ctx->stats.prims_emitted += prims;
|
||||
ctx->stats.prims_generated += prims;
|
||||
update_draw_stats(ctx, info, draws, num_draws);
|
||||
|
||||
/* Clearing last_fence must come after the batch dependency tracking
|
||||
* (resource_read()/resource_written()), as that can trigger a flush,
|
||||
|
|
Loading…
Reference in New Issue