aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/iris/iris_state.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2019-09-10 11:14:57 -0700
committerKenneth Graunke <[email protected]>2019-09-18 15:44:22 -0700
commitdd83ef0d1a14b144c562129b5572f9ebdbe56042 (patch)
tree6a1c6df6676d2cd4ebae6570304020a025838bc5 /src/gallium/drivers/iris/iris_state.c
parent1e7daaa6c9a1bcf5f1ae7d85519e61f78cf91518 (diff)
iris: Track per-stage bind history, reduce work accordingly
We now track per-stage bind history for constant and shader buffers, shader images, and sampler views by adding an extra res->bind_stages field to go with res->bind_history. This lets us flag IRIS_DIRTY_CONSTANTS for only the specific stages involved, and also skip some CPU overhead in iris_rebind_buffer. Cuts 4% of 3DSTATE_CONSTANT_XS packets in a Shadow of Mordor trace on Icelake. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Diffstat (limited to 'src/gallium/drivers/iris/iris_state.c')
-rw-r--r--src/gallium/drivers/iris/iris_state.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 99e4a84c414..fad3a7fdcfd 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -2305,6 +2305,7 @@ iris_set_shader_images(struct pipe_context *ctx,
shs->bound_image_views |= 1 << (start_slot + i);
res->bind_history |= PIPE_BIND_SHADER_IMAGE;
+ res->bind_stages |= 1 << stage;
isl_surf_usage_flags_t usage = ISL_SURF_USAGE_STORAGE_BIT;
enum isl_format isl_fmt =
@@ -2409,6 +2410,8 @@ iris_set_sampler_views(struct pipe_context *ctx,
struct iris_sampler_view *view = (void *) pview;
if (view) {
view->res->bind_history |= PIPE_BIND_SAMPLER_VIEW;
+ view->res->bind_stages |= 1 << stage;
+
shs->bound_sampler_views |= 1 << (start + i);
}
}
@@ -2756,6 +2759,7 @@ iris_set_constant_buffer(struct pipe_context *ctx,
struct iris_resource *res = (void *) cbuf->buffer;
res->bind_history |= PIPE_BIND_CONSTANT_BUFFER;
+ res->bind_stages |= 1 << stage;
iris_upload_ubo_ssbo_surf_state(ice, cbuf,
&shs->constbuf_surf_state[index],
@@ -2888,6 +2892,7 @@ iris_set_shader_buffers(struct pipe_context *ctx,
iris_upload_ubo_ssbo_surf_state(ice, ssbo, surf_state, true);
res->bind_history |= PIPE_BIND_SHADER_BUFFER;
+ res->bind_stages |= 1 << stage;
util_range_add(&res->valid_buffer_range, ssbo->buffer_offset,
ssbo->buffer_offset + ssbo->buffer_size);
@@ -6046,6 +6051,9 @@ iris_rebind_buffer(struct iris_context *ice,
struct iris_shader_state *shs = &ice->state.shaders[s];
enum pipe_shader_type p_stage = stage_to_pipe(s);
+ if (!(res->bind_stages & (1 << s)))
+ continue;
+
if (res->bind_history & PIPE_BIND_CONSTANT_BUFFER) {
/* Skip constant buffer 0, it's for regular uniforms, not UBOs */
uint32_t bound_cbufs = shs->bound_cbufs & ~1u;