[Mesa-dev] [PATCH] fix several maybe uninitialized variable errors
Marc Dietrich
marvin24 at gmx.de
Fri Mar 23 11:15:42 UTC 2018
Mostly false warnings, however AVX detection could have been problematic.
Signed-off-by: Marc Dietrich <marvin24 at gmx.de>
---
src/compiler/spirv/vtn_subgroup.c | 2 ++
src/gallium/auxiliary/util/u_cpu_detect.c | 35 ++++++++++++++--------------
src/gallium/auxiliary/vl/vl_vlc.h | 3 +++
src/gallium/state_trackers/xvmc/subpicture.c | 2 +-
4 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/src/compiler/spirv/vtn_subgroup.c b/src/compiler/spirv/vtn_subgroup.c
index bd3143962b..107fe247b5 100644
--- a/src/compiler/spirv/vtn_subgroup.c
+++ b/src/compiler/spirv/vtn_subgroup.c
@@ -277,6 +277,8 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
case 2:
op = nir_intrinsic_quad_swap_diagonal;
break;
+ default:
+ unreachable("Unhandled opcode");
}
vtn_build_subgroup_instr(b, op, val->ssa, vtn_ssa_value(b, w[4]),
NULL, 0, 0);
diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c
index 6a59f271a8..adbc55ff8b 100644
--- a/src/gallium/auxiliary/util/u_cpu_detect.c
+++ b/src/gallium/auxiliary/util/u_cpu_detect.c
@@ -442,6 +442,24 @@ util_cpu_detect(void)
cacheline = ((regs2[1] >> 8) & 0xFF) * 8;
if (cacheline > 0)
util_cpu_caps.cacheline = cacheline;
+
+ // check for avx512
+ if (((regs2[2] >> 27) & 1) && // OSXSAVE
+ (xgetbv() & (0x7 << 5)) && // OPMASK: upper-256 enabled by OS
+ ((xgetbv() & 6) == 6)) { // XMM/YMM enabled by OS
+ uint32_t regs3[4];
+ cpuid_count(0x00000007, 0x00000000, regs3);
+ util_cpu_caps.has_avx512f = (regs3[1] >> 16) & 1;
+ util_cpu_caps.has_avx512dq = (regs3[1] >> 17) & 1;
+ util_cpu_caps.has_avx512ifma = (regs3[1] >> 21) & 1;
+ util_cpu_caps.has_avx512pf = (regs3[1] >> 26) & 1;
+ util_cpu_caps.has_avx512er = (regs3[1] >> 27) & 1;
+ util_cpu_caps.has_avx512cd = (regs3[1] >> 28) & 1;
+ util_cpu_caps.has_avx512bw = (regs3[1] >> 30) & 1;
+ util_cpu_caps.has_avx512vl = (regs3[1] >> 31) & 1;
+ util_cpu_caps.has_avx512vbmi = (regs3[2] >> 1) & 1;
+ }
+
}
if (util_cpu_caps.has_avx && regs[0] >= 0x00000007) {
uint32_t regs7[4];
@@ -449,23 +467,6 @@ util_cpu_detect(void)
util_cpu_caps.has_avx2 = (regs7[1] >> 5) & 1;
}
- // check for avx512
- if (((regs2[2] >> 27) & 1) && // OSXSAVE
- (xgetbv() & (0x7 << 5)) && // OPMASK: upper-256 enabled by OS
- ((xgetbv() & 6) == 6)) { // XMM/YMM enabled by OS
- uint32_t regs3[4];
- cpuid_count(0x00000007, 0x00000000, regs3);
- util_cpu_caps.has_avx512f = (regs3[1] >> 16) & 1;
- util_cpu_caps.has_avx512dq = (regs3[1] >> 17) & 1;
- util_cpu_caps.has_avx512ifma = (regs3[1] >> 21) & 1;
- util_cpu_caps.has_avx512pf = (regs3[1] >> 26) & 1;
- util_cpu_caps.has_avx512er = (regs3[1] >> 27) & 1;
- util_cpu_caps.has_avx512cd = (regs3[1] >> 28) & 1;
- util_cpu_caps.has_avx512bw = (regs3[1] >> 30) & 1;
- util_cpu_caps.has_avx512vl = (regs3[1] >> 31) & 1;
- util_cpu_caps.has_avx512vbmi = (regs3[2] >> 1) & 1;
- }
-
if (regs[1] == 0x756e6547 && regs[2] == 0x6c65746e && regs[3] == 0x49656e69) {
/* GenuineIntel */
util_cpu_caps.has_intel = 1;
diff --git a/src/gallium/auxiliary/vl/vl_vlc.h b/src/gallium/auxiliary/vl/vl_vlc.h
index dd7b0918ae..e1e9c486ee 100644
--- a/src/gallium/auxiliary/vl/vl_vlc.h
+++ b/src/gallium/auxiliary/vl/vl_vlc.h
@@ -197,6 +197,9 @@ vl_vlc_init(struct vl_vlc *vlc, unsigned num_inputs,
vl_vlc_next_input(vlc);
vl_vlc_align_data_ptr(vlc);
vl_vlc_fillbits(vlc);
+ } else {
+ vlc->data = NULL;
+ vlc->end = NULL;
}
}
diff --git a/src/gallium/state_trackers/xvmc/subpicture.c b/src/gallium/state_trackers/xvmc/subpicture.c
index bc26976e28..e28fd43f7a 100644
--- a/src/gallium/state_trackers/xvmc/subpicture.c
+++ b/src/gallium/state_trackers/xvmc/subpicture.c
@@ -266,7 +266,7 @@ Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *
struct pipe_context *pipe;
struct pipe_resource tex_templ, *tex;
struct pipe_sampler_view sampler_templ;
- enum pipe_format palette_format;
+ enum pipe_format palette_format = PIPE_FORMAT_NONE;
Status ret;
XVMC_MSG(XVMC_TRACE, "[XvMC] Creating subpicture %p.\n", subpicture);
--
2.16.2
More information about the mesa-dev
mailing list