[Mesa-dev] [PATCH 08/16] st/nine: Change x86 FPU Control word on device creation as on wined3d and windows

Ilia Mirkin imirkin at alum.mit.edu
Fri Apr 24 13:59:40 PDT 2015


Can you use the fe* class of functions for this? Not entirely sure
what this is setting, but you should be able to do it with
fegetenv/fesetenv, or the more specialized functions.

On Fri, Apr 24, 2015 at 4:09 PM, Axel Davy <axel.davy at ens.fr> wrote:
> From: Tiziano Bacocco <tizbac2 at gmail.com>
>
> Signed-off-by: Tiziano Bacocco <tizbac2 at gmail.com>
> ---
>  src/gallium/state_trackers/nine/device9.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
> index 1a776a7..4ef02bb 100644
> --- a/src/gallium/state_trackers/nine/device9.c
> +++ b/src/gallium/state_trackers/nine/device9.c
> @@ -53,6 +53,18 @@
>
>  #define DBG_CHANNEL DBG_DEVICE
>
> +static void nine_setup_fpu(void)
> +{
> +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
> +    WORD cw;
> +    __asm__ volatile ("fnstcw %0" : "=m" (cw));
> +    cw = (cw & ~0xf3f) | 0x3f;
> +    __asm__ volatile ("fldcw %0" : : "m" (cw));
> +#else
> +    WARN_ONCE("FPU setup not supported on non-x86 platforms\n");
> +#endif
> +}
> +
>  static void
>  NineDevice9_SetDefaultState( struct NineDevice9 *This, boolean is_reset )
>  {
> @@ -168,6 +180,9 @@ NineDevice9_ctor( struct NineDevice9 *This,
>      IDirect3D9_AddRef(This->d3d9);
>      ID3DPresentGroup_AddRef(This->present);
>
> +    if (!(This->params.BehaviorFlags & D3DCREATE_FPU_PRESERVE))
> +        nine_setup_fpu();
> +
>      This->pipe = This->screen->context_create(This->screen, NULL);
>      if (!This->pipe) { return E_OUTOFMEMORY; } /* guess */
>
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list