[Mesa-dev] [PATCH] draw: always call and move util_cpu_detect() to draw context creation.

Zack Rusin zackr at vmware.com
Tue Jul 23 17:25:48 PDT 2013


Nice catch! Thanks!

----- Original Message -----
> From: Roland Scheidegger <sroland at vmware.com>
> 
> CPU detection is not really x86 specific, the ifdef in particular didn't
> even catch x86_64.
> Also move to draw context creation which seems a lot cleaner, and just
> call it always (which seems like a better idea than rely on drivers doing
> this
> especially if drivers otherwise don't need it).
> 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.)
> ---
>  src/gallium/auxiliary/draw/draw_context.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_context.c
> b/src/gallium/auxiliary/draw/draw_context.c
> index 4a08765..26af984 100644
> --- a/src/gallium/auxiliary/draw/draw_context.c
> +++ b/src/gallium/auxiliary/draw/draw_context.c
> @@ -57,8 +57,7 @@ draw_get_option_use_llvm(void)
>        value = debug_get_bool_option("DRAW_USE_LLVM", TRUE);
>  
>  #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 +77,8 @@ draw_create_context(struct pipe_context *pipe, boolean
> try_llvm)
>     if (draw == NULL)
>        goto err_out;
>  
> +   util_cpu_detect();
> +
>  #if HAVE_LLVM
>     if (try_llvm && draw_get_option_use_llvm()) {
>        draw->llvm = draw_llvm_create(draw);
> --
> 1.7.9.5
> 


More information about the mesa-dev mailing list