xserver: Branch 'master' - 3 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Thu May 14 02:49:41 PDT 2009


 glx/glxext.c                   |    4 ++++
 hw/xfree86/common/xf86Helper.c |   10 +++++-----
 hw/xfree86/modes/xf86Crtc.c    |    6 +++---
 hw/xfree86/modes/xf86RandR12.c |    4 +++-
 4 files changed, 15 insertions(+), 9 deletions(-)

New commits:
commit 2075d4bf9e53b8baef0b919da6c44771220cd4a5
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Thu May 14 11:46:41 2009 +0200

    glx: If a destroyed window is bound to the current context, make it not current.
    
    Avoids subsequent crashes due to stale pointers to the DrawableRec, see
    https://bugs.freedesktop.org/show_bug.cgi?id=21132#c15 and previous comments.
    
    Signed-off-by: Michel Dänzer <daenzer at vmware.com>

diff --git a/glx/glxext.c b/glx/glxext.c
index 93391e9..6bc7bef 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -126,6 +126,10 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
     __GLXcontext *c;
 
     for (c = glxAllContexts; c; c = c->next) {
+	if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
+	    (*c->loseCurrent)(c);
+	    __glXFlushContextCache();
+	}
 	if (c->drawPriv == glxPriv)
 	    c->drawPriv = NULL;
 	if (c->readPriv == glxPriv)
commit 2c1190f888515292de01e60fe74657c34b99fd9e
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Thu May 14 11:39:16 2009 +0200

    randr12: Initialize and keep track of updates to VidMode extension gamma value.
    
    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.
    
    Signed-off-by: Michel Dänzer <daenzer at vmware.com>

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;
 }
 
commit fc3ce861cdab8606610726ce7c53f57d950c2407
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Thu May 14 11:35:25 2009 +0200

    randr12: Fix calculation of gamma ramp values.
    
    The reciprocal gamma value was missed in the first copy and this mistake was
    propagated to the second one.
    
    Signed-off-by: Michel Dänzer <daenzer at vmware.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 1b241cd..0ab2f3d 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2228,19 +2228,19 @@ xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
             red[i] = i << 8;
         else
             red[i] = (CARD16)(pow((double)i/(double)(size - 1),
-			(double)gamma_red) * (double)(size - 1) * 256);
+			1. / (double)gamma_red) * (double)(size - 1) * 256);
 
         if (gamma_green == 1.0)
             green[i] = i << 8;
         else
             green[i] = (CARD16)(pow((double)i/(double)(size - 1),
-			(double)gamma_green) * (double)(size - 1) * 256);
+			1. / (double)gamma_green) * (double)(size - 1) * 256);
 
         if (gamma_blue == 1.0)
             blue[i] = i << 8;
         else
             blue[i] = (CARD16)(pow((double)i/(double)(size - 1),
-			(double)gamma_blue) * (double)(size - 1) * 256);
+			1. / (double)gamma_blue) * (double)(size - 1) * 256);
     }
 
     /* Default size is 256, so anything else is failure. */
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index f941a3b..c71cfe5 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1703,7 +1703,7 @@ gamma_to_ramp(float gamma, CARD16 *ramp, int size)
 	if (gamma == 1.0)
 	    ramp[i] = i << 8;
 	else
-	    ramp[i] = (CARD16)(pow((double)i / (double)(size - 1), gamma)
+	    ramp[i] = (CARD16)(pow((double)i / (double)(size - 1), 1. / gamma)
 			       * (double)(size - 1) * 256);
     }
 }


More information about the xorg-commit mailing list