From: Kenneth Graunke Date: Fri, 26 Jan 2018 04:12:37 +0000 (-0800) Subject: iris: actually set KSP offsets X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b1115799e678f69ec679377ead597a5c63306d1b;p=mesa.git iris: actually set KSP offsets --- diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 27c0b13f72d..3d16cfedc31 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -92,7 +92,7 @@ struct iris_compiled_shader { struct pipe_resource *buffer; /** Offset where the assembly lives in the BO. */ - unsigned prog_offset; + unsigned offset; /** Pointer to the assembly in the BO's map. */ void *map; diff --git a/src/gallium/drivers/iris/iris_program_cache.c b/src/gallium/drivers/iris/iris_program_cache.c index 5ee0dae0467..7fc318c862c 100644 --- a/src/gallium/drivers/iris/iris_program_cache.c +++ b/src/gallium/drivers/iris/iris_program_cache.c @@ -204,11 +204,11 @@ iris_upload_and_bind_shader(struct iris_context *ice, * backend. */ if (existing) { - shader->prog_offset = existing->prog_offset; + shader->offset = existing->offset; } else { shader->buffer = NULL; u_upload_alloc(ice->shaders.uploader, 0, prog_data->program_size, - 64, &shader->prog_offset, &shader->buffer, &shader->map); + 64, &shader->offset, &shader->buffer, &shader->map); memcpy(shader->map, assembly, prog_data->program_size); } diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 01be4b86c3a..10b81859bd3 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -1437,8 +1437,15 @@ iris_populate_fs_key(const struct iris_context *ice, //pkt.PerThreadScratchSpace = prog_data->total_scratch == 0 ? 0 : \ //ffs(stage_state->per_thread_scratch) - 11; \ +static uint64_t +KSP(const struct iris_compiled_shader *shader) +{ + struct iris_resource *res = (void *) shader->buffer; + return res->bo->gtt_offset + shader->offset; +} + #define INIT_THREAD_DISPATCH_FIELDS(pkt, prefix) \ - pkt.KernelStartPointer = shader->prog_offset; \ + pkt.KernelStartPointer = KSP(shader); \ pkt.BindingTableEntryCount = prog_data->binding_table.size_bytes / 4; \ pkt.FloatingPointMode = prog_data->use_alt_mode; \ \ @@ -1610,11 +1617,11 @@ iris_set_fs_state(const struct gen_device_info *devinfo, brw_wm_prog_data_dispatch_grf_start_reg(wm_prog_data, ps, 2); ps.KernelStartPointer0 = - shader->prog_offset + brw_wm_prog_data_prog_offset(wm_prog_data, ps, 0); + KSP(shader) + brw_wm_prog_data_prog_offset(wm_prog_data, ps, 0); ps.KernelStartPointer1 = - shader->prog_offset + brw_wm_prog_data_prog_offset(wm_prog_data, ps, 1); + KSP(shader) + brw_wm_prog_data_prog_offset(wm_prog_data, ps, 1); ps.KernelStartPointer2 = - shader->prog_offset + brw_wm_prog_data_prog_offset(wm_prog_data, ps, 2); + KSP(shader) + brw_wm_prog_data_prog_offset(wm_prog_data, ps, 2); } iris_pack_command(GENX(3DSTATE_PS_EXTRA), psx_state, psx) {