summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2006-12-31 17:43:52 +0100
committerMichel Dänzer <michel@tungstengraphics.com>2006-12-31 17:43:52 +0100
commitb17f9256d5958fdd45dd5fe0ce10663ef9634900 (patch)
treef89866b179e444ac60fb76d1383c944650f2ed20 /src
parent436a2c094aecb661e183e3ca247765a0fe1fa4bc (diff)
downloadxorg-driver-xf86-video-fbdev-b17f9256d5958fdd45dd5fe0ce10663ef9634900.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/fbdev.c22
1 files changed, 13 insertions, 9 deletions
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) {