diff options
author | Jordan Justen <[email protected]> | 2018-09-19 12:25:18 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-02-21 10:26:09 -0800 |
commit | 6ebd04ac8fb65049351aba930ac5d4a27eb586f4 (patch) | |
tree | bcf71cb6721b40e0442539f09f70dc3e93a13fea | |
parent | 622aaa290fefc4bd7d2e1ddef83de7c0873aab67 (diff) |
iris: Add iris_restore_compute_saved_bos
Signed-off-by: Jordan Justen <[email protected]>
-rw-r--r-- | src/gallium/drivers/iris/iris_state.c | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 995cd312aad..9383617f0cd 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -3466,9 +3466,9 @@ iris_use_optional_res(struct iris_batch *batch, * refer to the old BOs. */ static void -iris_restore_context_saved_bos(struct iris_context *ice, - struct iris_batch *batch, - const struct pipe_draw_info *draw) +iris_restore_render_saved_bos(struct iris_context *ice, + struct iris_batch *batch, + const struct pipe_draw_info *draw) { // XXX: whack IRIS_SHADER_DIRTY_BINDING_TABLE on new batch @@ -3580,6 +3580,55 @@ iris_restore_context_saved_bos(struct iris_context *ice, } } +static void +iris_restore_compute_saved_bos(struct iris_context *ice, + struct iris_batch *batch, + const struct pipe_grid_info *grid) +{ + const uint64_t clean = ~ice->state.dirty; + + const int stage = MESA_SHADER_COMPUTE; + struct iris_shader_state *shs = &ice->state.shaders[stage]; + + if (clean & IRIS_DIRTY_CONSTANTS_CS) { + struct iris_compiled_shader *shader = ice->shaders.prog[stage]; + + if (shader) { + struct brw_stage_prog_data *prog_data = (void *) shader->prog_data; + const struct brw_ubo_range *range = &prog_data->ubo_ranges[0]; + + if (range->length > 0) { + struct iris_const_buffer *cbuf = &shs->constbuf[range->block]; + struct iris_resource *res = (void *) cbuf->data.res; + + if (res) + iris_use_pinned_bo(batch, res->bo, false); + else + iris_use_pinned_bo(batch, batch->screen->workaround_bo, false); + } + } + } + + if (clean & IRIS_DIRTY_BINDINGS_CS) { + /* Re-pin any buffers referred to by the binding table. */ + iris_populate_binding_table(ice, batch, stage, true); + } + + struct pipe_resource *sampler_res = shs->sampler_table.res; + if (sampler_res) + iris_use_pinned_bo(batch, iris_resource_bo(sampler_res), false); + + if (clean & IRIS_DIRTY_CS) { + struct iris_compiled_shader *shader = ice->shaders.prog[stage]; + if (shader) { + struct iris_bo *bo = iris_resource_bo(shader->assembly.res); + iris_use_pinned_bo(batch, bo, false); + } + + // XXX: scratch buffer + } +} + /** * Possibly emit STATE_BASE_ADDRESS to update Surface State Base Address. */ @@ -4194,7 +4243,7 @@ iris_upload_render_state(struct iris_context *ice, } if (!batch->contains_draw) { - iris_restore_context_saved_bos(ice, batch, draw); + iris_restore_render_saved_bos(ice, batch, draw); batch->contains_draw = true; } } @@ -4314,7 +4363,7 @@ iris_upload_compute_state(struct iris_context *ice, } if (!batch->contains_draw) { - //iris_restore_context_saved_bos(ice, batch, draw); + iris_restore_compute_saved_bos(ice, batch, grid); batch->contains_draw = true; } } |