From: Kenneth Graunke Date: Wed, 25 Jul 2018 05:14:37 +0000 (-0700) Subject: iris: Don't reserve new binding table section unless things are dirty X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8e7b0deee24c51f92dfc5c6577ed50abe1e3690c;p=mesa.git iris: Don't reserve new binding table section unless things are dirty --- diff --git a/src/gallium/drivers/iris/iris_binder.c b/src/gallium/drivers/iris/iris_binder.c index 2f5318ed7fd..07e8fe83ecf 100644 --- a/src/gallium/drivers/iris/iris_binder.c +++ b/src/gallium/drivers/iris/iris_binder.c @@ -61,13 +61,17 @@ iris_binder_reserve(struct iris_batch *batch, unsigned size) */ void iris_binder_reserve_3d(struct iris_batch *batch, - struct iris_compiled_shader **shaders) + struct iris_context *ice) { + struct iris_compiled_shader **shaders = ice->shaders.prog; struct iris_binder *binder = &batch->binder; unsigned total_size = 0; unsigned sizes[MESA_SHADER_STAGES] = {}; for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) { + if (!(ice->state.dirty & (IRIS_DIRTY_BINDINGS_VS << stage))) + continue; + if (!shaders[stage]) continue; @@ -78,10 +82,16 @@ iris_binder_reserve_3d(struct iris_batch *batch, total_size += sizes[stage]; } + if (total_size == 0) + return; + uint32_t offset = iris_binder_reserve(batch, total_size); /* Assign space and record the current binding table. */ for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) { + if (!(ice->state.dirty & (IRIS_DIRTY_BINDINGS_VS << stage))) + continue; + binder->bt_offset[stage] = sizes[stage] > 0 ? offset : 0; offset += sizes[stage]; } diff --git a/src/gallium/drivers/iris/iris_binder.h b/src/gallium/drivers/iris/iris_binder.h index dbb010693f5..e198cec415c 100644 --- a/src/gallium/drivers/iris/iris_binder.h +++ b/src/gallium/drivers/iris/iris_binder.h @@ -32,6 +32,7 @@ struct iris_bo; struct iris_batch; struct iris_bufmgr; struct iris_compiled_shader; +struct iris_context; struct iris_binder { @@ -53,6 +54,6 @@ bool iris_binder_is_empty(struct iris_binder *binder); void iris_destroy_binder(struct iris_binder *binder); uint32_t iris_binder_reserve(struct iris_batch *batch, unsigned size); void iris_binder_reserve_3d(struct iris_batch *batch, - struct iris_compiled_shader **shaders); + struct iris_context *ice); #endif diff --git a/src/gallium/drivers/iris/iris_draw.c b/src/gallium/drivers/iris/iris_draw.c index f12e317e016..1a12e4ce0d9 100644 --- a/src/gallium/drivers/iris/iris_draw.c +++ b/src/gallium/drivers/iris/iris_draw.c @@ -67,7 +67,7 @@ iris_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) } // XXX: don't do this unless things are dirty... - iris_binder_reserve_3d(batch, ice->shaders.prog); + iris_binder_reserve_3d(batch, ice); ice->vtbl.upload_render_state(ice, batch, info); ice->state.dirty = 0ull;