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

Axel Davy axel.davy at ens.fr
Sat Apr 25 00:58:39 PDT 2015


Le 24/04/2015 23:42, Henri Verbeet a écrit :
> On 24 April 2015 at 22:09, Axel Davy <axel.davy at ens.fr> wrote:
>> +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
>> +}
>> +
> This is once again similar enough to the corresponding Wine source
> that I feel the need to remind you, this time more strongly, that Wine
> is licensed under LGPL 2.1+. ( For the curious, (warning, LGPL)
> https://source.winehq.org/git/wine.git/blob/25f0606e84bef7d60ea5c681d19b368660cab8e3:/dlls/d3d9/device.c#l3604)
> Besides, proper Gallium style would have been to use PIPE_CC_GCC and
> PIPE_ARCH_X86/PIPE_ARCH_X86_64.
>
Thanks for the warning.

I think something like that would be more appropriate:

#if defined(PIPE_CC_GCC) && (defined(PIPE_ARCH_X86) || 
defined(PIPE_ARCH_X86_64))

#include <fpu_control.h>

static void nine_setup()
{
     fpu_control_t c;

     _FPU_GETCW(c);
     /* clear the control word */
     c &= _FPU_RESERVED;
     /* enable interrupts (d3d9 doc, wine tests) */
     c |= _FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM | _FPU_MASK_OM |
            _FPU_MASK_UM | _FPU_MASK_PM;
     _FPU_SETCW(c);
}
#else
static void nine_setup()
{
     WARN_ONCE("Ignoring FPU setup for this configuration\n");
}
#endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150425/75d25eb7/attachment.html>


More information about the mesa-dev mailing list