Mesa (9.2): draw: always call util_cpu_detect() in draw context creation.

Roland Scheidegger sroland at kemper.freedesktop.org
Thu Aug 15 15:40:29 UTC 2013


Module: Mesa
Branch: 9.2
Commit: 4f44202aaeecad3518302c75e190224ecf36f33d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f44202aaeecad3518302c75e190224ecf36f33d

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Wed Jul 24 01:38:50 2013 +0200

draw: always call util_cpu_detect() in draw context creation.

Since disabling denorms in draw_vbo() we require the util_cpu_caps to be
initialized there. Hence add another util_cpu_detect() call in
draw_create_context() which should ensure this.
(There is another call in draw_get_option_use_llvm() which only gets called
with x86 (not x86_64) but calling it always there wouldn't help since it most
likely wouldn't get called when compiling without llvm, so leave it alone
there.)
This fixes https://bugs.freedesktop.org/show_bug.cgi?id=66806.
(Because util_cpu_caps wasn't initialized when first calling util_fpstate_get()
hence it returning zero, but it would later get initialized by rtasm translate
code hence when draw call returned it unmasked all exceptions by calling
util_fpstate_set(). This was happening only with DRAW_USE_LLVM=0 or not
compiling with llvm, otherwise the llvm init code was calling it on time too.)

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>
Reviewed-by: Zack Rusin <zackr at vmware.com>
Tested-by: Vinson Lee <vlee at freedesktop.org>

---

 src/gallium/auxiliary/draw/draw_context.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 4a08765..4a6ba1a 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -58,7 +58,7 @@ draw_get_option_use_llvm(void)
 
 #ifdef PIPE_ARCH_X86
       util_cpu_detect();
-      /* require SSE2 due to LLVM PR6960. */
+      /* require SSE2 due to LLVM PR6960. XXX Might be fixed by now? */
       if (!util_cpu_caps.has_sse2)
          value = FALSE;
 #endif
@@ -78,6 +78,9 @@ draw_create_context(struct pipe_context *pipe, boolean try_llvm)
    if (draw == NULL)
       goto err_out;
 
+   /* we need correct cpu caps for disabling denorms in draw_vbo() */
+   util_cpu_detect();
+
 #if HAVE_LLVM
    if (try_llvm && draw_get_option_use_llvm()) {
       draw->llvm = draw_llvm_create(draw);




More information about the mesa-commit mailing list