diff options
Diffstat (limited to 'src/via_memory.c')
-rw-r--r-- | src/via_memory.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/via_memory.c b/src/via_memory.c index a946166..f651817 100644 --- a/src/via_memory.c +++ b/src/via_memory.c @@ -210,10 +210,11 @@ ViaMemFBAlloc(ScrnInfoPtr pScrn, unsigned long size, CARD8 alignment) * */ void -ViaMemInit(ScrnInfoPtr pScrn, ScreenPtr pScreen) +ViaMemInit(ScrnInfoPtr pScrn, ScreenPtr pScreen) { VIAPtr pVia = VIAPTR(pScrn); unsigned long offset, size; + CARD16 Bpp = pScrn->bitsPerPixel >> 3; VIAFUNC(pScrn); @@ -221,8 +222,8 @@ ViaMemInit(ScrnInfoPtr pScrn, ScreenPtr pScreen) pVia->FBFreeStart, pVia->FBFreeSize); /* Why doesn't the FB manager handle alignment itself? */ - offset = (pVia->FBFreeStart + pVia->Bpp - 1 ) / pVia->Bpp; - size = pVia->FBFreeSize / pVia->Bpp - offset; + offset = (pVia->FBFreeStart + Bpp - 1 ) / Bpp; + size = pVia->FBFreeSize / Bpp - offset; if (size > 0) xf86InitFBManagerLinear(pScreen, offset, size); @@ -252,11 +253,12 @@ ViaMemFBAlloc(ScrnInfoPtr pScrn, unsigned long size, CARD8 alignment) struct ViaMem *Mem; FBLinearPtr linear; unsigned long tempsize; + CARD16 Bpp = pScrn->bitsPerPixel >> 3; VIAFUNC(pScrn); /* Make sure we don't truncate requested size */ - tempsize = (size + alignment + pVia->Bpp - 1) / pVia->Bpp; + tempsize = (size + alignment + Bpp - 1) / Bpp; linear = xf86AllocateOffscreenLinear(pScrn->pScreen, tempsize, 32, NULL, NULL, NULL); @@ -264,7 +266,7 @@ ViaMemFBAlloc(ScrnInfoPtr pScrn, unsigned long size, CARD8 alignment) return NULL; Mem = xnfcalloc(sizeof(struct ViaMem), 1); - Mem->Base = linear->offset * pVia->Bpp; + Mem->Base = linear->offset * Bpp; /* adjust for alignment */ if (alignment) { |