iris: Skip resolves and flushes altogether if unnecessary

Improves drawoverhead baseline scores by 1.17x.
This commit is contained in:
Kenneth Graunke
2019-03-11 00:04:56 -07:00
parent 365886ebe1
commit 66c100a8d6
3 changed files with 27 additions and 9 deletions

View File

@@ -125,12 +125,15 @@ enum iris_param_domain {
#define IRIS_DIRTY_VF_SGVS (1ull << 52)
#define IRIS_DIRTY_VF (1ull << 53)
#define IRIS_DIRTY_VF_TOPOLOGY (1ull << 54)
#define IRIS_DIRTY_RENDER_RESOLVES_AND_FLUSHES (1ull << 55)
#define IRIS_DIRTY_COMPUTE_RESOLVES_AND_FLUSHES (1ull << 56)
#define IRIS_ALL_DIRTY_FOR_COMPUTE (IRIS_DIRTY_CS | \
IRIS_DIRTY_SAMPLER_STATES_CS | \
IRIS_DIRTY_UNCOMPILED_CS | \
IRIS_DIRTY_CONSTANTS_CS | \
IRIS_DIRTY_BINDINGS_CS)
IRIS_DIRTY_BINDINGS_CS | \
IRIS_DIRTY_COMPUTE_RESOLVES_AND_FLUSHES)
#define IRIS_ALL_DIRTY_FOR_RENDER ~IRIS_ALL_DIRTY_FOR_COMPUTE

View File

@@ -133,14 +133,15 @@ iris_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
iris_update_compiled_shaders(ice);
if (ice->state.dirty & IRIS_DIRTY_RENDER_RESOLVES_AND_FLUSHES) {
bool draw_aux_buffer_disabled[BRW_MAX_DRAW_BUFFERS] = { };
for (gl_shader_stage stage = 0; stage < MESA_SHADER_COMPUTE; stage++) {
if (ice->shaders.prog[stage]) {
if (ice->shaders.prog[stage])
iris_predraw_resolve_inputs(ice, batch, draw_aux_buffer_disabled,
stage, true);
}
}
iris_predraw_resolve_framebuffer(ice, batch, draw_aux_buffer_disabled);
}
iris_binder_reserve_3d(ice);
@@ -215,8 +216,10 @@ iris_launch_grid(struct pipe_context *ctx, const struct pipe_grid_info *grid)
/* We can't do resolves on the compute engine, so awkwardly, we have to
* do them on the render batch...
*/
if (ice->state.dirty & IRIS_DIRTY_COMPUTE_RESOLVES_AND_FLUSHES) {
iris_predraw_resolve_inputs(ice, &ice->batches[IRIS_BATCH_RENDER], NULL,
MESA_SHADER_COMPUTE, false);
}
iris_batch_maybe_flush(batch, 1500);

View File

@@ -971,6 +971,7 @@ iris_bind_blend_state(struct pipe_context *ctx, void *state)
ice->state.dirty |= IRIS_DIRTY_PS_BLEND;
ice->state.dirty |= IRIS_DIRTY_BLEND_STATE;
ice->state.dirty |= IRIS_DIRTY_RENDER_RESOLVES_AND_FLUSHES;
ice->state.dirty |= ice->state.dirty_for_nos[IRIS_NOS_BLEND];
}
@@ -1083,6 +1084,9 @@ iris_bind_zsa_state(struct pipe_context *ctx, void *state)
if (cso_changed(alpha.func))
ice->state.dirty |= IRIS_DIRTY_BLEND_STATE;
if (cso_changed(depth_writes_enabled))
ice->state.dirty |= IRIS_DIRTY_RENDER_RESOLVES_AND_FLUSHES;
ice->state.depth_writes_enabled = new_cso->depth_writes_enabled;
ice->state.stencil_writes_enabled = new_cso->stencil_writes_enabled;
}
@@ -1986,6 +1990,9 @@ iris_set_shader_images(struct pipe_context *ctx,
}
ice->state.dirty |= IRIS_DIRTY_BINDINGS_VS << stage;
ice->state.dirty |=
stage == MESA_SHADER_COMPUTE ? IRIS_DIRTY_COMPUTE_RESOLVES_AND_FLUSHES
: IRIS_DIRTY_RENDER_RESOLVES_AND_FLUSHES;
/* Broadwell also needs brw_image_params re-uploaded */
if (GEN_GEN < 9) {
@@ -2021,6 +2028,9 @@ iris_set_sampler_views(struct pipe_context *ctx,
}
ice->state.dirty |= (IRIS_DIRTY_BINDINGS_VS << stage);
ice->state.dirty |=
stage == MESA_SHADER_COMPUTE ? IRIS_DIRTY_COMPUTE_RESOLVES_AND_FLUSHES
: IRIS_DIRTY_RENDER_RESOLVES_AND_FLUSHES;
}
/**
@@ -2359,6 +2369,8 @@ iris_set_framebuffer_state(struct pipe_context *ctx,
/* Render target change */
ice->state.dirty |= IRIS_DIRTY_BINDINGS_FS;
ice->state.dirty |= IRIS_DIRTY_RENDER_RESOLVES_AND_FLUSHES;
ice->state.dirty |= ice->state.dirty_for_nos[IRIS_NOS_FRAMEBUFFER];
#if GEN_GEN == 11