Re: [PATCH libdrm] xf86drm.c: Use integer logarithm.

2020-10-28 Thread Paul Gofman
On 10/28/20 13:30, Michel Dänzer wrote: > On 2020-10-28 11:09 a.m., Paul Gofman wrote: >> On 10/28/20 11:18, Pekka Paalanen wrote: >>>   +static unsigned log2_int(unsigned x) +{ +    unsigned l; + +    if (x < 2) { +    return 0; +    } +    for (l = 2; ;

Re: [PATCH libdrm] xf86drm.c: Use integer logarithm.

2020-10-28 Thread Michel Dänzer
On 2020-10-28 11:09 a.m., Paul Gofman wrote: On 10/28/20 11:18, Pekka Paalanen wrote: +static unsigned log2_int(unsigned x) +{ +unsigned l; + +if (x < 2) { +return 0; +} +for (l = 2; ; l++) { +if ((unsigned)(1 << l) > x) { Hi, wouldn't this loop fail to end

Re: [PATCH libdrm] xf86drm.c: Use integer logarithm.

2020-10-28 Thread Paul Gofman
On 10/28/20 11:18, Pekka Paalanen wrote: > >> >> +static unsigned log2_int(unsigned x) >> +{ >> +unsigned l; >> + >> +if (x < 2) { >> +return 0; >> +} >> +for (l = 2; ; l++) { >> +if ((unsigned)(1 << l) > x) { > Hi, > > wouldn't this loop fail to end when x >= 0x80

Re: [PATCH libdrm] xf86drm.c: Use integer logarithm.

2020-10-28 Thread Pekka Paalanen
On Mon, 26 Oct 2020 16:11:20 +0300 Paul Gofman wrote: > log() is affected by FP control word and can provide inaccurate result. > > Fixes Killer Instinct under Wine not being able to find AMD vulkan > device. > > Signed-off-by: Paul Gofman > --- > With the rounding mode the application set

Re: [PATCH libdrm] xf86drm.c: Use integer logarithm.

2020-10-27 Thread Dave Airlie
I've applied this to libdrm master. Thanks, Dave. On Mon, 26 Oct 2020 at 23:27, Paul Gofman wrote: > > log() is affected by FP control word and can provide inaccurate result. > > Fixes Killer Instinct under Wine not being able to find AMD vulkan > device. > > Signed-off-by: Paul Gofman > --- >

[PATCH libdrm] xf86drm.c: Use integer logarithm.

2020-10-26 Thread Paul Gofman
log() is affected by FP control word and can provide inaccurate result. Fixes Killer Instinct under Wine not being able to find AMD vulkan device. Signed-off-by: Paul Gofman --- With the rounding mode the application sets (unsigned int)log2(4) is 1. The log2_int() implemetation is copied