mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-06 16:30:42 +01:00
radeonsi: implement and rely on set_active_query_state
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
parent
e599b8f384
commit
f3eebb84eb
4 changed files with 45 additions and 4 deletions
|
|
@ -52,8 +52,6 @@ static void si_blitter_begin(struct pipe_context *ctx, enum si_blitter_op op)
|
|||
{
|
||||
struct si_context *sctx = (struct si_context *)ctx;
|
||||
|
||||
r600_suspend_nontimer_queries(&sctx->b);
|
||||
|
||||
util_blitter_save_vertex_buffer_slot(sctx->blitter, sctx->vertex_buffer);
|
||||
util_blitter_save_vertex_elements(sctx->blitter, sctx->vertex_elements);
|
||||
util_blitter_save_vertex_shader(sctx->blitter, sctx->vs_shader.cso);
|
||||
|
|
@ -95,7 +93,6 @@ static void si_blitter_end(struct pipe_context *ctx)
|
|||
struct si_context *sctx = (struct si_context *)ctx;
|
||||
|
||||
sctx->b.render_cond_force_off = false;
|
||||
r600_resume_nontimer_queries(&sctx->b);
|
||||
}
|
||||
|
||||
static unsigned u_max_sample(struct pipe_resource *r)
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@
|
|||
/* Compute only. */
|
||||
#define SI_CONTEXT_FLUSH_WITH_INV_L2 (R600_CONTEXT_PRIVATE_FLAG << 13) /* TODO: merge with TC? */
|
||||
#define SI_CONTEXT_FLAG_COMPUTE (R600_CONTEXT_PRIVATE_FLAG << 14)
|
||||
/* Pipeline & streamout query controls. */
|
||||
#define SI_CONTEXT_START_PIPELINE_STATS (R600_CONTEXT_PRIVATE_FLAG << 15)
|
||||
#define SI_CONTEXT_STOP_PIPELINE_STATS (R600_CONTEXT_PRIVATE_FLAG << 16)
|
||||
|
||||
#define SI_CONTEXT_FLUSH_AND_INV_FRAMEBUFFER (SI_CONTEXT_FLUSH_AND_INV_CB | \
|
||||
SI_CONTEXT_FLUSH_AND_INV_CB_META | \
|
||||
|
|
@ -289,6 +292,7 @@ struct si_context {
|
|||
bool db_stencil_clear;
|
||||
bool db_stencil_disable_expclear;
|
||||
unsigned ps_db_shader_control;
|
||||
bool occlusion_queries_disabled;
|
||||
|
||||
/* Emitted draw state. */
|
||||
int last_base_vertex;
|
||||
|
|
|
|||
|
|
@ -1348,6 +1348,26 @@ static void *si_create_db_flush_dsa(struct si_context *sctx)
|
|||
|
||||
/* DB RENDER STATE */
|
||||
|
||||
static void si_set_active_query_state(struct pipe_context *ctx, boolean enable)
|
||||
{
|
||||
struct si_context *sctx = (struct si_context*)ctx;
|
||||
|
||||
/* Pipeline stat & streamout queries. */
|
||||
if (enable) {
|
||||
sctx->b.flags &= ~SI_CONTEXT_STOP_PIPELINE_STATS;
|
||||
sctx->b.flags |= SI_CONTEXT_START_PIPELINE_STATS;
|
||||
} else {
|
||||
sctx->b.flags &= ~SI_CONTEXT_START_PIPELINE_STATS;
|
||||
sctx->b.flags |= SI_CONTEXT_STOP_PIPELINE_STATS;
|
||||
}
|
||||
|
||||
/* Occlusion queries. */
|
||||
if (sctx->occlusion_queries_disabled != !enable) {
|
||||
sctx->occlusion_queries_disabled = !enable;
|
||||
si_mark_atom_dirty(sctx, &sctx->db_render_state);
|
||||
}
|
||||
}
|
||||
|
||||
static void si_set_occlusion_query_state(struct pipe_context *ctx, bool enable)
|
||||
{
|
||||
struct si_context *sctx = (struct si_context*)ctx;
|
||||
|
|
@ -1382,7 +1402,8 @@ static void si_emit_db_render_state(struct si_context *sctx, struct r600_atom *s
|
|||
}
|
||||
|
||||
/* DB_COUNT_CONTROL (occlusion queries) */
|
||||
if (sctx->b.num_occlusion_queries > 0) {
|
||||
if (sctx->b.num_occlusion_queries > 0 &&
|
||||
!sctx->occlusion_queries_disabled) {
|
||||
bool perfect = sctx->b.num_perfect_occlusion_queries > 0;
|
||||
|
||||
if (sctx->b.chip_class >= CIK) {
|
||||
|
|
@ -3740,6 +3761,7 @@ void si_init_state_functions(struct si_context *sctx)
|
|||
sctx->b.b.set_min_samples = si_set_min_samples;
|
||||
sctx->b.b.set_tess_state = si_set_tess_state;
|
||||
|
||||
sctx->b.b.set_active_query_state = si_set_active_query_state;
|
||||
sctx->b.set_occlusion_query_state = si_set_occlusion_query_state;
|
||||
sctx->b.need_gfx_cs_space = si_need_gfx_cs_space;
|
||||
|
||||
|
|
@ -3970,6 +3992,14 @@ static void si_init_config(struct si_context *sctx)
|
|||
si_pm4_cmd_add(pm4, 0x80000000);
|
||||
si_pm4_cmd_end(pm4, false);
|
||||
|
||||
/* This enables pipeline stat & streamout queries.
|
||||
* They are only disabled by blits.
|
||||
*/
|
||||
si_pm4_cmd_begin(pm4, PKT3_EVENT_WRITE);
|
||||
si_pm4_cmd_add(pm4, EVENT_TYPE(V_028A90_PIPELINESTAT_START) |
|
||||
EVENT_INDEX(0));
|
||||
si_pm4_cmd_end(pm4, false);
|
||||
|
||||
si_pm4_set_reg(pm4, R_028A18_VGT_HOS_MAX_TESS_LEVEL, fui(64));
|
||||
si_pm4_set_reg(pm4, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, fui(0));
|
||||
|
||||
|
|
|
|||
|
|
@ -722,6 +722,16 @@ void si_emit_cache_flush(struct si_context *si_ctx, struct r600_atom *atom)
|
|||
}
|
||||
}
|
||||
|
||||
if (sctx->flags & SI_CONTEXT_START_PIPELINE_STATS) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_PIPELINESTAT_START) |
|
||||
EVENT_INDEX(0));
|
||||
} else if (sctx->flags & SI_CONTEXT_STOP_PIPELINE_STATS) {
|
||||
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
|
||||
radeon_emit(cs, EVENT_TYPE(V_028A90_PIPELINESTAT_STOP) |
|
||||
EVENT_INDEX(0));
|
||||
}
|
||||
|
||||
sctx->flags = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue