[PATCH xserver 1/3] xfree86/modes: Move gamma initialization to xf86RandR12Init12 v2
Michel Dänzer
michel at daenzer.net
Wed Jul 27 02:39:47 UTC 2016
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? :)
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
More information about the xorg-devel
mailing list