diff options
author | Wang He <[email protected]> | 2016-05-10 13:40:30 +0800 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-05-18 23:37:14 +0200 |
commit | f21b7d1e5c21b749ae7c19d3dc80dc4e14e4bb77 (patch) | |
tree | ac6cf32bdb570f2a9bf02b7b4d25b01a8224da29 | |
parent | de39231134348a5ffb92f7cc2b3098e11384912a (diff) |
st/nine: Minor change to support musl libc
A few changes to support musl libc as well.
In particular fpu_control.h is glibc specific.
fenv.h doesn't enable to do exactly what we want either,
so instead use assembly directly.
Signed-off-by: Wang He <[email protected]>
Reviewed-by: Axel Davy <[email protected]>
-rw-r--r-- | src/gallium/state_trackers/nine/device9.c | 15 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/threadpool.h | 2 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index b29e161869c..20a0ce064f5 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -57,20 +57,19 @@ #if defined(PIPE_CC_GCC) && (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)) -#include <fpu_control.h> - static void nine_setup_fpu() { - fpu_control_t c; + uint16_t c; + + __asm__ __volatile__ ("fnstcw %0" : "=m" (*&c)); - _FPU_GETCW(c); /* clear the control word */ - c &= _FPU_RESERVED; + c &= 0xF0C0; /* d3d9 doc/wine tests: mask all exceptions, use single-precision * and round to nearest */ - c |= _FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM | _FPU_MASK_OM | - _FPU_MASK_UM | _FPU_MASK_PM | _FPU_SINGLE | _FPU_RC_NEAREST; - _FPU_SETCW(c); + c |= 0x003F; + + __asm__ __volatile__ ("fldcw %0" : : "m" (*&c)); } #else diff --git a/src/gallium/state_trackers/nine/threadpool.h b/src/gallium/state_trackers/nine/threadpool.h index 2562c96f256..6f8f8c455d0 100644 --- a/src/gallium/state_trackers/nine/threadpool.h +++ b/src/gallium/state_trackers/nine/threadpool.h @@ -24,6 +24,8 @@ #ifndef _THREADPOOL_H_ #define _THREADPOOL_H_ +#include <pthread.h> + struct NineSwapChain9; #define MAXTHREADS 1 |