From: Marek Olšák Date: Fri, 21 Jun 2019 22:38:58 +0000 (-0400) Subject: radeonsi/gfx10: jump over the shader query atomic if the queries are disabled X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32694456f7d87df0d24a7d6a0746ae7d35c6f63a;p=mesa.git radeonsi/gfx10: jump over the shader query atomic if the queries are disabled Acked-by: Bas Nieuwenhuizen --- diff --git a/src/gallium/drivers/radeonsi/gfx10_query.c b/src/gallium/drivers/radeonsi/gfx10_query.c index 8584b2af505..56ecbd54850 100644 --- a/src/gallium/drivers/radeonsi/gfx10_query.c +++ b/src/gallium/drivers/radeonsi/gfx10_query.c @@ -180,6 +180,7 @@ success:; sbuf.buffer_offset = qbuf->head; sbuf.buffer_size = sizeof(struct gfx10_sh_query_buffer_mem); si_set_rw_shader_buffer(sctx, GFX10_GS_QUERY_BUF, &sbuf); + sctx->current_vs_state |= S_VS_STATE_STREAMOUT_QUERY_ENABLED(1); si_mark_atom_dirty(sctx, &sctx->atoms.s.shader_query); return true; @@ -242,6 +243,7 @@ static bool gfx10_sh_query_end(struct si_context *sctx, struct si_query *rquery) gfx10_alloc_query_buffer(sctx); } else { si_set_rw_shader_buffer(sctx, GFX10_GS_QUERY_BUF, NULL); + sctx->current_vs_state &= C_VS_STATE_STREAMOUT_QUERY_ENABLED; /* If a query_begin is followed by a query_end without a draw * in-between, we need to clear the atom to ensure that the diff --git a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c index 8fbce10012f..37139752245 100644 --- a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c +++ b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c @@ -647,6 +647,9 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi, /* Update query buffer */ /* TODO: this won't catch 96-bit clear_buffer via transform feedback. */ if (!info->properties[TGSI_PROPERTY_VS_BLIT_SGPRS]) { + tmp = si_unpack_param(ctx, ctx->param_vs_state_bits, 6, 1); + tmp = LLVMBuildTrunc(builder, tmp, ctx->i1, ""); + ac_build_ifcc(&ctx->ac, tmp, 5029); /* if (STREAMOUT_QUERY_ENABLED) */ tmp = LLVMBuildICmp(builder, LLVMIntEQ, get_wave_id_in_tg(ctx), ctx->ac.i32_0, ""); ac_build_ifcc(&ctx->ac, tmp, 5030); tmp = LLVMBuildICmp(builder, LLVMIntULE, ac_get_thread_id(&ctx->ac), @@ -673,6 +676,7 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi, } ac_build_endif(&ctx->ac, 5031); ac_build_endif(&ctx->ac, 5030); + ac_build_endif(&ctx->ac, 5029); } /* Export primitive data to the index buffer. Format is: @@ -1044,6 +1048,9 @@ void gfx10_ngg_gs_emit_epilogue(struct si_shader_context *ctx) } /* Write shader query data. */ + tmp = si_unpack_param(ctx, ctx->param_vs_state_bits, 6, 1); + tmp = LLVMBuildTrunc(builder, tmp, ctx->i1, ""); + ac_build_ifcc(&ctx->ac, tmp, 5109); /* if (STREAMOUT_QUERY_ENABLED) */ unsigned num_query_comps = sel->so.num_outputs ? 8 : 4; tmp = LLVMBuildICmp(builder, LLVMIntULT, tid, LLVMConstInt(ctx->i32, num_query_comps, false), ""); @@ -1072,6 +1079,7 @@ void gfx10_ngg_gs_emit_epilogue(struct si_shader_context *ctx) ctx->i32, args, 5, 0); } ac_build_endif(&ctx->ac, 5110); + ac_build_endif(&ctx->ac, 5109); /* TODO: culling */ diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 801895b240c..2649a7cd5b7 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -249,6 +249,8 @@ enum { #define C_VS_STATE_OUTPRIM 0xFFFFFFF3 #define S_VS_STATE_PROVOKING_VTX_INDEX(x) (((unsigned)(x) & 0x3) << 4) #define C_VS_STATE_PROVOKING_VTX_INDEX 0xFFFFFFCF +#define S_VS_STATE_STREAMOUT_QUERY_ENABLED(x) (((unsigned)(x) & 0x1) << 6) +#define C_VS_STATE_STREAMOUT_QUERY_ENABLED 0xFFFFFFBF #define S_VS_STATE_LS_OUT_PATCH_SIZE(x) (((unsigned)(x) & 0x1FFF) << 8) #define C_VS_STATE_LS_OUT_PATCH_SIZE 0xFFE000FF #define S_VS_STATE_LS_OUT_VERTEX_SIZE(x) (((unsigned)(x) & 0xFF) << 24)