summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2020-09-03 06:47:16 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2020-09-03 06:47:16 +0000
commit53d4023d5d022dee9188af50de693343e5ab3842 (patch)
tree44e5fb84f9e99ad6e1a868c8f040dfbe84a18879 /lib
parent503988bc5f236336c432bb16698c4687e482ce16 (diff)
Import Mesa 20.1.7
Diffstat (limited to 'lib')
-rw-r--r--lib/mesa/src/panfrost/bifrost/bifrost_compile.c2
-rw-r--r--lib/mesa/src/panfrost/midgard/compiler.h2
-rw-r--r--lib/mesa/src/panfrost/midgard/midgard_compile.c3
-rw-r--r--lib/mesa/src/panfrost/midgard/midgard_opt_perspective.c1
-rw-r--r--lib/mesa/src/panfrost/midgard/mir_squeeze.c19
-rw-r--r--lib/mesa/src/panfrost/util/pan_ir.h2
-rw-r--r--lib/mesa/src/panfrost/util/pan_liveness.c8
-rw-r--r--lib/mesa/src/panfrost/util/pan_sysval.c4
-rw-r--r--lib/mesa/src/util/00-mesa-defaults.conf6
-rw-r--r--lib/mesa/src/vulkan/device-select-layer/device_select_layer.c5
10 files changed, 32 insertions, 20 deletions
diff --git a/lib/mesa/src/panfrost/bifrost/bifrost_compile.c b/lib/mesa/src/panfrost/bifrost/bifrost_compile.c
index a5e86d816..9b35a901e 100644
--- a/lib/mesa/src/panfrost/bifrost/bifrost_compile.c
+++ b/lib/mesa/src/panfrost/bifrost/bifrost_compile.c
@@ -1076,7 +1076,7 @@ bifrost_compile_shader_nir(nir_shader *nir, panfrost_program *program, unsigned
bi_optimize_nir(nir);
nir_print_shader(nir, stdout);
- panfrost_nir_assign_sysvals(&ctx->sysvals, nir);
+ panfrost_nir_assign_sysvals(&ctx->sysvals, ctx, nir);
program->sysval_count = ctx->sysvals.sysval_count;
memcpy(program->sysvals, ctx->sysvals.sysvals, sizeof(ctx->sysvals.sysvals[0]) * ctx->sysvals.sysval_count);
ctx->blend_types = program->blend_types;
diff --git a/lib/mesa/src/panfrost/midgard/compiler.h b/lib/mesa/src/panfrost/midgard/compiler.h
index 5158ea6a8..66f4bcae0 100644
--- a/lib/mesa/src/panfrost/midgard/compiler.h
+++ b/lib/mesa/src/panfrost/midgard/compiler.h
@@ -257,8 +257,6 @@ typedef struct compiler_context {
/* Constants which have been loaded, for later inlining */
struct hash_table_u64 *ssa_constants;
- /* Mapping of hashes computed from NIR indices to the sequential temp indices ultimately used in MIR */
- struct hash_table_u64 *hash_to_temp;
int temp_count;
int max_hash;
diff --git a/lib/mesa/src/panfrost/midgard/midgard_compile.c b/lib/mesa/src/panfrost/midgard/midgard_compile.c
index 83221a31c..11a741fe9 100644
--- a/lib/mesa/src/panfrost/midgard/midgard_compile.c
+++ b/lib/mesa/src/panfrost/midgard/midgard_compile.c
@@ -2562,7 +2562,6 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b
/* Initialize at a global (not block) level hash tables */
ctx->ssa_constants = _mesa_hash_table_u64_create(NULL);
- ctx->hash_to_temp = _mesa_hash_table_u64_create(NULL);
/* Lower gl_Position pre-optimisation, but after lowering vars to ssa
* (so we don't accidentally duplicate the epilogue since mesa/st has
@@ -2598,7 +2597,7 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b
/* Assign sysvals and counts, now that we're sure
* (post-optimisation) */
- panfrost_nir_assign_sysvals(&ctx->sysvals, nir);
+ panfrost_nir_assign_sysvals(&ctx->sysvals, ctx, nir);
program->sysval_count = ctx->sysvals.sysval_count;
memcpy(program->sysvals, ctx->sysvals.sysvals, sizeof(ctx->sysvals.sysvals[0]) * ctx->sysvals.sysval_count);
diff --git a/lib/mesa/src/panfrost/midgard/midgard_opt_perspective.c b/lib/mesa/src/panfrost/midgard/midgard_opt_perspective.c
index 4af8c4535..601fa259c 100644
--- a/lib/mesa/src/panfrost/midgard/midgard_opt_perspective.c
+++ b/lib/mesa/src/panfrost/midgard/midgard_opt_perspective.c
@@ -88,6 +88,7 @@ midgard_opt_combine_projection(compiler_context *ctx, midgard_block *block)
}
if (!frcp_found) continue;
+ if (frcp_from != ins->src[0]) continue;
if (frcp_component != COMPONENT_W && frcp_component != COMPONENT_Z) continue;
if (!mir_single_use(ctx, frcp)) continue;
diff --git a/lib/mesa/src/panfrost/midgard/mir_squeeze.c b/lib/mesa/src/panfrost/midgard/mir_squeeze.c
index e5bf078b3..4684bdd00 100644
--- a/lib/mesa/src/panfrost/midgard/mir_squeeze.c
+++ b/lib/mesa/src/panfrost/midgard/mir_squeeze.c
@@ -30,13 +30,14 @@
* as such */
static unsigned
-find_or_allocate_temp(compiler_context *ctx, unsigned hash)
+find_or_allocate_temp(compiler_context *ctx, struct hash_table_u64 *map,
+ unsigned hash)
{
if (hash >= SSA_FIXED_MINIMUM)
return hash;
unsigned temp = (uintptr_t) _mesa_hash_table_u64_search(
- ctx->hash_to_temp, hash + 1);
+ map, hash + 1);
if (temp)
return temp - 1;
@@ -45,7 +46,7 @@ find_or_allocate_temp(compiler_context *ctx, unsigned hash)
temp = ctx->temp_count++;
ctx->max_hash = MAX2(ctx->max_hash, hash);
- _mesa_hash_table_u64_insert(ctx->hash_to_temp,
+ _mesa_hash_table_u64_insert(map,
hash + 1, (void *) ((uintptr_t) temp + 1));
return temp;
@@ -57,10 +58,10 @@ find_or_allocate_temp(compiler_context *ctx, unsigned hash)
void
mir_squeeze_index(compiler_context *ctx)
{
+ struct hash_table_u64 *map = _mesa_hash_table_u64_create(NULL);
+
/* Reset */
ctx->temp_count = 0;
- /* TODO don't leak old hash_to_temp */
- ctx->hash_to_temp = _mesa_hash_table_u64_create(NULL);
/* We need to prioritize texture registers on older GPUs so we don't
* fail RA trying to assign to work registers r0/r1 when a work
@@ -68,14 +69,16 @@ mir_squeeze_index(compiler_context *ctx)
mir_foreach_instr_global(ctx, ins) {
if (ins->type == TAG_TEXTURE_4)
- ins->dest = find_or_allocate_temp(ctx, ins->dest);
+ ins->dest = find_or_allocate_temp(ctx, map, ins->dest);
}
mir_foreach_instr_global(ctx, ins) {
if (ins->type != TAG_TEXTURE_4)
- ins->dest = find_or_allocate_temp(ctx, ins->dest);
+ ins->dest = find_or_allocate_temp(ctx, map, ins->dest);
for (unsigned i = 0; i < ARRAY_SIZE(ins->src); ++i)
- ins->src[i] = find_or_allocate_temp(ctx, ins->src[i]);
+ ins->src[i] = find_or_allocate_temp(ctx, map, ins->src[i]);
}
+
+ _mesa_hash_table_u64_destroy(map, NULL);
}
diff --git a/lib/mesa/src/panfrost/util/pan_ir.h b/lib/mesa/src/panfrost/util/pan_ir.h
index 6f1b60dea..55ce59343 100644
--- a/lib/mesa/src/panfrost/util/pan_ir.h
+++ b/lib/mesa/src/panfrost/util/pan_ir.h
@@ -77,7 +77,7 @@ struct panfrost_sysvals {
};
void
-panfrost_nir_assign_sysvals(struct panfrost_sysvals *ctx, nir_shader *shader);
+panfrost_nir_assign_sysvals(struct panfrost_sysvals *ctx, void *memctx, nir_shader *shader);
int
panfrost_sysval_for_instr(nir_instr *instr, nir_dest *dest);
diff --git a/lib/mesa/src/panfrost/util/pan_liveness.c b/lib/mesa/src/panfrost/util/pan_liveness.c
index a46a11d9d..de69dec63 100644
--- a/lib/mesa/src/panfrost/util/pan_liveness.c
+++ b/lib/mesa/src/panfrost/util/pan_liveness.c
@@ -128,11 +128,13 @@ pan_compute_liveness(
_mesa_hash_pointer,
_mesa_key_pointer_equal);
- /* Allocate */
+ /* Free any previous liveness, and allocate */
+
+ pan_free_liveness(blocks);
list_for_each_entry(pan_block, block, blocks, link) {
- block->live_in = rzalloc_array(NULL, uint16_t, temp_count);
- block->live_out = rzalloc_array(NULL, uint16_t, temp_count);
+ block->live_in = rzalloc_array(block, uint16_t, temp_count);
+ block->live_out = rzalloc_array(block, uint16_t, temp_count);
}
/* Initialize the work list with the exit block */
diff --git a/lib/mesa/src/panfrost/util/pan_sysval.c b/lib/mesa/src/panfrost/util/pan_sysval.c
index 5f67e71f6..2789c52da 100644
--- a/lib/mesa/src/panfrost/util/pan_sysval.c
+++ b/lib/mesa/src/panfrost/util/pan_sysval.c
@@ -124,10 +124,10 @@ panfrost_nir_assign_sysval_body(struct panfrost_sysvals *ctx, nir_instr *instr)
}
void
-panfrost_nir_assign_sysvals(struct panfrost_sysvals *ctx, nir_shader *shader)
+panfrost_nir_assign_sysvals(struct panfrost_sysvals *ctx, void *memctx, nir_shader *shader)
{
ctx->sysval_count = 0;
- ctx->sysval_to_id = _mesa_hash_table_u64_create(NULL);
+ ctx->sysval_to_id = _mesa_hash_table_u64_create(memctx);
nir_foreach_function(function, shader) {
if (!function->impl) continue;
diff --git a/lib/mesa/src/util/00-mesa-defaults.conf b/lib/mesa/src/util/00-mesa-defaults.conf
index 68c6b7425..9e6fd2911 100644
--- a/lib/mesa/src/util/00-mesa-defaults.conf
+++ b/lib/mesa/src/util/00-mesa-defaults.conf
@@ -637,6 +637,12 @@ TODO: document the other workarounds.
<application name="Peace, Death!" executable="runner" sha1="5b909f3d21799773370adf084f649848f098234e">
<option name="radeonsi_sync_compile" value="true" />
</application>
+ <application name="SPECviewperf13" executable="viewperf">
+ <option name="radeonsi_clamp_div_by_zero" value="true" />
+ </application>
+ <application name="Road Redemption" executable="RoadRedemption.x86_64">
+ <option name="radeonsi_clamp_div_by_zero" value="true" />
+ </application>
</device>
<device driver="virtio_gpu">
<!-- Some Valve games do a final blit to a BRGA_sRGB surface. On a GLES
diff --git a/lib/mesa/src/vulkan/device-select-layer/device_select_layer.c b/lib/mesa/src/vulkan/device-select-layer/device_select_layer.c
index 7bec88903..3a5981063 100644
--- a/lib/mesa/src/vulkan/device-select-layer/device_select_layer.c
+++ b/lib/mesa/src/vulkan/device-select-layer/device_select_layer.c
@@ -137,14 +137,17 @@ static VkResult device_select_CreateInstance(const VkInstanceCreateInfo *pCreate
PFN_vkCreateInstance fpCreateInstance =
(PFN_vkCreateInstance)info->GetInstanceProcAddr(NULL, "vkCreateInstance");
if (fpCreateInstance == NULL) {
+ free(info);
return VK_ERROR_INITIALIZATION_FAILED;
}
chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext;
VkResult result = fpCreateInstance(pCreateInfo, pAllocator, pInstance);
- if (result != VK_SUCCESS)
+ if (result != VK_SUCCESS) {
+ free(info);
return result;
+ }
for (unsigned i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
if (!strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME))