[PATCH 2/2] randr12: Initialize and keep track of updates to VidMode extension gamma value.

Simon Thum simon.thum at gmx.de
Sat May 9 09:19:59 PDT 2009


Michel Dänzer wrote:
> From: Michel Dänzer <daenzer at vmware.com>
> 
> This way clients querying the gamma value via the VidMode extension at least
> get the last value set via the same, rather than always something bogus.
Great! I just wanted to ask on the list whether xgamma is deprecated or 
something.

I guess this also fixes the case where you modify only one gamma channel 
using xgamma and screw your colours?

> ---
>  hw/xfree86/common/xf86Helper.c |   10 +++++-----
>  hw/xfree86/modes/xf86RandR12.c |    2 ++
>  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
> index 0db7717..61b3390 100644
> --- a/hw/xfree86/common/xf86Helper.c
> +++ b/hw/xfree86/common/xf86Helper.c
> @@ -919,11 +919,6 @@ Bool
>  xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma)
>  {
>      MessageType from = X_DEFAULT;
> -    /* Pretend we succeeded if we support better a gamma system.
> -     * This avoids a confusing message.
> -     */
> -    if (xf86_crtc_supports_gamma(scrp))
> -	return TRUE;
>  #if 0
>      xf86MonPtr DDC = (xf86MonPtr)(scrp->monitor->DDC);
>  #endif
> @@ -955,6 +950,11 @@ xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma)
>  	scrp->gamma.green = 1.0;
>  	scrp->gamma.blue = 1.0;
>      }
> +    /* Pretend we succeeded if we support better a gamma system.
> +     * This avoids a confusing message.
> +     */
> +    if (xf86_crtc_supports_gamma(scrp))
> +	return TRUE;
>      xf86DrvMsg(scrp->scrnIndex, from,
>  	       "Using gamma correction (%.1f, %.1f, %.1f)\n",
>  	       scrp->gamma.red, scrp->gamma.green, scrp->gamma.blue);
> diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
> index c71cfe5..1e3b70c 100644
> --- a/hw/xfree86/modes/xf86RandR12.c
> +++ b/hw/xfree86/modes/xf86RandR12.c
> @@ -1740,6 +1740,8 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
>  
>      xfree(points);
>  
> +    pScrn->gamma = gamma;
> +
>      return Success;
>  }
>  



More information about the xorg-devel mailing list