xf86-video-ati: Branch 'master'

Alex Deucher agd5f at kemper.freedesktop.org
Thu Jan 3 12:48:04 PST 2008


 src/radeon_crtc.c   |    3 ++-
 src/radeon_driver.c |   36 ++++++++++--------------------------
 2 files changed, 12 insertions(+), 27 deletions(-)

New commits:
commit 2e4473b63d65801ae8ac5a8391de232b2201d958
Author: Alex Deucher <alex at samba.(none)>
Date:   Thu Jan 3 15:47:50 2008 -0500

    RADEON: fix crash when setting rotation in the config file
    
    xf86CrtcRotate() accesses pScrn->pScreen which is not set
    during ScreenInit().  This should also be fixed in the server.
    See bug 12129

diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c
index 207a5a6..585b452 100644
--- a/src/radeon_crtc.c
+++ b/src/radeon_crtc.c
@@ -361,7 +361,8 @@ static void *
 radeon_crtc_shadow_allocate (xf86CrtcPtr crtc, int width, int height)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
-    ScreenPtr pScreen = pScrn->pScreen;
+    /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */
+    ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
     RADEONInfoPtr  info = RADEONPTR(pScrn);
     RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
     unsigned long rotate_pitch;
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index d68b18f..1f12e87 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -3181,9 +3181,7 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
 {
     ScrnInfoPtr    pScrn = xf86Screens[pScreen->myNum];
     RADEONInfoPtr  info  = RADEONPTR(pScrn);
-    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
     int            hasDRI = 0;
-    int i;
 #ifdef RENDER
     int            subPixelOrder = SubPixelUnknown;
     char*          s;
@@ -3483,27 +3481,6 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
 
     pScrn->vtSema = TRUE;
 
-    for (i = 0; i < xf86_config->num_crtc; i++) {
-	xf86CrtcPtr	crtc = xf86_config->crtc[i];
-	    
-	/* Mark that we'll need to re-set the mode for sure */
-	memset(&crtc->mode, 0, sizeof(crtc->mode));
-	if (!crtc->desiredMode.CrtcHDisplay) {
-	    crtc->desiredMode = *RADEONCrtcFindClosestMode (crtc, pScrn->currentMode);
-	    crtc->desiredRotation = RR_Rotate_0;
-	    crtc->desiredX = 0;
-	    crtc->desiredY = 0;
-	}
-
-	if (!xf86CrtcSetMode (crtc, &crtc->desiredMode, crtc->desiredRotation, crtc->desiredX, crtc->desiredY))
-	    return FALSE;
-
-    }
-
-    RADEONSaveScreen(pScreen, SCREEN_SAVER_ON);
-
-    //    pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
-
     /* Backing store setup */
     xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
 		   "Initializing backing store\n");
@@ -3646,9 +3623,6 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
     info->CreateScreenResources = pScreen->CreateScreenResources;
     pScreen->CreateScreenResources = RADEONCreateScreenResources;
 
-   if (!xf86CrtcScreenInit (pScreen))
-       return FALSE;
-
     /* Wrap pointer motion to flip touch screen around */
     info->PointerMoved = pScrn->PointerMoved;
     pScrn->PointerMoved = RADEONPointerMoved;
@@ -3665,6 +3639,16 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
 #endif
 			     | CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE;
 
+#if 1
+    /* xf86CrtcRotate() accesses pScrn->pScreen */
+    pScrn->pScreen = pScreen;
+
+   if (!xf86CrtcScreenInit (pScreen))
+       return FALSE;
+   if (!xf86SetDesiredModes (pScrn))
+       return FALSE;
+#endif
+
     /* Note unused options */
     if (serverGeneration == 1)
 	xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);


More information about the xorg-commit mailing list