[PATCH] Fix radeon vs fbdev pitch calculation.

David Woodhouse dwmw2 at infradead.org
Sun Oct 1 08:46:28 PDT 2006


http://david.woodhou.se/DCP_2736.JPG is pretty, but not useful. Fetch
the correct displayWidth from fbdevhw after setting the mode.

Based on http://people.freedesktop.org/~daenzer/radeon-usefbdev-pitch.diff

diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index c80ea13..cbf7fba 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -4107,7 +4102,8 @@ static Bool RADEONPreInitModes(ScrnInfoP
 
 	if (modesFound < 1 && info->FBDev) {
 	    fbdevHWUseBuildinMode(pScrn);
-	    pScrn->displayWidth = pScrn->virtualX; /* FIXME: might be wrong */
+	    pScrn->displayWidth = fbdevHWGetLineLength(pScrn)
+				/ info->CurrentLayout.pixel_bytes;
 	    modesFound = 1;
 	}
 
@@ -5886,6 +5880,8 @@ _X_EXPORT Bool RADEONScreenInit(int scrn
 	unsigned char *RADEONMMIO = info->MMIO;
 
 	if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE;
+	pScrn->displayWidth = fbdevHWGetLineLength(pScrn)
+		/ info->CurrentLayout.pixel_bytes;
 	RADEONSaveMemMapRegisters(pScrn, &info->ModeReg);
 	info->fbLocation = (info->ModeReg.mc_fb_location & 0xffff) << 16;
 	info->ModeReg.surface_cntl = INREG(RADEON_SURFACE_CNTL);
@@ -8854,7 +8854,9 @@ _X_EXPORT Bool RADEONSwitchMode(int scrn
 	RADEONSaveFBDevRegisters(pScrn, &info->ModeReg);
 
 	ret = fbdevHWSwitchMode(scrnIndex, mode, flags);
+	pScrn->displayWidth = fbdevHWGetLineLength(pScrn)
+		/ info->CurrentLayout.pixel_bytes;
 
 	RADEONRestoreFBDevRegisters(pScrn, &info->ModeReg);
     } else {
 	info->IsSwitching = TRUE;

-- 
dwmw2




More information about the xorg mailing list