diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-07-22 10:02:57 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-07-22 10:02:57 +0000 |
commit | c409d296d1991bdd3611ee8f60676e3e3708e134 (patch) | |
tree | 3019350112c17e95e2ff2491580da5e81b7707be /lib/mesa | |
parent | 0e555fbab33ea36ab33d34961bad0585ab2feb43 (diff) |
Import Mesa 21.1.5
Diffstat (limited to 'lib/mesa')
-rw-r--r-- | lib/mesa/src/compiler/nir/tests/lower_returns_tests.cpp | 6 | ||||
-rw-r--r-- | lib/mesa/src/compiler/nir/tests/ssa_def_bits_used_tests.cpp | 3 | ||||
-rw-r--r-- | lib/mesa/src/compiler/spirv/nir_load_libclc.c | 62 | ||||
-rw-r--r-- | lib/mesa/src/compiler/spirv/nir_lower_libclc.c | 4 | ||||
-rw-r--r-- | lib/mesa/src/freedreno/decode/redump.h | 78 |
5 files changed, 41 insertions, 112 deletions
diff --git a/lib/mesa/src/compiler/nir/tests/lower_returns_tests.cpp b/lib/mesa/src/compiler/nir/tests/lower_returns_tests.cpp index 83b9fcd23..d34f26be5 100644 --- a/lib/mesa/src/compiler/nir/tests/lower_returns_tests.cpp +++ b/lib/mesa/src/compiler/nir/tests/lower_returns_tests.cpp @@ -56,7 +56,11 @@ nir_phi_instr *create_one_source_phi(nir_shader *shader, nir_block *pred, { nir_phi_instr *phi = nir_phi_instr_create(shader); - nir_phi_instr_add_src(phi, pred, nir_src_for_ssa(def)); + nir_phi_src *phi_src; + phi_src = ralloc(phi, nir_phi_src); + phi_src->pred = pred; + phi_src->src = nir_src_for_ssa(def); + exec_list_push_tail(&phi->srcs, &phi_src->node); nir_ssa_dest_init(&phi->instr, &phi->dest, def->num_components, def->bit_size, NULL); diff --git a/lib/mesa/src/compiler/nir/tests/ssa_def_bits_used_tests.cpp b/lib/mesa/src/compiler/nir/tests/ssa_def_bits_used_tests.cpp index 4c9aa2950..b38eef0d2 100644 --- a/lib/mesa/src/compiler/nir/tests/ssa_def_bits_used_tests.cpp +++ b/lib/mesa/src/compiler/nir/tests/ssa_def_bits_used_tests.cpp @@ -50,7 +50,8 @@ protected: static bool is_used_once(const nir_ssa_def *def) { - return list_is_singular(&def->uses); + return list_is_singular(&def->uses) && + list_is_empty(&def->if_uses); } nir_alu_instr * diff --git a/lib/mesa/src/compiler/spirv/nir_load_libclc.c b/lib/mesa/src/compiler/spirv/nir_load_libclc.c index 567fb2669..18d46147b 100644 --- a/lib/mesa/src/compiler/spirv/nir_load_libclc.c +++ b/lib/mesa/src/compiler/spirv/nir_load_libclc.c @@ -239,66 +239,6 @@ nir_can_find_libclc(unsigned ptr_bit_size) } } -/** Adds generic pointer variants of libclc functions - * - * Libclc currently doesn't contain generic variants for a bunch of functions - * like `frexp` but the OpenCL spec with generic pointers requires them. We - * really should fix libclc but, in the mean time, we can easily duplicate - * every function that works on global memory and make it also work on generic - * memory. - */ -static void -libclc_add_generic_variants(nir_shader *shader) -{ - nir_foreach_function(func, shader) { - /* These don't need generic variants */ - if (strstr(func->name, "async_work_group_strided_copy")) - continue; - - char *U3AS1 = strstr(func->name, "U3AS1"); - if (U3AS1 == NULL) - continue; - - ptrdiff_t offset_1 = U3AS1 - func->name + 4; - assert(offset_1 < strlen(func->name) && func->name[offset_1] == '1'); - - char *generic_name = ralloc_strdup(shader, func->name); - assert(generic_name[offset_1] == '1'); - generic_name[offset_1] = '4'; - - if (nir_shader_get_function_for_name(shader, generic_name)) - continue; - - nir_function *gfunc = nir_function_create(shader, generic_name); - gfunc->num_params = func->num_params; - gfunc->params = ralloc_array(shader, nir_parameter, gfunc->num_params); - for (unsigned i = 0; i < gfunc->num_params; i++) - gfunc->params[i] = func->params[i]; - - gfunc->impl = nir_function_impl_clone(shader, func->impl); - gfunc->impl->function = gfunc; - - /* Rewrite any global pointers to generic */ - nir_foreach_block(block, gfunc->impl) { - nir_foreach_instr(instr, block) { - if (instr->type != nir_instr_type_deref) - continue; - - nir_deref_instr *deref = nir_instr_as_deref(instr); - if (!nir_deref_mode_may_be(deref, nir_var_mem_global)) - continue; - - assert(deref->type != nir_deref_type_var); - assert(nir_deref_mode_is(deref, nir_var_mem_global)); - - deref->modes = nir_var_mem_generic; - } - } - - nir_metadata_preserve(gfunc->impl, nir_metadata_none); - } -} - nir_shader * nir_load_libclc_shader(unsigned ptr_bit_size, struct disk_cache *disk_cache, @@ -353,8 +293,6 @@ nir_load_libclc_shader(unsigned ptr_bit_size, NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp); NIR_PASS_V(nir, nir_lower_returns); - NIR_PASS_V(nir, libclc_add_generic_variants); - /* TODO: One day, we may want to run some optimizations on the libclc * shader once and cache them to save time in each shader call. */ diff --git a/lib/mesa/src/compiler/spirv/nir_lower_libclc.c b/lib/mesa/src/compiler/spirv/nir_lower_libclc.c index b3e121f3a..ebaa54c1a 100644 --- a/lib/mesa/src/compiler/spirv/nir_lower_libclc.c +++ b/lib/mesa/src/compiler/spirv/nir_lower_libclc.c @@ -38,10 +38,6 @@ lower_clc_call_instr(nir_instr *instr, nir_builder *b, { nir_call_instr *call = nir_instr_as_call(instr); nir_function *func = NULL; - - if (!call->callee->name) - return false; - nir_foreach_function(function, clc_shader) { if (strcmp(function->name, call->callee->name) == 0) { func = function; diff --git a/lib/mesa/src/freedreno/decode/redump.h b/lib/mesa/src/freedreno/decode/redump.h index bf202d883..1b5d3e1af 100644 --- a/lib/mesa/src/freedreno/decode/redump.h +++ b/lib/mesa/src/freedreno/decode/redump.h @@ -24,63 +24,53 @@ #ifndef REDUMP_H_ #define REDUMP_H_ -#include "util/u_math.h" - enum rd_sect_type { - RD_NONE, - RD_TEST, /* ascii text */ - RD_CMD, /* ascii text */ - RD_GPUADDR, /* u32 gpuaddr, u32 size */ - RD_CONTEXT, /* raw dump */ - RD_CMDSTREAM, /* raw dump */ - RD_CMDSTREAM_ADDR, /* gpu addr of cmdstream */ - RD_PARAM, /* u32 param_type, u32 param_val, u32 bitlen */ - RD_FLUSH, /* empty, clear previous params */ - RD_PROGRAM, /* shader program, raw dump */ - RD_VERT_SHADER, - RD_FRAG_SHADER, - RD_BUFFER_CONTENTS, - RD_GPU_ID, - RD_CHIP_ID, + RD_NONE, + RD_TEST, /* ascii text */ + RD_CMD, /* ascii text */ + RD_GPUADDR, /* u32 gpuaddr, u32 size */ + RD_CONTEXT, /* raw dump */ + RD_CMDSTREAM, /* raw dump */ + RD_CMDSTREAM_ADDR, /* gpu addr of cmdstream */ + RD_PARAM, /* u32 param_type, u32 param_val, u32 bitlen */ + RD_FLUSH, /* empty, clear previous params */ + RD_PROGRAM, /* shader program, raw dump */ + RD_VERT_SHADER, + RD_FRAG_SHADER, + RD_BUFFER_CONTENTS, + RD_GPU_ID, }; /* RD_PARAM types: */ enum rd_param_type { - RD_PARAM_SURFACE_WIDTH, - RD_PARAM_SURFACE_HEIGHT, - RD_PARAM_SURFACE_PITCH, - RD_PARAM_COLOR, - RD_PARAM_BLIT_X, - RD_PARAM_BLIT_Y, - RD_PARAM_BLIT_WIDTH, - RD_PARAM_BLIT_HEIGHT, - RD_PARAM_BLIT_X2, /* BLIT_X + BLIT_WIDTH */ - RD_PARAM_BLIT_Y2, /* BLIT_Y + BLIT_WIDTH */ + RD_PARAM_SURFACE_WIDTH, + RD_PARAM_SURFACE_HEIGHT, + RD_PARAM_SURFACE_PITCH, + RD_PARAM_COLOR, + RD_PARAM_BLIT_X, + RD_PARAM_BLIT_Y, + RD_PARAM_BLIT_WIDTH, + RD_PARAM_BLIT_HEIGHT, + RD_PARAM_BLIT_X2, /* BLIT_X + BLIT_WIDTH */ + RD_PARAM_BLIT_Y2, /* BLIT_Y + BLIT_WIDTH */ }; void rd_start(const char *name, const char *fmt, ...) __attribute__((weak)); void rd_end(void) __attribute__((weak)); -void rd_write_section(enum rd_sect_type type, const void *buf, int sz) - __attribute__((weak)); +void rd_write_section(enum rd_sect_type type, const void *buf, int sz) __attribute__((weak)); /* for code that should run with and without libwrap, use the following * macros which check if the fxns are present before calling */ -#define RD_START(n, f, ...) \ - do { \ - if (rd_start) \ - rd_start(n, f, ##__VA_ARGS__); \ - } while (0) -#define RD_END() \ - do { \ - if (rd_end) \ - rd_end(); \ - } while (0) -#define RD_WRITE_SECTION(t, b, s) \ - do { \ - if (rd_write_section) \ - rd_write_section(t, b, s); \ - } while (0) +#define RD_START(n,f,...) do { if (rd_start) rd_start(n,f,##__VA_ARGS__); } while (0) +#define RD_END() do { if (rd_end) rd_end(); } while (0) +#define RD_WRITE_SECTION(t,b,s) do { if (rd_write_section) rd_write_section(t,b,s); } while (0) + +#ifndef ARRAY_SIZE +# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#endif +#undef ALIGN +#define ALIGN(v,a) (((v) + (a) - 1) & ~((a) - 1)) #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) |