diff options
author | Nicolai Hähnle <[email protected]> | 2016-05-06 17:02:30 -0500 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2016-05-17 15:28:39 -0500 |
commit | 0558564200466878f1a86e7a192d085b551079c4 (patch) | |
tree | a76323fc1a7d1b1a7494ecc63a2cbd5745dff0c7 /src/gallium/drivers/radeon | |
parent | 5e89b027b9ca761488b97fd41e1a3e7ec6137dff (diff) |
gallium/radeon: add radeon_emitted to check for non-trivial IBs
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/r600_buffer_common.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/radeon_vce.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/radeon_winsys.h | 4 |
4 files changed, 11 insertions, 8 deletions
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c index c6429bff37b..9e8384d628f 100644 --- a/src/gallium/drivers/radeon/r600_buffer_common.c +++ b/src/gallium/drivers/radeon/r600_buffer_common.c @@ -37,7 +37,7 @@ boolean r600_rings_is_buffer_referenced(struct r600_common_context *ctx, if (ctx->ws->cs_is_buffer_referenced(ctx->gfx.cs, buf, usage)) { return TRUE; } - if (ctx->dma.cs && ctx->dma.cs->cdw && + if (radeon_emitted(ctx->dma.cs, 0) && ctx->ws->cs_is_buffer_referenced(ctx->dma.cs, buf, usage)) { return TRUE; } @@ -60,7 +60,7 @@ void *r600_buffer_map_sync_with_rings(struct r600_common_context *ctx, rusage = RADEON_USAGE_WRITE; } - if (ctx->gfx.cs->cdw != ctx->initial_gfx_cs_size && + if (radeon_emitted(ctx->gfx.cs, ctx->initial_gfx_cs_size) && ctx->ws->cs_is_buffer_referenced(ctx->gfx.cs, resource->buf, rusage)) { if (usage & PIPE_TRANSFER_DONTBLOCK) { @@ -71,8 +71,7 @@ void *r600_buffer_map_sync_with_rings(struct r600_common_context *ctx, busy = true; } } - if (ctx->dma.cs && - ctx->dma.cs->cdw && + if (radeon_emitted(ctx->dma.cs, 0) && ctx->ws->cs_is_buffer_referenced(ctx->dma.cs, resource->buf, rusage)) { if (usage & PIPE_TRANSFER_DONTBLOCK) { diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index a5966d95d97..8d9c5a5b7af 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -155,7 +155,7 @@ void r600_need_dma_space(struct r600_common_context *ctx, unsigned num_dw, } /* Flush the GFX IB if DMA depends on it. */ - if (ctx->gfx.cs->cdw > ctx->initial_gfx_cs_size && + if (radeon_emitted(ctx->gfx.cs, ctx->initial_gfx_cs_size) && ((dst && ctx->ws->cs_is_buffer_referenced(ctx->gfx.cs, dst->buf, RADEON_USAGE_READWRITE)) || @@ -212,7 +212,7 @@ void r600_dma_emit_wait_idle(struct r600_common_context *rctx) r600_need_dma_space(rctx, 1, NULL, NULL); - if (cs->cdw == 0) /* empty queue */ + if (!radeon_emitted(cs, 0)) /* empty queue */ return; /* NOP waits for idle on Evergreen and later. */ @@ -295,7 +295,7 @@ static void r600_flush_dma_ring(void *ctx, unsigned flags, struct r600_common_context *rctx = (struct r600_common_context *)ctx; struct radeon_winsys_cs *cs = rctx->dma.cs; - if (cs->cdw) + if (radeon_emitted(cs, 0)) rctx->ws->cs_flush(cs, flags, &rctx->last_sdma_fence); if (fence) rctx->ws->fence_reference(fence, rctx->last_sdma_fence); diff --git a/src/gallium/drivers/radeon/radeon_vce.c b/src/gallium/drivers/radeon/radeon_vce.c index 99b82ca9409..e16e0cf0536 100644 --- a/src/gallium/drivers/radeon/radeon_vce.c +++ b/src/gallium/drivers/radeon/radeon_vce.c @@ -313,7 +313,7 @@ static void rvce_encode_bitstream(struct pipe_video_codec *encoder, RVID_ERR("Can't create feedback buffer.\n"); return; } - if (!enc->cs->cdw) + if (!radeon_emitted(enc->cs, 0)) enc->session(enc); enc->encode(enc); enc->feedback(enc); diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h index e73fa14a17e..792bacb5499 100644 --- a/src/gallium/drivers/radeon/radeon_winsys.h +++ b/src/gallium/drivers/radeon/radeon_winsys.h @@ -775,6 +775,10 @@ struct radeon_winsys { unsigned num_registers, uint32_t *out); }; +static inline bool radeon_emitted(struct radeon_winsys_cs *cs, unsigned num_dw) +{ + return cs && cs->cdw > num_dw; +} static inline void radeon_emit(struct radeon_winsys_cs *cs, uint32_t value) { |