diff options
author | Ilia Mirkin <[email protected]> | 2015-04-02 20:48:44 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2015-04-05 16:36:34 -0400 |
commit | dacf22e0a34d4dc2595f3cb0dbee52318dc9d0d7 (patch) | |
tree | 1edadeb6b96f00a49c0fec986619f8c670fc85bc /src/gallium/drivers/freedreno/freedreno_draw.c | |
parent | 2e1445c8f3df7608ba4522f8d088170de4ec788c (diff) |
freedreno: mark resources as being read so that writes flush the queue
Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_draw.c')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_draw.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index 423ae23769c..fed3e64f202 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -39,6 +39,19 @@ #include "freedreno_query_hw.h" #include "freedreno_util.h" +static void +resource_reading(struct fd_context *ctx, struct pipe_resource *prsc) +{ + struct fd_resource *rsc; + + if (!prsc) + return; + + rsc = fd_resource(prsc); + rsc->reading = true; + list_delinit(&rsc->list); + list_addtail(&rsc->list, &ctx->used_resources); +} static void fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) @@ -101,6 +114,29 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) ctx->gmem_reason |= FD_GMEM_BLEND_ENABLED; } + /* Skip over buffer 0, that is sent along with the command stream */ + for (i = 1; i < PIPE_MAX_CONSTANT_BUFFERS; i++) { + resource_reading(ctx, ctx->constbuf[PIPE_SHADER_VERTEX].cb[i].buffer); + resource_reading(ctx, ctx->constbuf[PIPE_SHADER_FRAGMENT].cb[i].buffer); + } + + /* Mark VBOs as being read */ + for (i = 0; i < ctx->vtx.vertexbuf.count; i++) { + assert(!ctx->vtx.vertexbuf.vb[i].user_buffer); + resource_reading(ctx, ctx->vtx.vertexbuf.vb[i].buffer); + } + + /* Mark index buffer as being read */ + resource_reading(ctx, ctx->indexbuf.buffer); + + /* Mark textures as being read */ + for (i = 0; i < ctx->verttex.num_textures; i++) + if (ctx->verttex.textures[i]) + resource_reading(ctx, ctx->verttex.textures[i]->texture); + for (i = 0; i < ctx->fragtex.num_textures; i++) + if (ctx->fragtex.textures[i]) + resource_reading(ctx, ctx->fragtex.textures[i]->texture); + ctx->num_draws++; ctx->stats.draw_calls++; @@ -223,6 +259,8 @@ fd_clear_depth_stencil(struct pipe_context *pctx, struct pipe_surface *ps, void fd_draw_init(struct pipe_context *pctx) { + list_inithead(&fd_context(pctx)->used_resources); + pctx->draw_vbo = fd_draw_vbo; pctx->clear = fd_clear; pctx->clear_render_target = fd_clear_render_target; |