From e00e1586dd94c1bbcd1ecfd9649fde9281be1977 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 25 Jun 2012 21:16:11 +0000 Subject: r600g: Add pkt_flag parameter to r600_context_block_emit_dirty() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows the shader type bit to be set in the pm4 header when emitting registers for compute shaders. Reviewed-by: Marek Olšák --- src/gallium/drivers/r600/r600.h | 2 +- src/gallium/drivers/r600/r600_hw_context.c | 14 +++++++++++++- src/gallium/drivers/r600/r600_state_common.c | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index d95eadaa9c6..d4e01d9694e 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -215,7 +215,7 @@ void r600_context_streamout_begin(struct r600_context *ctx); void r600_context_streamout_end(struct r600_context *ctx); void r600_context_draw_opaque_count(struct r600_context *ctx, struct r600_so_target *t); void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw, boolean count_draw_in); -void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block); +void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block, unsigned pkt_flags); void r600_context_block_resource_emit_dirty(struct r600_context *ctx, struct r600_block *block); int evergreen_context_init(struct r600_context *ctx); diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c index 9303d09167c..77c35538a29 100644 --- a/src/gallium/drivers/r600/r600_hw_context.c +++ b/src/gallium/drivers/r600/r600_hw_context.c @@ -1025,7 +1025,12 @@ void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r60 r600_context_pipe_state_set_sampler_border(ctx, state, offset); } -void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block) +/** + * @param pkt_flags should be set to RADEON_CP_PACKET3_COMPUTE_MODE if this + * block will be used for compute shaders. + */ +void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block, + unsigned pkt_flags) { struct radeon_winsys_cs *cs = ctx->cs; int optional = block->nbo == 0 && !(block->flags & REG_FLAG_DIRTY_ALWAYS); @@ -1063,6 +1068,13 @@ void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block * cp_dwords = new_dwords + 2; } memcpy(&cs->buf[cs->cdw], block->pm4, cp_dwords * 4); + + /* We are applying the pkt_flags after copying the register block to + * the the command stream, because it is possible this block will be + * emitted with a different pkt_flags, and we don't want to store the + * pkt_flags in the block. + */ + cs->buf[cs->cdw] |= pkt_flags; cs->cdw += cp_dwords; if (optional) { diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index b5241a72e73..2cf0171166e 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -957,7 +957,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo) r600_emit_atom(rctx, state); } LIST_FOR_EACH_ENTRY_SAFE(dirty_block, next_block, &rctx->dirty,list) { - r600_context_block_emit_dirty(rctx, dirty_block); + r600_context_block_emit_dirty(rctx, dirty_block, 0 /* pkt_flags */); } LIST_FOR_EACH_ENTRY_SAFE(dirty_block, next_block, &rctx->resource_dirty,list) { r600_context_block_resource_emit_dirty(rctx, dirty_block); -- cgit v1.2.3