From 3219b48ae5a5b1288bf1fc1325ebbc7ac9e236df Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 30 Sep 2015 15:00:39 +0000 Subject: [PATCH 01/11] gallium/radeon: Use call_once() when initailizing LLVM targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Reviewed-by: Mathias Fröhlich Reviewed-by: Emil Velikov CC: "10.6 11.0" --- src/gallium/drivers/radeon/radeon_llvm_emit.c | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c index 3acbd02643e..ff30a14b0af 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.c +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c @@ -25,6 +25,7 @@ */ #include "radeon_llvm_emit.h" #include "radeon_elf_util.h" +#include "c11/threads.h" #include "util/u_memory.h" #include "pipe/p_shader_tokens.h" @@ -86,30 +87,28 @@ void radeon_llvm_shader_type(LLVMValueRef F, unsigned type) static void init_r600_target() { - static unsigned initialized = 0; - if (!initialized) { #if HAVE_LLVM < 0x0307 - LLVMInitializeR600TargetInfo(); - LLVMInitializeR600Target(); - LLVMInitializeR600TargetMC(); - LLVMInitializeR600AsmPrinter(); + LLVMInitializeR600TargetInfo(); + LLVMInitializeR600Target(); + LLVMInitializeR600TargetMC(); + LLVMInitializeR600AsmPrinter(); #else - LLVMInitializeAMDGPUTargetInfo(); - LLVMInitializeAMDGPUTarget(); - LLVMInitializeAMDGPUTargetMC(); - LLVMInitializeAMDGPUAsmPrinter(); + LLVMInitializeAMDGPUTargetInfo(); + LLVMInitializeAMDGPUTarget(); + LLVMInitializeAMDGPUTargetMC(); + LLVMInitializeAMDGPUAsmPrinter(); #endif - initialized = 1; - } } +static once_flag init_r600_target_once_flag = ONCE_FLAG_INIT; + LLVMTargetRef radeon_llvm_get_r600_target(const char *triple) { LLVMTargetRef target = NULL; char *err_message = NULL; - init_r600_target(); + call_once(&init_r600_target_once_flag, init_r600_target); if (LLVMGetTargetFromTriple(triple, &target, &err_message)) { fprintf(stderr, "Cannot find target for triple %s ", triple); From 76cfd6f1da3748effb480e4f1151910af59fb88a Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 24 Sep 2015 15:57:02 +0000 Subject: [PATCH 02/11] gallivm: Allow drivers and state trackers to initialize gallivm LLVM targets v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drivers and state trackers that use LLVM for generating code, must register the targets they use with LLVM's global TargetRegistry. The TargetRegistry is not thread-safe, so all targets must be added to the registry before it can be queried for target information. When drivers and state trackers initialize their own targets, they need a way to force gallivm to initialize its targets at the same time. Otherwise, there can be a race condition in some multi-threaded applications (e.g. glx-multihreaded-shader-compile in piglit), when one thread creates a context for a driver that uses LLVM (e.g. radeonsi) and another thread creates a gallivm context (glxContextCreate does this). The race happens when the driver thread initializes its LLVM targets and then starts using the registry before the gallivm thread has a chance to register its targets. This patch allows users to force gallivm to register its targets by calling the gallivm_init_llvm_targets() function. v2: - Use call_once and remove mutexes and static initializations. - Replace gallivm_init_llvm_{begin,end}() with gallivm_init_llvm_targets(). Reviewed-by: Marek Olšák Reviewed-by: Mathias Fröhlich Reviewed-by: Emil Velikov CC: "10.6 11.0" --- src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 37 +++++++++++++++---- src/gallium/auxiliary/gallivm/lp_bld_misc.h | 2 + src/gallium/targets/opencl/Makefile.am | 3 +- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 5e25819ac55..72fab8ccf06 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -81,6 +81,8 @@ # pragma pop_macro("DEBUG") #endif +#include "c11/threads.h" +#include "os/os_thread.h" #include "pipe/p_config.h" #include "util/u_debug.h" #include "util/u_cpu_detect.h" @@ -103,6 +105,33 @@ static LLVMEnsureMultithreaded lLVMEnsureMultithreaded; } +static once_flag init_native_targets_once_flag; + +static void init_native_targets() +{ + // If we have a native target, initialize it to ensure it is linked in and + // usable by the JIT. + llvm::InitializeNativeTarget(); + + llvm::InitializeNativeTargetAsmPrinter(); + + llvm::InitializeNativeTargetDisassembler(); +} + +/** + * The llvm target registry is not thread-safe, so drivers and state-trackers + * that want to initialize targets should use the gallivm_init_llvm_targets() + * function to safely initialize targets. + * + * LLVM targets should be initialized before the driver or state-tracker tries + * to access the registry. + */ +extern "C" void +gallivm_init_llvm_targets(void) +{ + call_once(&init_native_targets_once_flag, init_native_targets); +} + extern "C" void lp_set_target_options(void) { @@ -115,13 +144,7 @@ lp_set_target_options(void) llvm::DisablePrettyStackTrace = true; #endif - // If we have a native target, initialize it to ensure it is linked in and - // usable by the JIT. - llvm::InitializeNativeTarget(); - - llvm::InitializeNativeTargetAsmPrinter(); - - llvm::InitializeNativeTargetDisassembler(); + gallivm_init_llvm_targets(); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/src/gallium/auxiliary/gallivm/lp_bld_misc.h index 36923aa423f..86d2f86ac45 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h @@ -41,6 +41,8 @@ extern "C" { struct lp_generated_code; +extern void +gallivm_init_llvm_targets(void); extern void lp_set_target_options(void); diff --git a/src/gallium/targets/opencl/Makefile.am b/src/gallium/targets/opencl/Makefile.am index 4ab706ef2ac..c78b26832ff 100644 --- a/src/gallium/targets/opencl/Makefile.am +++ b/src/gallium/targets/opencl/Makefile.am @@ -35,7 +35,8 @@ lib@OPENCL_LIBNAME@_la_LIBADD = \ -lclangEdit \ -lclangLex \ -lclangBasic \ - $(LLVM_LIBS) + $(LLVM_LIBS) \ + $(PTHREAD_LIBS) nodist_EXTRA_lib@OPENCL_LIBNAME@_la_SOURCES = dummy.cpp lib@OPENCL_LIBNAME@_la_SOURCES = From a2e1e3d325a70604151ef093ed741e60d078a21a Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 24 Sep 2015 16:29:56 +0000 Subject: [PATCH 03/11] radeon/llvm: Initialize gallivm targets when initializing the AMDGPU target v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a race condition in the glx-multithreaded-shader-compile test. v2: - Replace gallivm_init_llvm_{begin,end}() with gallivm_init_llvm_targets(). Reviewed-by: Marek Olšák Reviewed-by: Mathias Fröhlich Reviewed-by: Emil Velikov CC: "10.6 11.0" --- src/gallium/drivers/radeon/radeon_llvm_emit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c index ff30a14b0af..6b2ebdead38 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.c +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c @@ -26,6 +26,7 @@ #include "radeon_llvm_emit.h" #include "radeon_elf_util.h" #include "c11/threads.h" +#include "gallivm/lp_bld_misc.h" #include "util/u_memory.h" #include "pipe/p_shader_tokens.h" @@ -87,6 +88,7 @@ void radeon_llvm_shader_type(LLVMValueRef F, unsigned type) static void init_r600_target() { + gallivm_init_llvm_targets(); #if HAVE_LLVM < 0x0307 LLVMInitializeR600TargetInfo(); LLVMInitializeR600Target(); From ca941799ce76eac8afe2503fbacffee057e949d3 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 2 Oct 2015 16:39:51 -0700 Subject: [PATCH 04/11] i965/nir: Remove the prog parameter from brw_nir_lower_inputs Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_nir.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c index cc9430c83e6..4f1965503ee 100644 --- a/src/mesa/drivers/dri/i965/brw_nir.c +++ b/src/mesa/drivers/dri/i965/brw_nir.c @@ -28,9 +28,7 @@ #include "program/prog_to_nir.h" static void -brw_nir_lower_inputs(nir_shader *nir, - const struct gl_program *prog, - bool is_scalar) +brw_nir_lower_inputs(nir_shader *nir, bool is_scalar) { nir_assign_var_locations(&nir->inputs, &nir->num_inputs, is_scalar ? type_size_scalar : type_size_vec4); @@ -141,7 +139,7 @@ brw_create_nir(struct brw_context *brw, /* Get rid of split copies */ nir_optimize(nir, is_scalar); - brw_nir_lower_inputs(nir, prog, is_scalar); + brw_nir_lower_inputs(nir, is_scalar); brw_nir_lower_outputs(nir, is_scalar); nir_assign_var_locations(&nir->uniforms, &nir->num_uniforms, From 050e4787d3526b8341dd76b59442356f9737ee96 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 2 Oct 2015 18:15:06 -0700 Subject: [PATCH 05/11] nir: Add a nir_foreach_variable macro This is a common enough operation that it's nice to not have to think about the arguments to foreach_list_typed every time. Reviewed-by: Kenneth Graunke --- src/glsl/nir/nir.h | 3 +++ src/glsl/nir/nir_lower_clip.c | 4 ++-- src/glsl/nir/nir_lower_io.c | 2 +- src/glsl/nir/nir_lower_outputs_to_temporaries.c | 2 +- src/glsl/nir/nir_lower_two_sided_color.c | 2 +- src/glsl/nir/nir_print.c | 14 +++++++------- src/glsl/nir/nir_validate.c | 12 ++++++------ 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index c83ef50cee3..268fbc25a33 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -365,6 +365,9 @@ typedef struct { const struct glsl_type *interface_type; } nir_variable; +#define nir_foreach_variable(var, var_list) \ + foreach_list_typed(nir_variable, var, node, var_list) + typedef struct { struct exec_node node; diff --git a/src/glsl/nir/nir_lower_clip.c b/src/glsl/nir/nir_lower_clip.c index 94d12b77af4..31ccfb2c02b 100644 --- a/src/glsl/nir/nir_lower_clip.c +++ b/src/glsl/nir/nir_lower_clip.c @@ -218,7 +218,7 @@ nir_lower_clip_vs(nir_shader *shader, unsigned ucp_enables) return; /* find clipvertex/position outputs: */ - foreach_list_typed(nir_variable, var, node, &shader->outputs) { + nir_foreach_variable(var, &shader->outputs) { int loc = var->data.driver_location; /* keep track of last used driver-location.. we'll be @@ -310,7 +310,7 @@ nir_lower_clip_fs(nir_shader *shader, unsigned ucp_enables) if (!ucp_enables) return; - foreach_list_typed(nir_variable, var, node, &shader->inputs) { + nir_foreach_variable(var, &shader->inputs) { int loc = var->data.driver_location; /* keep track of last used driver-location.. we'll be diff --git a/src/glsl/nir/nir_lower_io.c b/src/glsl/nir/nir_lower_io.c index f32c09d04a2..30fad855e6f 100644 --- a/src/glsl/nir/nir_lower_io.c +++ b/src/glsl/nir/nir_lower_io.c @@ -47,7 +47,7 @@ nir_assign_var_locations(struct exec_list *var_list, unsigned *size, { unsigned location = 0; - foreach_list_typed(nir_variable, var, node, var_list) { + nir_foreach_variable(var, var_list) { /* * UBO's have their own address spaces, so don't count them towards the * number of global uniforms diff --git a/src/glsl/nir/nir_lower_outputs_to_temporaries.c b/src/glsl/nir/nir_lower_outputs_to_temporaries.c index 4ea5fd4f66b..80f43951b5c 100644 --- a/src/glsl/nir/nir_lower_outputs_to_temporaries.c +++ b/src/glsl/nir/nir_lower_outputs_to_temporaries.c @@ -84,7 +84,7 @@ nir_lower_outputs_to_temporaries(nir_shader *shader) /* Walk over all of the outputs turn each output into a temporary and * make a new variable for the actual output. */ - foreach_list_typed(nir_variable, var, node, &state.old_outputs) { + nir_foreach_variable(var, &state.old_outputs) { nir_variable *output = ralloc(shader, nir_variable); memcpy(output, var, sizeof *output); diff --git a/src/glsl/nir/nir_lower_two_sided_color.c b/src/glsl/nir/nir_lower_two_sided_color.c index 131feef90af..db519bf513b 100644 --- a/src/glsl/nir/nir_lower_two_sided_color.c +++ b/src/glsl/nir/nir_lower_two_sided_color.c @@ -83,7 +83,7 @@ setup_inputs(lower_2side_state *state) int maxloc = -1; /* find color/face inputs: */ - foreach_list_typed(nir_variable, var, node, &state->shader->inputs) { + nir_foreach_variable(var, &state->shader->inputs) { int loc = var->data.driver_location; /* keep track of last used driver-location.. we'll be diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c index a19aa8b9132..3936bae078b 100644 --- a/src/glsl/nir/nir_print.c +++ b/src/glsl/nir/nir_print.c @@ -453,7 +453,7 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state) return; } - foreach_list_typed(nir_variable, var, node, var_list) { + nir_foreach_variable(var, var_list) { if ((var->data.driver_location == instr->const_index[0]) && var->name) { fprintf(fp, "\t/* %s */", var->name); @@ -872,7 +872,7 @@ print_function_impl(nir_function_impl *impl, print_state *state) fprintf(fp, "{\n"); - foreach_list_typed(nir_variable, var, node, &impl->locals) { + nir_foreach_variable(var, &impl->locals) { fprintf(fp, "\t"); print_var_decl(var, state); } @@ -970,23 +970,23 @@ nir_print_shader(nir_shader *shader, FILE *fp) fprintf(fp, "shader: %s\n", gl_shader_stage_name(shader->stage)); - foreach_list_typed(nir_variable, var, node, &shader->uniforms) { + nir_foreach_variable(var, &shader->uniforms) { print_var_decl(var, &state); } - foreach_list_typed(nir_variable, var, node, &shader->inputs) { + nir_foreach_variable(var, &shader->inputs) { print_var_decl(var, &state); } - foreach_list_typed(nir_variable, var, node, &shader->outputs) { + nir_foreach_variable(var, &shader->outputs) { print_var_decl(var, &state); } - foreach_list_typed(nir_variable, var, node, &shader->globals) { + nir_foreach_variable(var, &shader->globals) { print_var_decl(var, &state); } - foreach_list_typed(nir_variable, var, node, &shader->system_values) { + nir_foreach_variable(var, &shader->system_values) { print_var_decl(var, &state); } diff --git a/src/glsl/nir/nir_validate.c b/src/glsl/nir/nir_validate.c index 1c9993a9c80..c6fedf9b1ad 100644 --- a/src/glsl/nir/nir_validate.c +++ b/src/glsl/nir/nir_validate.c @@ -934,7 +934,7 @@ validate_function_impl(nir_function_impl *impl, validate_state *state) state->parent_node = &impl->cf_node; exec_list_validate(&impl->locals); - foreach_list_typed(nir_variable, var, node, &impl->locals) { + nir_foreach_variable(var, &impl->locals) { validate_var_decl(var, false, state); } @@ -1016,27 +1016,27 @@ nir_validate_shader(nir_shader *shader) state.shader = shader; exec_list_validate(&shader->uniforms); - foreach_list_typed(nir_variable, var, node, &shader->uniforms) { + nir_foreach_variable(var, &shader->uniforms) { validate_var_decl(var, true, &state); } exec_list_validate(&shader->inputs); - foreach_list_typed(nir_variable, var, node, &shader->inputs) { + nir_foreach_variable(var, &shader->inputs) { validate_var_decl(var, true, &state); } exec_list_validate(&shader->outputs); - foreach_list_typed(nir_variable, var, node, &shader->outputs) { + nir_foreach_variable(var, &shader->outputs) { validate_var_decl(var, true, &state); } exec_list_validate(&shader->globals); - foreach_list_typed(nir_variable, var, node, &shader->globals) { + nir_foreach_variable(var, &shader->globals) { validate_var_decl(var, true, &state); } exec_list_validate(&shader->system_values); - foreach_list_typed(nir_variable, var, node, &shader->system_values) { + nir_foreach_variable(var, &shader->system_values) { validate_var_decl(var, true, &state); } From 1e3c1b107e075b210998998423901092b8fcd79b Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 2 Oct 2015 18:16:10 -0700 Subject: [PATCH 06/11] i965: Use nir_foreach_variable Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 6 +++--- src/mesa/drivers/dri/i965/brw_nir.c | 2 +- src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp | 2 +- src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 114a017a405..03fe6804701 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -58,7 +58,7 @@ fs_visitor::nir_setup_inputs() { nir_inputs = bld.vgrf(BRW_REGISTER_TYPE_F, nir->num_inputs); - foreach_list_typed(nir_variable, var, node, &nir->inputs) { + nir_foreach_variable(var, &nir->inputs) { enum brw_reg_type type = brw_type_for_base_type(var->type); fs_reg input = offset(nir_inputs, bld, var->data.driver_location); @@ -122,7 +122,7 @@ fs_visitor::nir_setup_outputs() nir_outputs = bld.vgrf(BRW_REGISTER_TYPE_F, nir->num_outputs); - foreach_list_typed(nir_variable, var, node, &nir->outputs) { + nir_foreach_variable(var, &nir->outputs) { fs_reg reg = offset(nir_outputs, bld, var->data.driver_location); int vector_elements = @@ -180,7 +180,7 @@ fs_visitor::nir_setup_uniforms() uniforms = nir->num_uniforms; - foreach_list_typed(nir_variable, var, node, &nir->uniforms) { + nir_foreach_variable(var, &nir->uniforms) { /* UBO's and atomics don't take up space in the uniform file */ if (var->interface_type != NULL || var->type->contains_atomic()) continue; diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c index 4f1965503ee..12f47ad0ded 100644 --- a/src/mesa/drivers/dri/i965/brw_nir.c +++ b/src/mesa/drivers/dri/i965/brw_nir.c @@ -40,7 +40,7 @@ brw_nir_lower_outputs(nir_shader *nir, bool is_scalar) if (is_scalar) { nir_assign_var_locations(&nir->outputs, &nir->num_outputs, type_size_scalar); } else { - foreach_list_typed(nir_variable, var, node, &nir->outputs) + nir_foreach_variable(var, &nir->outputs) var->data.driver_location = var->data.location; } } diff --git a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp b/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp index f19d74610a1..d3326e9fb86 100644 --- a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp +++ b/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp @@ -129,7 +129,7 @@ brw_nir_setup_glsl_uniforms(nir_shader *shader, { unsigned comps_per_unit = is_scalar ? 1 : 4; - foreach_list_typed(nir_variable, var, node, &shader->uniforms) { + nir_foreach_variable(var, &shader->uniforms) { /* UBO's, atomics and samplers don't take up space in the uniform file */ if (var->interface_type != NULL || var->type->contains_atomic()) diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp index 8c22f9bed4c..41bd80df377 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp @@ -119,7 +119,7 @@ vec4_visitor::nir_setup_inputs() { nir_inputs = ralloc_array(mem_ctx, src_reg, nir->num_inputs); - foreach_list_typed(nir_variable, var, node, &nir->inputs) { + nir_foreach_variable(var, &nir->inputs) { int offset = var->data.driver_location; unsigned size = type_size_vec4(var->type); for (unsigned i = 0; i < size; i++) { @@ -134,7 +134,7 @@ vec4_visitor::nir_setup_uniforms() { uniforms = nir->num_uniforms; - foreach_list_typed(nir_variable, var, node, &nir->uniforms) { + nir_foreach_variable(var, &nir->uniforms) { /* UBO's and atomics don't take up space in the uniform file */ if (var->interface_type != NULL || var->type->contains_atomic()) continue; From 443d3bf3408984b11f99c1077d167d8331609007 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 2 Oct 2015 18:31:17 -0700 Subject: [PATCH 07/11] i965/wm: Make compute_barycentric_interp_modes take a nir_shader and a devinfo Now that everything comes in through NIR, we can pick this directly out of the shader source and don't need to reference the gl_fragment_program. Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_wm.c | 39 ++++++++++++------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 13139144f89..98920463503 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -44,33 +44,23 @@ * (see enum brw_wm_barycentric_interp_mode) is needed by the fragment shader. */ static unsigned -brw_compute_barycentric_interp_modes(struct brw_context *brw, +brw_compute_barycentric_interp_modes(const struct brw_device_info *devinfo, bool shade_model_flat, bool persample_shading, - const struct gl_fragment_program *fprog) + nir_shader *shader) { unsigned barycentric_interp_modes = 0; - int attr; - /* Loop through all fragment shader inputs to figure out what interpolation - * modes are in use, and set the appropriate bits in - * barycentric_interp_modes. - */ - for (attr = 0; attr < VARYING_SLOT_MAX; ++attr) { - enum glsl_interp_qualifier interp_qualifier = - fprog->InterpQualifier[attr]; - bool is_centroid = (fprog->IsCentroid & BITFIELD64_BIT(attr)) && - !persample_shading; - bool is_sample = (fprog->IsSample & BITFIELD64_BIT(attr)) || - persample_shading; - bool is_gl_Color = attr == VARYING_SLOT_COL0 || attr == VARYING_SLOT_COL1; - - /* Ignore unused inputs. */ - if (!(fprog->Base.InputsRead & BITFIELD64_BIT(attr))) - continue; + nir_foreach_variable(var, &shader->inputs) { + enum glsl_interp_qualifier interp_qualifier = var->data.interpolation; + bool is_centroid = var->data.centroid && !persample_shading; + bool is_sample = var->data.sample || persample_shading; + bool is_gl_Color = (var->data.location == VARYING_SLOT_COL0) || + (var->data.location == VARYING_SLOT_COL1); /* Ignore WPOS and FACE, because they don't require interpolation. */ - if (attr == VARYING_SLOT_POS || attr == VARYING_SLOT_FACE) + if (var->data.location == VARYING_SLOT_POS || + var->data.location == VARYING_SLOT_FACE) continue; /* Determine the set (or sets) of barycentric coordinates needed to @@ -88,7 +78,7 @@ brw_compute_barycentric_interp_modes(struct brw_context *brw, 1 << BRW_WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC; } if ((!is_centroid && !is_sample) || - brw->needs_unlit_centroid_workaround) { + devinfo->needs_unlit_centroid_workaround) { barycentric_interp_modes |= 1 << BRW_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC; } @@ -103,7 +93,7 @@ brw_compute_barycentric_interp_modes(struct brw_context *brw, 1 << BRW_WM_PERSPECTIVE_SAMPLE_BARYCENTRIC; } if ((!is_centroid && !is_sample) || - brw->needs_unlit_centroid_workaround) { + devinfo->needs_unlit_centroid_workaround) { barycentric_interp_modes |= 1 << BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC; } @@ -220,9 +210,10 @@ brw_codegen_wm_prog(struct brw_context *brw, } prog_data.barycentric_interp_modes = - brw_compute_barycentric_interp_modes(brw, key->flat_shade, + brw_compute_barycentric_interp_modes(brw->intelScreen->devinfo, + key->flat_shade, key->persample_shading, - &fp->program); + fp->program.Base.nir); if (unlikely(brw->perf_debug)) { start_busy = (brw->batch.last_bo && From 11cabc45b7124e51d5ead42db6dceb5a3755266b Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 14 Sep 2015 18:35:45 +0100 Subject: [PATCH 08/11] egl: rework handling EGL_CONTEXT_FLAGS As of version 15 of the EGL_KHR_create_context spec, debug contexts are allowed for ES contexts. We should allow creation instead of erroring. While we're here provide a more comprehensive checking for the other two flags - ROBUST_ACCESS_BIT_KHR and FORWARD_COMPATIBLE_BIT_KHR v2 [Emil Velikov] Rebase. Minor tweak in commit message. Cc: Boyan Ding Cc: Chad Versace Cc: "10.6 11.0" Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91044 Signed-off-by: Matthew Waters Signed-off-by: Emil Velikov --- src/egl/main/eglcontext.c | 49 +++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index 588f48921f2..ae19862bc59 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -152,12 +152,51 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy, /* The EGL_KHR_create_context spec says: * - * "Flags are only defined for OpenGL context creation, and - * specifying a flags value other than zero for other types of - * contexts, including OpenGL ES contexts, will generate an - * error." + * "If the EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR flag bit is set in + * EGL_CONTEXT_FLAGS_KHR, then a will be created. + * [...] + * In some cases a debug context may be identical to a non-debug + * context. This bit is supported for OpenGL and OpenGL ES + * contexts." */ - if (api != EGL_OPENGL_API && val != 0) { + if ((val & EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR) && + (api != EGL_OPENGL_API && api != EGL_OPENGL_ES_API)) { + err = EGL_BAD_ATTRIBUTE; + break; + } + + /* The EGL_KHR_create_context spec says: + * + * "If the EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR flag bit + * is set in EGL_CONTEXT_FLAGS_KHR, then a + * context will be created. Forward-compatible contexts are + * defined only for OpenGL versions 3.0 and later. They must not + * support functionality marked as by that version of + * the API, while a non-forward-compatible context must support + * all functionality in that version, deprecated or not. This bit + * is supported for OpenGL contexts, and requesting a + * forward-compatible context for OpenGL versions less than 3.0 + * will generate an error." + */ + if ((val & EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR) && + (api != EGL_OPENGL_API || ctx->ClientMajorVersion < 3)) { + err = EGL_BAD_ATTRIBUTE; + break; + } + + /* The EGL_KHR_create_context_spec says: + * + * "If the EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR bit is set in + * EGL_CONTEXT_FLAGS_KHR, then a context supporting will be created. Robust buffer access is defined in the + * GL_ARB_robustness extension specification, and the resulting + * context must also support either the GL_ARB_robustness + * extension, or a version of OpenGL incorporating equivalent + * functionality. This bit is supported for OpenGL contexts. + */ + if ((val & EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR) && + (api != EGL_OPENGL_API || + !dpy->Extensions.EXT_create_context_robustness)) { err = EGL_BAD_ATTRIBUTE; break; } From b2a987fc12fa9eac4781305fbf9196c7bec335dd Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sat, 3 Oct 2015 12:37:15 +0100 Subject: [PATCH 09/11] docs: add release notes for 10.6.9 Signed-off-by: Emil Velikov (cherry picked from commit ab9aacce2d26a802bac81fc25748320428996692) --- docs/relnotes/10.6.9.html | 129 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 docs/relnotes/10.6.9.html diff --git a/docs/relnotes/10.6.9.html b/docs/relnotes/10.6.9.html new file mode 100644 index 00000000000..df4ff087603 --- /dev/null +++ b/docs/relnotes/10.6.9.html @@ -0,0 +1,129 @@ + + + + + Mesa Release Notes + + + + +
+

The Mesa 3D Graphics Library

+
+ + +
+ +

Mesa 10.6.9 Release Notes / Octover 03, 2015

+ +

+Mesa 10.6.9 is a bug fix release which fixes bugs found since the 10.6.8 release. +

+

+Mesa 10.6.9 implements the OpenGL 3.3 API, but the version reported by +glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / +glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 3.3. OpenGL +3.3 is only available if requested at context creation +because compatibility contexts are not supported. +

+ + +

SHA256 checksums

+
+TBD
+
+ + +

New features

+

None

+ +

Bug fixes

+ +

This list is likely incomplete.

+ +
    + +
  • Bug 38109 - i915 driver crashes if too few vertices are submitted (Mesa 7.10.2)
  • + +
  • Bug 55552 - Compile errors with --enable-mangling
  • + +
  • Bug 86281 - brw_meta_fast_clear (brw=brw@entry=0x7fffd4097a08, fb=fb@entry=0x7fffd40fa900, buffers=buffers@entry=2, partial_clear=partial_clear@entry=false)
  • + +
  • Bug 91970 - [BSW regression] dEQP-GLES3.functional.shaders.precision.int.highp_mul_vertex
  • + +
  • Bug 92072 - Wine breakage since d082c5324 (st/mesa: don't call st_validate_state in BlitFramebuffer)
  • + +
+ + +

Changes

+ +

Brian Paul (1):

+
    +
  • st/mesa: try PIPE_BIND_RENDER_TARGET when choosing float texture formats
  • +
+ +

Chris Wilson (1):

+
    +
  • i965: Remove early release of DRI2 miptree
  • +
+ +

Emil Velikov (4):

+
    +
  • docs: add sha256 checksums for 10.6.8
  • +
  • cherry-ignore: add commit non applicable for 10.6
  • +
  • cherry-ignore: add commit non applicable for 10.6
  • +
  • Update version to 10.6.9
  • +
+ +

Iago Toral Quiroga (1):

+
    +
  • mesa: Fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE for default framebuffer.
  • +
+ +

Ian Romanick (5):

+
    +
  • t_dd_dmatmp: Make "count" actually be the count
  • +
  • t_dd_dmatmp: Clean up improper code formatting from previous patch
  • +
  • t_dd_dmatmp: Use '& 3' instead of '% 4' everywhere
  • +
  • t_dd_dmatmp: Pull out common 'count -= count & 3' code
  • +
  • t_dd_dmatmp: Use addition instead of subtraction in loop bounds
  • +
+ +

Jeremy Huddleston (1):

+
    +
  • configure.ac: Add support to enable read-only text segment on x86.
  • +
+ +

Kristian Høgsberg Kristensen (1):

+
    +
  • i965: Respect stride and subreg_offset for ATTR registers
  • +
+ +

Kyle Brenneman (3):

+
    +
  • glx: Fix build errors with --enable-mangling (v2)
  • +
  • mapi: Make _glapi_get_stub work with "gl" or "mgl" prefix.
  • +
  • glx: Don't hard-code the name "libGL.so.1" in driOpenDriver (v3)
  • +
+ +

Leo Liu (1):

+
    +
  • radeon/vce: fix vui time_scale zero error
  • +
+ +

Marek Olšák (1):

+
    +
  • st/mesa: fix front buffer regression after dropping st_validate_state in Blit
  • +
+ +

Roland Scheidegger (1):

+
    +
  • mesa: fix mipmap generation for immutable, compressed textures
  • +
+ + +
+ + From 61c35ce4f9ddfc3a36d6330f7feeca14ccbd8a86 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sat, 3 Oct 2015 13:16:18 +0100 Subject: [PATCH 10/11] docs: add sha256 checksums for 10.6.9 Signed-off-by: Emil Velikov (cherry picked from commit 8957b696f9cc8a92b2c160c551c34545447ec28a) --- docs/relnotes/10.6.9.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/relnotes/10.6.9.html b/docs/relnotes/10.6.9.html index df4ff087603..9d155fa19b0 100644 --- a/docs/relnotes/10.6.9.html +++ b/docs/relnotes/10.6.9.html @@ -31,7 +31,8 @@ because compatibility contexts are not supported.

SHA256 checksums

-TBD
+3406876aac67546d0c3e2cb97da330b62644c313e7992b95618662e13c54296a  mesa-10.6.9.tar.gz
+b04c4de6280b863babc2929573da17218d92e9e4ba6272d548d135415723e8c3  mesa-10.6.9.tar.xz
 
From 3cd5395206398847d554ddf4cad49192042bd8ef Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sat, 3 Oct 2015 13:23:13 +0100 Subject: [PATCH 11/11] docs: add news item and link release notes for 10.6.9 Signed-off-by: Emil Velikov --- docs/index.html | 10 ++++++++++ docs/relnotes.html | 1 + 2 files changed, 11 insertions(+) diff --git a/docs/index.html b/docs/index.html index a56c8489189..9aa2821dcfe 100644 --- a/docs/index.html +++ b/docs/index.html @@ -16,6 +16,16 @@

News

+

October 3, 2015

+

+Mesa 10.6.9 is released. +This is a bug-fix release. +
+NOTE: It is anticipated that 10.6.9 will be the final release in the 10.6 +series. Users of 10.5 are encouraged to migrate to the 11.0 series in order +to obtain future fixes. +

+

September 28, 2015

Mesa 11.0.2 is released. diff --git a/docs/relnotes.html b/docs/relnotes.html index 948d3f790b8..1c47853d81e 100644 --- a/docs/relnotes.html +++ b/docs/relnotes.html @@ -21,6 +21,7 @@ The release notes summarize what's new or changed in each Mesa release.