Gradients are broken with glamor when RepeatReflect is set

Jeffrey Smith whydoubt at gmail.com
Mon Jan 22 22:28:45 UTC 2018


On Mon, Jan 22, 2018 at 3:01 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> Quoting Adam Jackson (2018-01-22 20:09:52)
>> On Sat, 2017-12-23 at 19:26 +0100, Clemens Eisserer wrote:
>> > Hi there,
>> >
>> > Glamor's gradient acceleration code is broken in case RepeatReflect is
>> > used, please see: https://bugs.freedesktop.org/show_bug.cgi?id=98508
>> > I've filed the bug report over a year ago, but except for a
>> > confirmation from Michel Dänzer nothing happend.
>> >
>> > Unfourntunatly I lack the expertise to fix it myself - however instead
>> > of leaving it broken forever, could we fall back to software for
>> > RepeatReflect.
>> > I guess slow is better than completly broken?
>>
>> Just want to note that this isn't forgotten. I got as far as testing
>> the reproducer with Xephyr and verifying glamor was wrong and fb was
>> right, but don't yet get what the RepeatReflect math is getting wrong.
>> I'll definitely have a fix for 1.20 one way or another, but that may
>> just be forcing a fallback.
>>
>> If anyone wanted to investigate this, I think this is the guilty
>> conditional:
>>
>> https://cgit.freedesktop.org/xorg/xserver/tree/glamor/glamor_gradient.c#n296
>
> -t = abs(fract(t * 0.5 + 0.5) * 2.0 - 1.0);
> +t = abs(fract(abs(t) * 0.5 + 0.5) * 2.0 - 1.0);
>
> #include <stdio.h>
> #include <math.h>
>
> #define abs(t) fabs(t)
> #define fract(t) fmod((t), 1.0)
>
> static float repeat(float t)
> {
>         return abs(fract(abs(t) * 0.5 + 0.5) * 2.0 - 1.0);
> }
>
> int main(void)
> {
>         float t;
>
>         for (t = -3; t <= 3; t += .5)
>                 printf("%5.1f  ", t);
>         printf("\n");
>         for (t = -3; t <= 3; t += .5)
>                 printf("%5.1f  ", repeat(t));
>         printf("\n");
> }
>
>  -3.0   -2.5   -2.0   -1.5   -1.0   -0.5    0.0    0.5    1.0    1.5    2.0    2.5    3.0
>   1.0    0.5    0.0    0.5    1.0    0.5    0.0    0.5    1.0    0.5    0.0    0.5    1.0
> -Chris

For comparison, I think it's worth noting that the current equation results in:

1.0    2.5    2.0    1.5    1.0    0.5    0.0    0.5    1.0    0.5
0.0    0.5    1.0
          ^       ^       ^

 -- Jeff

> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list