xf86-video-ati: Branch 'master'

Alex Deucher agd5f at kemper.freedesktop.org
Thu Oct 18 17:07:32 PDT 2007


 src/radeon_crtc.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit a9306b7986467c0794c91625ad2ece597b718462
Author: Alex Deucher <alex at botch2.(none)>
Date:   Thu Oct 18 20:06:58 2007 -0400

    RADEON: fix possible crash in radeon_crtc_mode_set()
    
    when radeon_crtc_mode_set() is called during ScreenInit(),
    we don't have pScrn->pScreen yet.

diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c
index eeb1c6c..de24273 100644
--- a/src/radeon_crtc.c
+++ b/src/radeon_crtc.c
@@ -802,10 +802,11 @@ radeon_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
 #ifdef XF86DRI
 	if (info->directRenderingEnabled && (info->tilingEnabled != tilingOld)) {
 	    RADEONSAREAPrivPtr pSAREAPriv;
-	  if (RADEONDRISetParam(pScrn, RADEON_SETPARAM_SWITCH_TILING, (info->tilingEnabled ? 1 : 0)) < 0)
-	      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-			 "[drm] failed changing tiling status\n");
-	    pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen);
+	    if (RADEONDRISetParam(pScrn, RADEON_SETPARAM_SWITCH_TILING, (info->tilingEnabled ? 1 : 0)) < 0)
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+			   "[drm] failed changing tiling status\n");
+	    /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */
+	    pSAREAPriv = DRIGetSAREAPrivate(screenInfo.screens[pScrn->scrnIndex]);
 	    info->tilingEnabled = pSAREAPriv->tiling_enabled ? TRUE : FALSE;
 	}
 #endif
@@ -911,9 +912,12 @@ radeon_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
 
     if (info->tilingEnabled != tilingOld) {
 	/* need to redraw front buffer, I guess this can be considered a hack ? */
-	xf86EnableDisableFBAccess(pScrn->scrnIndex, FALSE);
+	/* if this is called during ScreenInit() we don't have pScrn->pScreen yet */
+	if (pScrn->pScreen)
+	    xf86EnableDisableFBAccess(pScrn->scrnIndex, FALSE);
 	RADEONChangeSurfaces(pScrn);
-	xf86EnableDisableFBAccess(pScrn->scrnIndex, TRUE);
+	if (pScrn->pScreen)
+	    xf86EnableDisableFBAccess(pScrn->scrnIndex, TRUE);
 	/* xf86SetRootClip would do, but can't access that here */
     }
 


More information about the xorg-commit mailing list