From 1d05d24b1d0879db3039113d4b388189cbb6bf9d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 9 Mar 2019 01:31:06 -0800 Subject: [PATCH] iris: Skip input resolve handling if bindings haven't changed This brings the drawoverhead 16 Tex w/ no state change score from 22% of baseline to 97% of baseline. --- src/gallium/drivers/iris/iris_context.h | 2 +- src/gallium/drivers/iris/iris_draw.c | 12 ++++++------ src/gallium/drivers/iris/iris_resolve.c | 15 ++++++++++++--- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index f3a5bdb7eb8..3cd03850e1b 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -792,8 +792,8 @@ void iris_resolve_conditional_render(struct iris_context *ice); void iris_predraw_resolve_inputs(struct iris_context *ice, struct iris_batch *batch, - struct iris_shader_state *shs, bool *draw_aux_buffer_disabled, + gl_shader_stage stage, bool consider_framebuffer); void iris_predraw_resolve_framebuffer(struct iris_context *ice, struct iris_batch *batch, diff --git a/src/gallium/drivers/iris/iris_draw.c b/src/gallium/drivers/iris/iris_draw.c index e30f12974fb..093e11b7435 100644 --- a/src/gallium/drivers/iris/iris_draw.c +++ b/src/gallium/drivers/iris/iris_draw.c @@ -135,9 +135,10 @@ iris_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) 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]) - iris_predraw_resolve_inputs(ice,batch, &ice->state.shaders[stage], - draw_aux_buffer_disabled, true); + 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); @@ -214,9 +215,8 @@ 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... */ - iris_predraw_resolve_inputs(ice, &ice->batches[IRIS_BATCH_RENDER], - &ice->state.shaders[MESA_SHADER_COMPUTE], - NULL, false); + iris_predraw_resolve_inputs(ice, &ice->batches[IRIS_BATCH_RENDER], NULL, + MESA_SHADER_COMPUTE, false); iris_batch_maybe_flush(batch, 1500); diff --git a/src/gallium/drivers/iris/iris_resolve.c b/src/gallium/drivers/iris/iris_resolve.c index 108a6e718d2..b7a1e6ec913 100644 --- a/src/gallium/drivers/iris/iris_resolve.c +++ b/src/gallium/drivers/iris/iris_resolve.c @@ -149,12 +149,21 @@ resolve_image_views(struct iris_context *ice, void iris_predraw_resolve_inputs(struct iris_context *ice, struct iris_batch *batch, - struct iris_shader_state *shs, bool *draw_aux_buffer_disabled, + gl_shader_stage stage, bool consider_framebuffer) { - resolve_sampler_views(ice, batch, shs, draw_aux_buffer_disabled, consider_framebuffer); - resolve_image_views(ice, batch, shs, draw_aux_buffer_disabled, consider_framebuffer); + struct iris_shader_state *shs = &ice->state.shaders[stage]; + + uint64_t dirty = (IRIS_DIRTY_BINDINGS_VS << stage) | + (consider_framebuffer ? IRIS_DIRTY_BINDINGS_FS : 0); + + if (ice->state.dirty & dirty) { + resolve_sampler_views(ice, batch, shs, draw_aux_buffer_disabled, + consider_framebuffer); + resolve_image_views(ice, batch, shs, draw_aux_buffer_disabled, + consider_framebuffer); + } // XXX: ASTC hacks } -- 2.30.2