[PATCH v2] xrandr: display gamma and brightness

Éric Piel E.A.B.Piel at tudelft.nl
Tue Jan 19 03:01:11 PST 2010


Op 19-01-10 11:48, Matthias Hopf schreef:
> On Jan 18, 10 12:56:50 -0800, Yang Zhao wrote:
>>> @@ -1225,25 +1311,25 @@ set_gamma(void)
>>>
>>>     for (i = 0; i < size; i++) {
>>>         if (output->gamma.red == 1.0 && output->brightness == 1.0)
>>> -           gamma->red[i] = i << 8;
>>> +           gamma->red[i] = (i << 8) + i;
>>>         else
>>>             gamma->red[i] = dmin(pow((double)i/(double)(size - 1),
>>> -                       (double)output->gamma.red) * (double)(size - 1)
>>> -                       * (double)output->brightness * 256, 65535.0);
>>> +                                    output->gamma.red) * output->brightness,
>>> +                                1.0) * 65535.0;
>>> ...
>>
>> These changes weren't part of the original patch, and seems to subtly
>> change the semantics of setting the gamma correction curve.  Included
>> by accident?
> 
> I don't think so. This changes 8->16 bit conversion from
> 00->0000..ff->ff00 to 00->0000..ff->ffff.
> This looks better to me, as we're getting closer to full brightness, and
> improves reliability during backconversion.
> 
> However, I'd love to see this as a separate commit :-)
Indeed, it makes more sense to have it in a separate commit. I'll
separate them.

BTW, I couldn't find anywhere a precise definition of gamma. What is the
maximum value that can be contained?

I'm a bit confused by this type of commit:
http://cgit.freedesktop.org/xorg/xserver/commit/?id=b5736d237a21d5e65d839c4d213dd3bda5a11e9d

The only info I could find was in randrproto, and doesn't tell anything
about the CARD16 values contained:
"This request returns the currently set gamma ramps for 'crtc'.  All
three lists will be the size returned by the RRGetCrtcGammaSize request."

Does the maximum value really depends on the size of the array? Or is it
that size is always 256, so size * 256 is close enough to 65535 that it
works?

Eric


More information about the xorg-devel mailing list