diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2019-01-09 15:15:49 -0800 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2019-01-10 20:52:04 -0800 |
commit | ad9832d17b5b42f23081fcfabfe0ea4b1dea00df (patch) | |
tree | 5c9ef31e31c1d6324f3de1312430142e0ef5f826 /src/intel/blorp | |
parent | 084a1cdbb7f7e5cf8f8cee42d2edd3bfb58867ab (diff) |
blorp: Pass the batch to lookup/upload_shader instead of context
This will allow drivers to pin shader buffers if necessary.
i965 and anv do not need to do this today, but iris will.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'src/intel/blorp')
-rw-r--r-- | src/intel/blorp/blorp.c | 7 | ||||
-rw-r--r-- | src/intel/blorp/blorp.h | 4 | ||||
-rw-r--r-- | src/intel/blorp/blorp_blit.c | 12 | ||||
-rw-r--r-- | src/intel/blorp/blorp_clear.c | 40 | ||||
-rw-r--r-- | src/intel/blorp/blorp_priv.h | 2 |
5 files changed, 36 insertions, 29 deletions
diff --git a/src/intel/blorp/blorp.c b/src/intel/blorp/blorp.c index ffe26076e16..ecd4289db17 100644 --- a/src/intel/blorp/blorp.c +++ b/src/intel/blorp/blorp.c @@ -247,9 +247,10 @@ struct blorp_sf_key { }; bool -blorp_ensure_sf_program(struct blorp_context *blorp, +blorp_ensure_sf_program(struct blorp_batch *batch, struct blorp_params *params) { + struct blorp_context *blorp = batch->blorp; const struct brw_wm_prog_data *wm_prog_data = params->wm_prog_data; assert(params->wm_prog_data); @@ -276,7 +277,7 @@ blorp_ensure_sf_program(struct blorp_context *blorp, memcpy(key.key.interp_mode, wm_prog_data->interp_mode, sizeof(key.key.interp_mode)); - if (blorp->lookup_shader(blorp, &key, sizeof(key), + if (blorp->lookup_shader(batch, &key, sizeof(key), ¶ms->sf_prog_kernel, ¶ms->sf_prog_data)) return true; @@ -293,7 +294,7 @@ blorp_ensure_sf_program(struct blorp_context *blorp, &prog_data_tmp, &vue_map, &program_size); bool result = - blorp->upload_shader(blorp, &key, sizeof(key), program, program_size, + blorp->upload_shader(batch, &key, sizeof(key), program, program_size, (void *)&prog_data_tmp, sizeof(prog_data_tmp), ¶ms->sf_prog_kernel, ¶ms->sf_prog_data); diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h index 1e22712602d..3487ea7cf46 100644 --- a/src/intel/blorp/blorp.h +++ b/src/intel/blorp/blorp.h @@ -45,10 +45,10 @@ struct blorp_context { const struct brw_compiler *compiler; - bool (*lookup_shader)(struct blorp_context *blorp, + bool (*lookup_shader)(struct blorp_batch *batch, const void *key, uint32_t key_size, uint32_t *kernel_out, void *prog_data_out); - bool (*upload_shader)(struct blorp_context *blorp, + bool (*upload_shader)(struct blorp_batch *batch, const void *key, uint32_t key_size, const void *kernel, uint32_t kernel_size, const struct brw_stage_prog_data *prog_data, diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c index a5da7d015e2..70240b33728 100644 --- a/src/intel/blorp/blorp_blit.c +++ b/src/intel/blorp/blorp_blit.c @@ -1428,11 +1428,13 @@ brw_blorp_build_nir_shader(struct blorp_context *blorp, void *mem_ctx, } static bool -brw_blorp_get_blit_kernel(struct blorp_context *blorp, +brw_blorp_get_blit_kernel(struct blorp_batch *batch, struct blorp_params *params, const struct brw_blorp_blit_prog_key *prog_key) { - if (blorp->lookup_shader(blorp, prog_key, sizeof(*prog_key), + struct blorp_context *blorp = batch->blorp; + + if (blorp->lookup_shader(batch, prog_key, sizeof(*prog_key), ¶ms->wm_prog_kernel, ¶ms->wm_prog_data)) return true; @@ -1455,7 +1457,7 @@ brw_blorp_get_blit_kernel(struct blorp_context *blorp, &prog_data); bool result = - blorp->upload_shader(blorp, prog_key, sizeof(*prog_key), + blorp->upload_shader(batch, prog_key, sizeof(*prog_key), program, prog_data.base.program_size, &prog_data.base, sizeof(prog_data), ¶ms->wm_prog_kernel, ¶ms->wm_prog_data); @@ -2040,10 +2042,10 @@ try_blorp_blit(struct blorp_batch *batch, /* For some texture types, we need to pass the layer through the sampler. */ params->wm_inputs.src_z = params->src.z_offset; - if (!brw_blorp_get_blit_kernel(batch->blorp, params, wm_prog_key)) + if (!brw_blorp_get_blit_kernel(batch, params, wm_prog_key)) return 0; - if (!blorp_ensure_sf_program(batch->blorp, params)) + if (!blorp_ensure_sf_program(batch, params)) return 0; unsigned result = 0; diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c index 5b575dccc22..0b26755e90a 100644 --- a/src/intel/blorp/blorp_clear.c +++ b/src/intel/blorp/blorp_clear.c @@ -43,18 +43,20 @@ struct brw_blorp_const_color_prog_key }; static bool -blorp_params_get_clear_kernel(struct blorp_context *blorp, +blorp_params_get_clear_kernel(struct blorp_batch *batch, struct blorp_params *params, bool use_replicated_data, bool clear_rgb_as_red) { + struct blorp_context *blorp = batch->blorp; + const struct brw_blorp_const_color_prog_key blorp_key = { .shader_type = BLORP_SHADER_TYPE_CLEAR, .use_simd16_replicated_data = use_replicated_data, .clear_rgb_as_red = clear_rgb_as_red, }; - if (blorp->lookup_shader(blorp, &blorp_key, sizeof(blorp_key), + if (blorp->lookup_shader(batch, &blorp_key, sizeof(blorp_key), ¶ms->wm_prog_kernel, ¶ms->wm_prog_data)) return true; @@ -104,7 +106,7 @@ blorp_params_get_clear_kernel(struct blorp_context *blorp, &prog_data); bool result = - blorp->upload_shader(blorp, &blorp_key, sizeof(blorp_key), + blorp->upload_shader(batch, &blorp_key, sizeof(blorp_key), program, prog_data.base.program_size, &prog_data.base, sizeof(prog_data), ¶ms->wm_prog_kernel, ¶ms->wm_prog_data); @@ -126,9 +128,10 @@ struct layer_offset_vs_key { * vertex shader. */ static bool -blorp_params_get_layer_offset_vs(struct blorp_context *blorp, +blorp_params_get_layer_offset_vs(struct blorp_batch *batch, struct blorp_params *params) { + struct blorp_context *blorp = batch->blorp; struct layer_offset_vs_key blorp_key = { .shader_type = BLORP_SHADER_TYPE_LAYER_OFFSET_VS, }; @@ -136,7 +139,7 @@ blorp_params_get_layer_offset_vs(struct blorp_context *blorp, if (params->wm_prog_data) blorp_key.num_inputs = params->wm_prog_data->num_varying_inputs; - if (blorp->lookup_shader(blorp, &blorp_key, sizeof(blorp_key), + if (blorp->lookup_shader(batch, &blorp_key, sizeof(blorp_key), ¶ms->vs_prog_kernel, ¶ms->vs_prog_data)) return true; @@ -194,7 +197,7 @@ blorp_params_get_layer_offset_vs(struct blorp_context *blorp, blorp_compile_vs(blorp, mem_ctx, b.shader, &vs_prog_data); bool result = - blorp->upload_shader(blorp, &blorp_key, sizeof(blorp_key), + blorp->upload_shader(batch, &blorp_key, sizeof(blorp_key), program, vs_prog_data.base.base.program_size, &vs_prog_data.base.base, sizeof(vs_prog_data), ¶ms->vs_prog_kernel, ¶ms->vs_prog_data); @@ -351,7 +354,7 @@ blorp_fast_clear(struct blorp_batch *batch, get_fast_clear_rect(batch->blorp->isl_dev, surf->aux_surf, ¶ms.x0, ¶ms.y0, ¶ms.x1, ¶ms.y1); - if (!blorp_params_get_clear_kernel(batch->blorp, ¶ms, true, false)) + if (!blorp_params_get_clear_kernel(batch, ¶ms, true, false)) return; brw_blorp_surface_info_init(batch->blorp, ¶ms.dst, surf, level, @@ -453,12 +456,12 @@ blorp_clear(struct blorp_batch *batch, } } - if (!blorp_params_get_clear_kernel(batch->blorp, ¶ms, + if (!blorp_params_get_clear_kernel(batch, ¶ms, use_simd16_replicated_data, clear_rgb_as_red)) return; - if (!blorp_ensure_sf_program(batch->blorp, ¶ms)) + if (!blorp_ensure_sf_program(batch, ¶ms)) return; while (num_layers > 0) { @@ -589,7 +592,7 @@ blorp_clear_depth_stencil(struct blorp_batch *batch, * we disable statistics in 3DSTATE_WM. Give it the usual clear shader * to work around the issue. */ - if (!blorp_params_get_clear_kernel(batch->blorp, ¶ms, false, false)) + if (!blorp_params_get_clear_kernel(batch, ¶ms, false, false)) return; } @@ -829,7 +832,7 @@ blorp_clear_attachments(struct blorp_batch *batch, * is tiled or not, we have to assume it may be linear. This means no * SIMD16_REPDATA for us. :-( */ - if (!blorp_params_get_clear_kernel(batch->blorp, ¶ms, false, false)) + if (!blorp_params_get_clear_kernel(batch, ¶ms, false, false)) return; } @@ -847,7 +850,7 @@ blorp_clear_attachments(struct blorp_batch *batch, params.stencil_ref = stencil_value; } - if (!blorp_params_get_layer_offset_vs(batch->blorp, ¶ms)) + if (!blorp_params_get_layer_offset_vs(batch, ¶ms)) return; params.vs_inputs.base_layer = start_layer; @@ -914,7 +917,7 @@ blorp_ccs_resolve(struct blorp_batch *batch, * color" message. */ - if (!blorp_params_get_clear_kernel(batch->blorp, ¶ms, true, false)) + if (!blorp_params_get_clear_kernel(batch, ¶ms, true, false)) return; batch->blorp->exec(batch, ¶ms); @@ -936,9 +939,10 @@ struct blorp_mcs_partial_resolve_key }; static bool -blorp_params_get_mcs_partial_resolve_kernel(struct blorp_context *blorp, +blorp_params_get_mcs_partial_resolve_kernel(struct blorp_batch *batch, struct blorp_params *params) { + struct blorp_context *blorp = batch->blorp; const struct blorp_mcs_partial_resolve_key blorp_key = { .shader_type = BLORP_SHADER_TYPE_MCS_PARTIAL_RESOLVE, .indirect_clear_color = params->dst.clear_color_addr.buffer != NULL, @@ -946,7 +950,7 @@ blorp_params_get_mcs_partial_resolve_kernel(struct blorp_context *blorp, .num_samples = params->num_samples, }; - if (blorp->lookup_shader(blorp, &blorp_key, sizeof(blorp_key), + if (blorp->lookup_shader(batch, &blorp_key, sizeof(blorp_key), ¶ms->wm_prog_kernel, ¶ms->wm_prog_data)) return true; @@ -1002,7 +1006,7 @@ blorp_params_get_mcs_partial_resolve_kernel(struct blorp_context *blorp, &prog_data); bool result = - blorp->upload_shader(blorp, &blorp_key, sizeof(blorp_key), + blorp->upload_shader(batch, &blorp_key, sizeof(blorp_key), program, prog_data.base.program_size, &prog_data.base, sizeof(prog_data), ¶ms->wm_prog_kernel, ¶ms->wm_prog_data); @@ -1039,7 +1043,7 @@ blorp_mcs_partial_resolve(struct blorp_batch *batch, memcpy(¶ms.wm_inputs.clear_color, surf->clear_color.f32, sizeof(float) * 4); - if (!blorp_params_get_mcs_partial_resolve_kernel(batch->blorp, ¶ms)) + if (!blorp_params_get_mcs_partial_resolve_kernel(batch, ¶ms)) return; batch->blorp->exec(batch, ¶ms); @@ -1192,7 +1196,7 @@ blorp_ccs_ambiguate(struct blorp_batch *batch, memset(¶ms.wm_inputs.clear_color, 0, sizeof(params.wm_inputs.clear_color)); - if (!blorp_params_get_clear_kernel(batch->blorp, ¶ms, true, false)) + if (!blorp_params_get_clear_kernel(batch, ¶ms, true, false)) return; batch->blorp->exec(batch, ¶ms); diff --git a/src/intel/blorp/blorp_priv.h b/src/intel/blorp/blorp_priv.h index a6aa2aa4151..b351e6bf584 100644 --- a/src/intel/blorp/blorp_priv.h +++ b/src/intel/blorp/blorp_priv.h @@ -360,7 +360,7 @@ blorp_compile_vs(struct blorp_context *blorp, void *mem_ctx, struct brw_vs_prog_data *vs_prog_data); bool -blorp_ensure_sf_program(struct blorp_context *blorp, +blorp_ensure_sf_program(struct blorp_batch *batch, struct blorp_params *params); /** \} */ |