diff options
author | Marek Olšák <[email protected]> | 2019-02-26 16:13:08 -0500 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-05-16 13:13:36 -0400 |
commit | f3ae455eb08e8d718b828eb42f2529437916179b (patch) | |
tree | 4c07decc9b0ba188eeff511c40eac2b5c181ae1e /src/gallium/drivers/radeonsi/si_state_draw.c | |
parent | 04122532e3c06260ae889a4f6a28d6f9849b00f5 (diff) |
radeonsi: compute culling - flush CS to remove write references to buffers
Only read-only buffers can use compute culling.
Acked-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state_draw.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_draw.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index d7de37b33ff..7eb1dfb1057 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -1328,7 +1328,7 @@ si_all_vs_resources_read_only(struct si_context *sctx, if (indexbuf && ws->cs_is_buffer_referenced(cs, si_resource(indexbuf)->buf, RADEON_USAGE_WRITE)) - return false; + goto has_write_reference; /* Vertex buffers. */ struct si_vertex_elements *velems = sctx->vertex_elements; @@ -1345,7 +1345,7 @@ si_all_vs_resources_read_only(struct si_context *sctx, if (ws->cs_is_buffer_referenced(cs, si_resource(res)->buf, RADEON_USAGE_WRITE)) - return false; + goto has_write_reference; } /* Constant and shader buffers. */ @@ -1360,7 +1360,7 @@ si_all_vs_resources_read_only(struct si_context *sctx, if (ws->cs_is_buffer_referenced(cs, si_resource(res)->buf, RADEON_USAGE_WRITE)) - return false; + goto has_write_reference; } /* Samplers. */ @@ -1376,7 +1376,7 @@ si_all_vs_resources_read_only(struct si_context *sctx, if (ws->cs_is_buffer_referenced(cs, si_resource(view->texture)->buf, RADEON_USAGE_WRITE)) - return false; + goto has_write_reference; } } @@ -1391,11 +1391,22 @@ si_all_vs_resources_read_only(struct si_context *sctx, if (ws->cs_is_buffer_referenced(cs, si_resource(res)->buf, RADEON_USAGE_WRITE)) - return false; + goto has_write_reference; } } return true; + +has_write_reference: + /* If the current gfx IB has enough packets, flush it to remove write + * references to buffers. + */ + if (cs->prev_dw + cs->current.cdw > 2048) { + si_flush_gfx_cs(sctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL); + assert(si_all_vs_resources_read_only(sctx, indexbuf)); + return true; + } + return false; } static ALWAYS_INLINE bool pd_msg(const char *s) |