[PATCH 2/3] xrandr: fix gamma == 1.0 && sigbits != 8

Andy Ritger aritger at nvidia.com
Wed Aug 15 10:16:57 PDT 2012


On Wed, Aug 15, 2012 at 09:36:58AM -0700, Yang Zhao wrote:
> On 13 August 2012 16:25, Andy Ritger <aritger at nvidia.com> wrote:
> > The gamma-correction lookup table managed through XRR[GS]etCrtcGamma is
> > 2^n in size, where 'n' is the number of significant bits in the X Color.
> > ...
> >  xrandr.c |   15 +++++++++++----
> >  1 files changed, 11 insertions(+), 4 deletions(-)
> >
> > diff --git a/xrandr.c b/xrandr.c
> > index 75ed2ee..5709ded 100644
> > --- a/xrandr.c
> > +++ b/xrandr.c
> ...
> > @@ -1366,21 +1373,21 @@ set_gamma(void)
> >
> >         for (i = 0; i < size; i++) {
> >             if (gammaRed == 1.0 && output->brightness == 1.0)
> > -               gamma->red[i] = (i << 8) + i;
> > +               gamma->red[i] = (i << shift);
> >             else
> >                 gamma->red[i] = dmin(pow((double)i/(double)(size - 1),
> >                                          gammaRed) * output->brightness,
> >                                      1.0) * 65535.0;
> >...
> 
> At first glance it looks like you are making changes here that are
> then changed again in patch 3/3. If this is the case, please consider
> squashing them together so it's easier to review.

Thanks for taking a look at this.

Yes, patch 2/3 and patch 3/3 overlap in the code they touch:

Patch 2/3 removes an assumption that XRRGetCrtcGammaSize() == 256,
by shifting i into the MSBs of the 16 bit value in the gamma==1.0
special case.

Patch 3/3 pulls that shift out of the gamma==1.0 special case as part
of computing values in the range [2^(16-sigbits),2^16).

The two patches accomplish different things, so I tried to keep them
distinct.

Given that context, if you think they would be easier to review in one
patch, let me know and I can squash them.

Thanks,
- Andy


> -- 
> Yang Zhao
> http://yangman.ca


More information about the xorg-devel mailing list