[PATCH xserver 1/3] xfree86/modes: Move gamma initialization to xf86RandR12Init12 v2

Michel Dänzer michel at daenzer.net
Wed Jul 27 09:54:51 UTC 2016


On 27.07.2016 18:09, walter harms wrote:
> Am 27.07.2016 04:39, schrieb Michel Dänzer:
>> On 26.07.2016 23:25, walter harms wrote:
>>> Am 26.07.2016 11:11, schrieb Michel Dänzer:
>>>>
>>>> diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
>>>> index 9f93270..5b24ebb 100644
>>>> --- a/hw/xfree86/modes/xf86RandR12.c
>>>> +++ b/hw/xfree86/modes/xf86RandR12.c
>>>> @@ -1313,6 +1313,116 @@ xf86RandR12CrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr randr_crtc)
>>>>      return TRUE;
>>>>  }
>>>>  
>>>> +static void
>>>> +init_one_component(CARD16 *comp, unsigned size, unsigned shift, float gamma)
>>>> +{
>>>> +    int i;
>>>> +
>>>> +    if (gamma == 1.0) {
>>>> +        for (i = 0; i < size; i++)
>>>> +            comp[i] = i << shift;
>>>> +    } else {
>>>> +        for (i = 0; i < size; i++)
>>> I know it was not the the original source but to have a change to read this ...
>>>
>>>           double a=(double) i / (double) (size - 1);
>>>  	  double b=(double) (size - 1) * (1 << shift)    //const
>>> 	  double c= 1.0 / (double) gamma;                //const
>>>
>>>           comp[i] = (CARD16) (pow(a,c)*b);
>>>
>>> feel free to move the lines marked const out of the loop to be faster
>>
>> Would you like to send a follow-up patch and get proper credit for your
>> suggestion? :)
>>
> 
> You deserve all the credits,
>  i would have to download the whole source, update programs ... :)

Anyway, your suggestion is out of the scope of this change, and I don't
have the bandwidth right now to change the code accordingly and test it
appropriately, so I'll leave it to you or anyone else to submit a
follow-up patch for it.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the xorg-devel mailing list