diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/iris/iris_context.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_program.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_state.c | 28 |
3 files changed, 37 insertions, 6 deletions
diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index e5d2372358c..cc28af26375 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -485,6 +485,8 @@ void iris_init_resource_functions(struct pipe_context *ctx); void iris_init_query_functions(struct pipe_context *ctx); void iris_update_compiled_shaders(struct iris_context *ice); void iris_update_compiled_compute_shader(struct iris_context *ice); +void iris_fill_cs_push_const_buffer(struct brw_cs_prog_data *cs_prog_data, + uint32_t *dst); /* iris_blit.c */ diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 4aba8d0bfe3..ed72c2848e2 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -1059,6 +1059,19 @@ iris_update_compiled_compute_shader(struct iris_context *ice) } void +iris_fill_cs_push_const_buffer(struct brw_cs_prog_data *cs_prog_data, + uint32_t *dst) +{ + struct brw_stage_prog_data *prog_data = &cs_prog_data->base; + assert(cs_prog_data->push.total.size > 0); + assert(cs_prog_data->push.cross_thread.size == 0); + assert(cs_prog_data->push.per_thread.dwords == 1); + assert(prog_data->param[0] == BRW_PARAM_BUILTIN_SUBGROUP_ID); + for (unsigned t = 0; t < cs_prog_data->threads; t++) + dst[8 * t] = t; +} + +void iris_init_program_functions(struct pipe_context *ctx) { ctx->create_vs_state = iris_create_shader_state; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 313b3e979ad..5931907f814 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -4357,12 +4357,23 @@ iris_upload_compute_state(struct iris_context *ice, // XXX: hack iris_set_constant_buffers to upload compute shader constants // XXX: differently...? - if (cs_prog_data->push.total.size > 0) { - iris_emit_cmd(batch, GENX(MEDIA_CURBE_LOAD), curbe) { - curbe.CURBETotalDataLength = - ALIGN(cs_prog_data->push.total.size, 64); - // XXX: curbe.CURBEDataStartAddress = stage_state->push_const_offset; - } + uint32_t curbe_data_offset = 0; + // TODO: Move subgroup-id into uniforms ubo so we can push uniforms + assert(cs_prog_data->push.cross_thread.dwords == 0 && + cs_prog_data->push.per_thread.dwords == 1 && + cs_prog_data->base.param[0] == BRW_PARAM_BUILTIN_SUBGROUP_ID); + struct pipe_resource *curbe_data_res = NULL; + uint32_t *curbe_data_map = + stream_state(batch, ice->state.dynamic_uploader, &curbe_data_res, + ALIGN(cs_prog_data->push.total.size, 64), 64, + &curbe_data_offset); + assert(curbe_data_map); + memset(curbe_data_map, 0x5a, ALIGN(cs_prog_data->push.total.size, 64)); + iris_fill_cs_push_const_buffer(cs_prog_data, curbe_data_map); + iris_emit_cmd(batch, GENX(MEDIA_CURBE_LOAD), curbe) { + curbe.CURBETotalDataLength = + ALIGN(cs_prog_data->push.total.size, 64); + curbe.CURBEDataStartAddress = curbe_data_offset; } struct pipe_resource *desc_res = NULL; @@ -4371,6 +4382,11 @@ iris_upload_compute_state(struct iris_context *ice, iris_pack_state(GENX(INTERFACE_DESCRIPTOR_DATA), desc, idd) { idd.SamplerStatePointer = shs->sampler_table.offset; idd.BindingTablePointer = binder->bt_offset[MESA_SHADER_COMPUTE]; + idd.ConstantURBEntryReadLength = cs_prog_data->push.per_thread.regs; +#if GEN_GEN >= 8 || GEN_IS_HASWELL + idd.CrossThreadConstantDataReadLength = + cs_prog_data->push.cross_thread.regs; +#endif } for (int i = 0; i < GENX(INTERFACE_DESCRIPTOR_DATA_length); i++) |