diff options
author | Rob Clark <[email protected]> | 2016-07-11 17:36:45 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2016-07-30 09:23:42 -0400 |
commit | 7f8fd02dc7cad1ddcfb610db10ffbb41e3e34e7d (patch) | |
tree | 755aec6bfa8e4d9cb4614dd5a8b58e4b21a6b73d /src/gallium/drivers/freedreno/freedreno_draw.c | |
parent | 10baf05b2caaa0900c71ac64c91301e953176516 (diff) |
freedreno: re-order support for hw queries
Push query state down to batch, and use the resource tracking to figure
out which batch(es) need to be flushed to get the query result.
This means we actually need to allocate the prsc up front, before we
know the size. So we have to add a special way to allocate an un-
backed resource, and then later allocate the backing storage.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_draw.c')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_draw.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index 112bf5cb624..fd3da1f20e5 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -89,6 +89,10 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) ctx->discard = false; } + /* NOTE: needs to be before resource_written(batch->query_buf), otherwise + * query_buf may not be created yet. + */ + fd_hw_query_set_stage(batch, batch->draw, FD_STAGE_DRAW); /* * Figure out the buffers/features we need: */ @@ -154,6 +158,8 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) if (ctx->streamout.targets[i]) resource_written(batch, ctx->streamout.targets[i]->buffer); + resource_written(batch, batch->query_buf); + batch->num_draws++; prims = u_reduced_prims_for_vertices(info->mode, info->count); @@ -180,7 +186,6 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) util_format_short_name(pipe_surface_format(pfb->cbufs[0])), util_format_short_name(pipe_surface_format(pfb->zsbuf))); - fd_hw_query_set_stage(ctx, batch->draw, FD_STAGE_DRAW); if (ctx->draw_vbo(ctx, info)) batch->needs_flush = true; @@ -253,12 +258,14 @@ fd_clear(struct pipe_context *pctx, unsigned buffers, batch->gmem_reason |= FD_GMEM_CLEARS_DEPTH_STENCIL; } + resource_written(batch, batch->query_buf); + DBG("%p: %x %ux%u depth=%f, stencil=%u (%s/%s)", batch, buffers, pfb->width, pfb->height, depth, stencil, util_format_short_name(pipe_surface_format(pfb->cbufs[0])), util_format_short_name(pipe_surface_format(pfb->zsbuf))); - fd_hw_query_set_stage(ctx, batch->draw, FD_STAGE_CLEAR); + fd_hw_query_set_stage(batch, batch->draw, FD_STAGE_CLEAR); ctx->clear(ctx, buffers, color, depth, stencil); |