diff options
author | Alex Deucher <alex@botch2.(none)> | 2007-10-18 20:06:58 -0400 |
---|---|---|
committer | Alex Deucher <alex@botch2.(none)> | 2007-10-18 20:06:58 -0400 |
commit | a9306b7986467c0794c91625ad2ece597b718462 (patch) | |
tree | f8eb983f19d94165bc96ef1e3584a8dd83bbe7c4 | |
parent | 115b4b65ef679a46d90b7fc8ac22ace37038b3fc (diff) |
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.
-rw-r--r-- | src/radeon_crtc.c | 16 |
1 files changed, 10 insertions, 6 deletions
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 */ } |