aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/iris/iris_state.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-06-06 11:59:17 -0700
committerKenneth Graunke <[email protected]>2019-02-21 10:26:06 -0800
commit9ea05ccf1f20691cde6911762bce8207c7283714 (patch)
tree750f9b06da700a9d7b26e4fdaa1b7f59fb75c634 /src/gallium/drivers/iris/iris_state.c
parent26cc609927825aa72a1faa77701ac2359484084a (diff)
iris: completely rewrite binder
now we get a new one per batch, and flush if it fills up
Diffstat (limited to 'src/gallium/drivers/iris/iris_state.c')
-rw-r--r--src/gallium/drivers/iris/iris_state.c106
1 files changed, 56 insertions, 50 deletions
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index f8772315d1c..e0000c19887 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -2093,6 +2093,54 @@ use_sampler_view(struct iris_batch *batch, struct iris_sampler_view *isv)
}
static void
+iris_populate_binding_table(struct iris_context *ice,
+ struct iris_batch *batch,
+ gl_shader_stage stage)
+{
+ const struct iris_binder *binder = &batch->binder;
+ struct iris_compiled_shader *shader = ice->shaders.prog[stage];
+ if (!shader)
+ return;
+
+ // Surfaces:
+ // - pull constants
+ // - ubos/ssbos/abos
+ // - images
+ // - textures
+ // - render targets - write and read
+
+ struct brw_stage_prog_data *prog_data = (void *) shader->prog_data;
+ uint32_t *bt_map = binder->map + binder->bt_offset[stage];
+ int s = 0;
+
+ if (stage == MESA_SHADER_FRAGMENT) {
+ struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer;
+ for (unsigned i = 0; i < cso_fb->nr_cbufs; i++) {
+ bt_map[s++] = use_surface(batch, cso_fb->cbufs[i], true);
+ }
+ }
+
+ assert(prog_data->binding_table.texture_start ==
+ (ice->state.num_textures[stage] ? s : 0xd0d0d0d0));
+
+ for (int i = 0; i < ice->state.num_textures[stage]; i++) {
+ struct iris_sampler_view *view = ice->state.textures[stage][i];
+ bt_map[s++] = use_sampler_view(batch, view);
+ }
+
+#if 0
+ // XXX: not implemented yet
+ assert(prog_data->binding_table.pull_constants_start == 0xd0d0d0d0);
+ assert(prog_data->binding_table.ubo_start == 0xd0d0d0d0);
+ assert(prog_data->binding_table.ssbo_start == 0xd0d0d0d0);
+ assert(prog_data->binding_table.image_start == 0xd0d0d0d0);
+ assert(prog_data->binding_table.shader_time_start == 0xd0d0d0d0);
+ //assert(prog_data->binding_table.plane_start[1] == 0xd0d0d0d0);
+ //assert(prog_data->binding_table.plane_start[2] == 0xd0d0d0d0);
+#endif
+}
+
+static void
iris_upload_render_state(struct iris_context *ice,
struct iris_batch *batch,
const struct pipe_draw_info *draw)
@@ -2226,61 +2274,19 @@ iris_upload_render_state(struct iris_context *ice,
}
}
- // Surfaces:
- // - pull constants
- // - ubos/ssbos/abos
- // - images
- // - textures
- // - render targets - write and read
- // XXX: 3DSTATE_BINDING_TABLE_POINTERS_XS
-
- for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) {
- struct iris_compiled_shader *shader = ice->shaders.prog[stage];
- if (!shader) // XXX: dirty bits...also, emit a disable maybe?
- continue;
-
- struct brw_stage_prog_data *prog_data = (void *) shader->prog_data;
- uint32_t bt_offset = 0;
- uint32_t *bt_map = NULL;
- int s = 0;
-
- if (prog_data->binding_table.size_bytes != 0) {
- iris_use_pinned_bo(batch, ice->state.binder.bo, false);
- bt_map = iris_binder_reserve(&ice->state.binder,
- prog_data->binding_table.size_bytes,
- &bt_offset);
- }
+ if (1) { // XXX: DIRTY BINDINGS
+ const struct iris_binder *binder = &batch->binder;
- iris_emit_cmd(batch, GENX(3DSTATE_BINDING_TABLE_POINTERS_VS), ptr) {
- ptr._3DCommandSubOpcode = 38 + stage;
- ptr.PointertoVSBindingTable = bt_offset;
- }
-
- if (stage == MESA_SHADER_FRAGMENT) {
- struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer;
- for (unsigned i = 0; i < cso_fb->nr_cbufs; i++) {
- bt_map[s++] = use_surface(batch, cso_fb->cbufs[i], true);
+ for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) {
+ iris_emit_cmd(batch, GENX(3DSTATE_BINDING_TABLE_POINTERS_VS), ptr) {
+ ptr._3DCommandSubOpcode = 38 + stage;
+ ptr.PointertoVSBindingTable = binder->bt_offset[stage];
}
}
- assert(prog_data->binding_table.texture_start ==
- (ice->state.num_textures[stage] ? s : 0xd0d0d0d0));
-
- for (int i = 0; i < ice->state.num_textures[stage]; i++) {
- struct iris_sampler_view *view = ice->state.textures[stage][i];
- bt_map[s++] = use_sampler_view(batch, view);
+ for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) {
+ iris_populate_binding_table(ice, batch, stage);
}
-
-#if 0
- // XXX: not implemented yet
- assert(prog_data->binding_table.pull_constants_start == 0xd0d0d0d0);
- assert(prog_data->binding_table.ubo_start == 0xd0d0d0d0);
- assert(prog_data->binding_table.ssbo_start == 0xd0d0d0d0);
- assert(prog_data->binding_table.image_start == 0xd0d0d0d0);
- assert(prog_data->binding_table.shader_time_start == 0xd0d0d0d0);
- //assert(prog_data->binding_table.plane_start[1] == 0xd0d0d0d0);
- //assert(prog_data->binding_table.plane_start[2] == 0xd0d0d0d0);
-#endif
}
for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) {