diff options
author | Alex Deucher <alex@samba.(none)> | 2008-01-03 15:47:50 -0500 |
---|---|---|
committer | Alex Deucher <alex@samba.(none)> | 2008-01-03 15:47:50 -0500 |
commit | 2e4473b63d65801ae8ac5a8391de232b2201d958 (patch) | |
tree | 058e401243144230f8f9e9eb2b7e976704628148 /src | |
parent | c652208861bffca94f06b7f67688ce220e050bfb (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/radeon_crtc.c | 3 | ||||
-rw-r--r-- | src/radeon_driver.c | 36 |
2 files changed, 12 insertions, 27 deletions
diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c index 207a5a67..585b452e 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 d68b18f8..1f12e870 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); |