diff options
author | Your Name <you@example.com> | 2017-09-18 15:25:07 +0300 |
---|---|---|
committer | Topi Pohjolainen <topi.pohjolainen@intel.com> | 2017-09-19 16:48:34 +0300 |
commit | d94130e05175f6d9554e88c83267d6fb5f501694 (patch) | |
tree | 964090f21a4646446d019f36ae12f014ed1fc83c | |
parent | 7a62f8621ac0d0d0604f3bf1c9a492050b44d1e8 (diff) |
i965: Always use push constants for pixel shaderfoo
Works around a HW bug resulting into GPU hang on Broxton.
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
-rw-r--r-- | src/intel/blorp/blorp.c | 2 | ||||
-rw-r--r-- | src/intel/compiler/brw_compiler.h | 3 | ||||
-rw-r--r-- | src/intel/compiler/brw_fs.cpp | 11 | ||||
-rw-r--r-- | src/intel/compiler/brw_fs.h | 1 | ||||
-rw-r--r-- | src/intel/vulkan/anv_pipeline.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_constant_state.c | 8 |
7 files changed, 24 insertions, 6 deletions
diff --git a/src/intel/blorp/blorp.c b/src/intel/blorp/blorp.c index a426a030d2..b2ca71b0fe 100644 --- a/src/intel/blorp/blorp.c +++ b/src/intel/blorp/blorp.c @@ -194,7 +194,7 @@ blorp_compile_fs(struct blorp_context *blorp, void *mem_ctx, const unsigned *program = brw_compile_fs(compiler, blorp->driver_ctx, mem_ctx, wm_key, wm_prog_data, nir, NULL, -1, -1, false, use_repclear, - NULL, program_size, NULL); + false, NULL, program_size, NULL); return program; } diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h index 6753a8daf0..74efe1cd37 100644 --- a/src/intel/compiler/brw_compiler.h +++ b/src/intel/compiler/brw_compiler.h @@ -1122,7 +1122,8 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data, int shader_time_index8, int shader_time_index16, bool allow_spilling, - bool use_rep_send, struct brw_vue_map *vue_map, + bool use_rep_send, bool force_enable_push_constants, + struct brw_vue_map *vue_map, unsigned *final_assembly_size, char **error_str); diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index eb9b4c3890..d3d2d3dd42 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -2082,6 +2082,12 @@ fs_visitor::assign_constant_locations() if (thread_local_id_index >= 0) push_constant_loc[thread_local_id_index] = num_push_constants++; + if (stage == MESA_SHADER_FRAGMENT && num_push_constants == 0 && + force_enable_push_constants) { + assert(uniforms == 0); + num_push_constants = 1; + } + /* As the uniforms are going to be reordered, take the data from a temporary * copy of the original param[]. */ @@ -6505,7 +6511,8 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data, struct gl_program *prog, int shader_time_index8, int shader_time_index16, bool allow_spilling, - bool use_rep_send, struct brw_vue_map *vue_map, + bool use_rep_send, bool force_enable_push_constants, + struct brw_vue_map *vue_map, unsigned *final_assembly_size, char **error_str) { @@ -6560,6 +6567,7 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data, fs_visitor v8(compiler, log_data, mem_ctx, key, &prog_data->base, prog, shader, 8, shader_time_index8); + v8.force_enable_push_constants = force_enable_push_constants; if (!v8.run_fs(allow_spilling, false /* do_rep_send */)) { if (error_str) *error_str = ralloc_strdup(mem_ctx, v8.fail_msg); @@ -6577,6 +6585,7 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data, fs_visitor v16(compiler, log_data, mem_ctx, key, &prog_data->base, prog, shader, 16, shader_time_index16); + v16.force_enable_push_constants = force_enable_push_constants; v16.import_uniforms(&v8); if (!v16.run_fs(allow_spilling, use_rep_send)) { compiler->shader_perf_log(log_data, diff --git a/src/intel/compiler/brw_fs.h b/src/intel/compiler/brw_fs.h index f1ba193de7..0736cb35d2 100644 --- a/src/intel/compiler/brw_fs.h +++ b/src/intel/compiler/brw_fs.h @@ -348,6 +348,7 @@ public: bool source_depth_to_render_target; bool runtime_check_aads_emit; + bool force_enable_push_constants; fs_reg pixel_x; fs_reg pixel_y; diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 94e99d8437..4dc5cc4fc7 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -928,7 +928,8 @@ anv_pipeline_compile_fs(struct anv_pipeline *pipeline, unsigned code_size; const unsigned *shader_code = brw_compile_fs(compiler, NULL, mem_ctx, &key, &prog_data, nir, - NULL, -1, -1, true, false, NULL, &code_size, NULL); + NULL, -1, -1, true, false, false, + NULL, &code_size, NULL); if (shader_code == NULL) { ralloc_free(mem_ctx); return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 92354e464c..d03f93b325 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -193,7 +193,7 @@ brw_codegen_wm_prog(struct brw_context *brw, program = brw_compile_fs(brw->screen->compiler, brw, mem_ctx, key, &prog_data, fp->program.nir, &fp->program, st_index8, st_index16, - true, false, vue_map, + true, false, true, vue_map, &program_size, &error_str); if (program == NULL) { diff --git a/src/mesa/drivers/dri/i965/gen6_constant_state.c b/src/mesa/drivers/dri/i965/gen6_constant_state.c index 72f00d5640..4f20aaa45e 100644 --- a/src/mesa/drivers/dri/i965/gen6_constant_state.c +++ b/src/mesa/drivers/dri/i965/gen6_constant_state.c @@ -81,9 +81,15 @@ gen6_upload_push_constants(struct brw_context *brw, * Also _NEW_TRANSFORM -- we may reference clip planes other than as a * side effect of dereferencing uniforms, so _NEW_PROGRAM_CONSTANTS * wouldn't be set for them. + * + * In order to workaround a GPU hang on Broxton pixel shader gets + * always programmed with push constant support. In such case nr_params + * is non-zero but the backing storage doesn't exist - simply skip the + * copy and use unitialised which doesn't really get used by the shader. */ for (i = 0; i < prog_data->nr_params; i++) { - param[i] = *prog_data->param[i]; + if (prog_data->param[i]) + param[i] = *prog_data->param[i]; } if (0) { |