util: Use sizeof(void *) rather than 0 as the fallback cache line size
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>
Wed, 5 Jun 2013 14:38:27 +0000 (15:38 +0100)
committerAdam Jackson <ajax@redhat.com>
Mon, 10 Jun 2013 20:26:09 +0000 (16:26 -0400)
Without this, llvmpipe ends up giving a zero size to all uncompressed textures
on non-x86 systems, since align() cannot handle a 0 alignment.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
src/gallium/auxiliary/util/u_cpu_detect.c

index 7e6df9df1574cd2297d6444795656a8a85ce4637..763b5cc220f87f6ec9b8832fc431cc11372810c0 100644 (file)
@@ -250,6 +250,11 @@ util_cpu_detect(void)
    util_cpu_caps.nr_cpus = 1;
 #endif
 
+   /* Make the fallback cacheline size nonzero so that it can be
+    * safely passed to align().
+    */
+   util_cpu_caps.cacheline = sizeof(void *);
+
 #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
    if (has_cpuid()) {
       uint32_t regs[4];