From b17f9256d5958fdd45dd5fe0ce10663ef9634900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Sun, 31 Dec 2006 17:43:52 +0100 Subject: Only determine pitch after setting initial mode. We were determining it from the mode which is current at X server startup, which may have a completely different pitch. --- src/fbdev.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/fbdev.c b/src/fbdev.c index 1e09515..4136c11 100644 --- a/src/fbdev.c +++ b/src/fbdev.c @@ -523,15 +523,8 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags) fbdevHWUseBuildinMode(pScrn); pScrn->currentMode = pScrn->modes; - if (fPtr->shadowFB) - pScrn->displayWidth = pScrn->virtualX; /* ShadowFB handles this correctly */ - else { - int fbbpp; - /* FIXME: this doesn't work for all cases, e.g. when each scanline - has a padding which is independent from the depth (controlfb) */ - fbdevHWGetDepth(pScrn,&fbbpp); - pScrn->displayWidth = fbdevHWGetLineLength(pScrn)/(fbbpp >> 3); - } + /* First approximation, may be refined in ScreenInit */ + pScrn->displayWidth = pScrn->virtualX; xf86PrintModes(pScrn); @@ -719,6 +712,17 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) int tmp = pScrn->virtualX; pScrn->virtualX = pScrn->displayWidth = pScrn->virtualY; pScrn->virtualY = tmp; + } else if (!fPtr->shadowFB) { + /* FIXME: this doesn't work for all cases, e.g. when each scanline + has a padding which is independent from the depth (controlfb) */ + pScrn->displayWidth = fbdevHWGetLineLength(pScrn) / + (pScrn->bitsPerPixel / 8); + + if (pScrn->displayWidth != pScrn->virtualX) { + xf86DrvMsg(scrnIndex, X_INFO, + "Pitch updated to %d after ModeInit\n", + pScrn->displayWidth); + } } if(fPtr->rotate && !fPtr->PointerMoved) { -- cgit v1.2.1