glx/glxdri.c                       |   17 +++++++++++++++--
 glx/glxdri2.c                      |   17 +++++++++++++++--
 hw/xfree86/common/xf86VGAarbiter.c |   10 +++++++++-
 hw/xfree86/common/xf86cmap.c       |    8 +++++++-
 hw/xfree86/common/xf86xv.c         |    8 ++++++++
 hw/xfree86/modes/xf86Crtc.c        |    2 ++
 hw/xfree86/modes/xf86RandR12.c     |   26 +++++++++++++++++++++++++-
 hw/xfree86/modes/xf86RandR12.h     |    1 +
 hw/xfree86/shadowfb/shadow.c       |   11 ++++++++++-
 hw/xfree86/xaa/xaaInit.c           |   12 +++++++++++-
 10 files changed, 103 insertions(+), 9 deletions(-)

New commits:
commit 3336e1f7f3d7a0e37cc75f7edd96524dd6cf228a
Author: Keith Packard <kei...@keithp.com>
Date:   Mon Jul 12 16:01:34 2010 -0700

    Unwrap/rewrap EnterVT/LeaveVT completely, Fixes 28998
    
    Because some EnterVT code needs to remove it self from the
    call chain, we need to fix all of the wrappers to correctly
    unwrap/rewrap during the call chain. This is a follow-on to the fix
    for bug 27114 in commit 68a9ee8370e6f9b38218376ac92d5130a5b0ef1e.
    
    Signed-off-by: Keith Packard <kei...@keithp.com>
    Tested-by: Jesse Barnes <jesse.bar...@intel.com>
    Reviewed-by: Daniel Stone <dan...@fooishbar.org>
    Reviewed-by: Tiago Vignatti <tiago.vigna...@nokia.com>
    (cherry picked from commit d75e8146c414bfd512ba5dbd4a83acb334bbe19b, and
    conflict from b618705 fixed up)
    Signed-off-by: Julien Cristau <jcris...@debian.org>

diff --git a/glx/glxdri.c b/glx/glxdri.c
index 6122653..06681fa 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -863,12 +863,21 @@ static const char dri_driver_path[] = DRI_DRIVER_PATH;
 static Bool
 glxDRIEnterVT (int index, int flags)
 {
+    ScrnInfoPtr scrn = xf86Screens[index];
+    Bool       ret;
     __GLXDRIscreen *screen = (__GLXDRIscreen *) 
        glxGetScreen(screenInfo.screens[index]);
 
     LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
 
-    if (!(*screen->enterVT) (index, flags))
+    scrn->EnterVT = screen->enterVT;
+
+    ret = scrn->EnterVT (index, flags);
+
+    screen->enterVT = scrn->EnterVT;
+    scrn->EnterVT = glxDRIEnterVT;
+
+    if (!ret)
        return FALSE;
     
     glxResumeClients();
@@ -879,6 +888,7 @@ glxDRIEnterVT (int index, int flags)
 static void
 glxDRILeaveVT (int index, int flags)
 {
+    ScrnInfoPtr scrn = xf86Screens[index];
     __GLXDRIscreen *screen = (__GLXDRIscreen *)
        glxGetScreen(screenInfo.screens[index]);
 
@@ -886,7 +896,10 @@ glxDRILeaveVT (int index, int flags)
 
     glxSuspendClients();
 
-    return (*screen->leaveVT) (index, flags);
+    scrn->LeaveVT = screen->leaveVT;
+    (*screen->leaveVT) (index, flags);
+    screen->leaveVT = scrn->LeaveVT;
+    scrn->LeaveVT = glxDRILeaveVT;
 }
 
 static void
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index ed7fb4c..249df79 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -512,12 +512,21 @@ static const char dri_driver_path[] = DRI_DRIVER_PATH;
 static Bool
 glxDRIEnterVT (int index, int flags)
 {
+    ScrnInfoPtr scrn = xf86Screens[index];
+    Bool       ret;
     __GLXDRIscreen *screen = (__GLXDRIscreen *) 
        glxGetScreen(screenInfo.screens[index]);
 
     LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
 
-    if (!(*screen->enterVT) (index, flags))
+    scrn->EnterVT = screen->enterVT;
+
+    ret = scrn->EnterVT (index, flags);
+
+    screen->enterVT = scrn->EnterVT;
+    scrn->EnterVT = glxDRIEnterVT;
+
+    if (!ret)
        return FALSE;
     
     glxResumeClients();
@@ -528,6 +537,7 @@ glxDRIEnterVT (int index, int flags)
 static void
 glxDRILeaveVT (int index, int flags)
 {
+    ScrnInfoPtr scrn = xf86Screens[index];
     __GLXDRIscreen *screen = (__GLXDRIscreen *)
        glxGetScreen(screenInfo.screens[index]);
 
@@ -535,7 +545,10 @@ glxDRILeaveVT (int index, int flags)
 
     glxSuspendClients();
 
-    return (*screen->leaveVT) (index, flags);
+    scrn->LeaveVT = screen->leaveVT;
+    (*screen->leaveVT) (index, flags);
+    screen->leaveVT = scrn->LeaveVT;
+    scrn->LeaveVT = glxDRILeaveVT;
 }
 
 static void
diff --git a/hw/xfree86/common/xf86VGAarbiter.c 
b/hw/xfree86/common/xf86VGAarbiter.c
index cd45cd1..2696e96 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -530,12 +530,16 @@ static Bool
 VGAarbiterEnterVT(int index, int flags)
 {
     Bool val;
+    ScrnInfoPtr pScrn = xf86Screens[index];
     ScreenPtr pScreen = screenInfo.screens[index];
     VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
         &pScreen->devPrivates, VGAarbiterScreenKey);
 
     VGAGet();
-    val = (*pScreenPriv->EnterVT)(index, flags);
+    pScrn->EnterVT = pScreenPriv->EnterVT;
+    val = (*pScrn->EnterVT)(index, flags);
+    pScreenPriv->EnterVT = pScrn->EnterVT;
+    pScrn->EnterVT = VGAarbiterEnterVT;
     VGAPut();
     return val;
 }
@@ -543,12 +547,16 @@ VGAarbiterEnterVT(int index, int flags)
 static void
 VGAarbiterLeaveVT(int index, int flags)
 {
+    ScrnInfoPtr pScrn = xf86Screens[index];
     ScreenPtr pScreen = screenInfo.screens[index];
     VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
         &pScreen->devPrivates, VGAarbiterScreenKey);
 
     VGAGet();
+    pScrn->LeaveVT = pScreenPriv->LeaveVT;
     (*pScreenPriv->LeaveVT)(index, flags);
+    pScreenPriv->LeaveVT = pScrn->LeaveVT;
+    pScrn->LeaveVT = VGAarbiterLeaveVT;
     VGAPut();
 }
 
diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index f60d96e..b5cff9c 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -456,11 +456,17 @@ CMapInstallColormap(ColormapPtr pmap)
 static Bool 
 CMapEnterVT(int index, int flags)
 {
+    ScrnInfoPtr pScrn = xf86Screens[index];
     ScreenPtr pScreen = screenInfo.screens[index];
+    Bool ret;
     CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
        &pScreen->devPrivates, CMapScreenKey);
 
-    if((*pScreenPriv->EnterVT)(index, flags)) {
+    pScrn->EnterVT = pScreenPriv->EnterVT;
+    ret = (*pScreenPriv->EnterVT)(index, flags);
+    pScreenPriv->EnterVT = pScrn->EnterVT;
+    pScrn->EnterVT = CMapEnterVT;
+    if(ret) {
        if(miInstalledMaps[index])
            CMapReinstallMap(miInstalledMaps[index]);
        return TRUE;
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 8221659..d263b63 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1225,11 +1225,15 @@ xf86XVQueryAdaptors(
 static Bool
 xf86XVEnterVT(int index, int flags)
 {
+    ScrnInfoPtr pScrn = xf86Screens[index];
     ScreenPtr pScreen = screenInfo.screens[index];
     XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
     Bool ret;
 
+    pScrn->EnterVT = ScreenPriv->EnterVT;
     ret = (*ScreenPriv->EnterVT)(index, flags);
+    ScreenPriv->EnterVT = pScrn->EnterVT;
+    pScrn->EnterVT = xf86XVEnterVT;
 
     if(ret) WalkTree(pScreen, xf86XVReputAllVideo, 0);
 
@@ -1239,6 +1243,7 @@ xf86XVEnterVT(int index, int flags)
 static void
 xf86XVLeaveVT(int index, int flags)
 {
+    ScrnInfoPtr pScrn = xf86Screens[index];
     ScreenPtr pScreen = screenInfo.screens[index];
     XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
     XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
@@ -1270,7 +1275,10 @@ xf86XVLeaveVT(int index, int flags)
        }
     }
 
+    pScrn->LeaveVT = ScreenPriv->LeaveVT;
     (*ScreenPriv->LeaveVT)(index, flags);
+    ScreenPriv->LeaveVT = pScrn->LeaveVT;
+    pScrn->LeaveVT = xf86XVLeaveVT;
 }
 
 static void
diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c
index 9c9aa0d..eb6a8c7 100644
--- a/hw/xfree86/shadowfb/shadow.c
+++ b/hw/xfree86/shadowfb/shadow.c
@@ -223,9 +223,14 @@ static Bool
 ShadowEnterVT(int index, int flags)
 {
     ScrnInfoPtr pScrn = xf86Screens[index];
+    Bool ret;
     ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen);
 
-    if((*pPriv->EnterVT)(index, flags)) {
+    pScrn->EnterVT = pPriv->EnterVT;
+    ret = (*pPriv->EnterVT)(index, flags);
+    pPriv->EnterVT = pScrn->EnterVT;
+    pScrn->EnterVT = ShadowEnterVT;
+    if(ret) {
        pPriv->vtSema = TRUE;
         return TRUE;
     }
@@ -236,11 +241,15 @@ ShadowEnterVT(int index, int flags)
 static void
 ShadowLeaveVT(int index, int flags)
 {
+    ScrnInfoPtr pScrn = xf86Screens[index];
     ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(xf86Screens[index]->pScreen);
 
     pPriv->vtSema = FALSE;
 
+    pScrn->LeaveVT = pPriv->LeaveVT;
     (*pPriv->LeaveVT)(index, flags);
+    pPriv->LeaveVT = pScrn->LeaveVT;
+    pScrn->LeaveVT = ShadowLeaveVT;
 }
 
 /**********************************************************/
diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c
index 2ce2d90..965c8ed 100644
--- a/hw/xfree86/xaa/xaaInit.c
+++ b/hw/xfree86/xaa/xaaInit.c
@@ -511,16 +511,23 @@ XAAChangeWindowAttributes (WindowPtr pWin, unsigned long 
mask)
 static Bool 
 XAAEnterVT(int index, int flags)
 {
+    ScrnInfoPtr pScrn = xf86Screens[index];
+    Bool ret;
     ScreenPtr pScreen = screenInfo.screens[index];
     XAAScreenPtr pScreenPriv = 
        (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
 
-    return((*pScreenPriv->EnterVT)(index, flags));
+    pScrn->EnterVT = pScreenPriv->EnterVT;
+    ret = ((*pScreenPriv->EnterVT)(index, flags));
+    pScreenPriv->EnterVT = pScrn->EnterVT;
+    pScrn->EnterVT = XAAEnterVT;
+    return ret;
 }
 
 static void 
 XAALeaveVT(int index, int flags)
 {
+    ScrnInfoPtr pScrn = xf86Screens[index];
     ScreenPtr pScreen = screenInfo.screens[index];
     XAAScreenPtr pScreenPriv = 
        (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
@@ -531,7 +538,10 @@ XAALeaveVT(int index, int flags)
         infoRec->NeedToSync = FALSE;
     }
 
+    pScrn->LeaveVT = pScreenPriv->LeaveVT;
     (*pScreenPriv->LeaveVT)(index, flags);
+    pScreenPriv->LeaveVT = pScrn->LeaveVT;
+    pScrn->LeaveVT = XAALeaveVT;
 }
 
 typedef struct {

commit 3fabfc198b6f22338f7691907db1b7c849ccac4c
Author: Keith Packard <kei...@keithp.com>
Date:   Fri May 7 22:56:04 2010 -0700

    Clean up RandR12 bits on screen close (bug 27114)
    
    When resetting the server, pScrn->EnterVT must be unwrapped or the
    next server generation will end up wrapping the wrapper and causing an
    infinite recursion on EnterVT.
    
    Signed-off-by: Keith Packard <kei...@keithp.com>
    Tested-by: Michael Stapelberg <michael+freedesk...@stapelberg.de>
    (cherry picked from commit 68a9ee8370e6f9b38218376ac92d5130a5b0ef1e)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 334fad4..3fcd79b 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -756,6 +756,8 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen)
 
        crtc->randr_crtc = NULL;
     }
+    xf86RandR12CloseScreen (screen);
+
     return screen->CloseScreen (index, screen);
 }
 
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 7ba09b6..9325e9b 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -927,6 +927,24 @@ xf86RandR12Init (ScreenPtr pScreen)
 }
 
 void
+xf86RandR12CloseScreen (ScreenPtr pScreen)
+{
+    XF86RandRInfoPtr   randrp;
+
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
+    if (xf86RandR12Key == NULL)
+       return;
+#endif
+
+    randrp = XF86RANDRINFO(pScreen);
+#if RANDR_12_INTERFACE
+    xf86Screens[pScreen->myNum]->EnterVT = randrp->orig_EnterVT;
+#endif
+
+    free(randrp);
+}
+
+void
 xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
 {
     XF86RandRInfoPtr   randrp;
@@ -1754,10 +1772,16 @@ static Bool
 xf86RandR12EnterVT (int screen_index, int flags)
 {
     ScreenPtr        pScreen = screenInfo.screens[screen_index];
+    ScrnInfoPtr             pScrn = xf86Screens[screen_index];
     XF86RandRInfoPtr randrp  = XF86RANDRINFO(pScreen);
+    Bool            ret;
 
     if (randrp->orig_EnterVT) {
-       if (!randrp->orig_EnterVT (screen_index, flags))
+       pScrn->EnterVT = randrp->orig_EnterVT;
+       ret = pScrn->EnterVT (screen_index, flags);
+       randrp->orig_EnterVT = pScrn->EnterVT;
+       pScrn->EnterVT = xf86RandR12EnterVT;
+       if (!ret)
            return FALSE;
     }
 
diff --git a/hw/xfree86/modes/xf86RandR12.h b/hw/xfree86/modes/xf86RandR12.h
index c8d9918..0c586be 100644
--- a/hw/xfree86/modes/xf86RandR12.h
+++ b/hw/xfree86/modes/xf86RandR12.h
@@ -30,6 +30,7 @@
 
 extern _X_EXPORT Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen);
 extern _X_EXPORT Bool xf86RandR12Init(ScreenPtr pScreen);
+extern _X_EXPORT void xf86RandR12CloseScreen(ScreenPtr pScreen);
 extern _X_EXPORT void xf86RandR12SetRotations (ScreenPtr pScreen, Rotation 
rotation);
 extern _X_EXPORT void xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool 
transforms);
 extern _X_EXPORT Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation 
rotation, int rate,


-- 
To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/e1otobs-0003yv...@alioth.debian.org

Reply via email to