summaryrefslogtreecommitdiff
path: root/src/radeon_crtc.c
diff options
context:
space:
mode:
authorAlex Deucher <alex@botch2.(none)>2007-10-18 20:06:58 -0400
committerAlex Deucher <alex@botch2.(none)>2007-10-18 20:06:58 -0400
commita9306b7986467c0794c91625ad2ece597b718462 (patch)
treef8eb983f19d94165bc96ef1e3584a8dd83bbe7c4 /src/radeon_crtc.c
parent115b4b65ef679a46d90b7fc8ac22ace37038b3fc (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.
Diffstat (limited to 'src/radeon_crtc.c')
-rw-r--r--src/radeon_crtc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c
index eeb1c6c8..de242730 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 */
}