diff options
author | Adam Jackson <ajax@redhat.com> | 2009-12-30 11:23:16 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2009-12-30 11:23:16 -0500 |
commit | 3c73bfc96817348449e5ab6a7f7b03ac6c85bd47 (patch) | |
tree | 0c50327af5f08f779fb9502e7d7aed329562c8c7 | |
parent | 2c8da9b4e703678b0f0f16edb1c48a523c8442fd (diff) | |
download | xorg-driver-xf86-video-vesa-3c73bfc96817348449e5ab6a7f7b03ac6c85bd47.tar.gz |
Code motion
Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | src/vesa.c | 63 |
1 files changed, 29 insertions, 34 deletions
@@ -105,10 +105,35 @@ static void RestoreFonts(ScrnInfoPtr pScrn); static Bool VESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function); -static void *VESAWindowLinear(ScreenPtr pScrn, CARD32 row, CARD32 offset, - int mode, CARD32 *size, void *closure); -static void *VESAWindowWindowed(ScreenPtr pScrn, CARD32 row, CARD32 offset, - int mode, CARD32 *size, void *closure); +static void * +VESAWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, + CARD32 *size, void *closure) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + VESAPtr pVesa = VESAGetRec(pScrn); + + *size = pVesa->maxBytesPerScanline; + return ((CARD8 *)pVesa->base + row * pVesa->maxBytesPerScanline + offset); +} + +static void * +VESAWindowWindowed(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, + CARD32 *size, void *closure) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + VESAPtr pVesa = VESAGetRec(pScrn); + VbeModeInfoBlock *data = ((VbeModeInfoData*)(pScrn->currentMode->Private))->data; + int window; + + offset += pVesa->maxBytesPerScanline * row; + window = offset / (data->WinGranularity * 1024); + pVesa->windowAoffset = window * data->WinGranularity * 1024; + VESABankSwitch(pScreen, window); + *size = data->WinSize * 1024 - (offset - pVesa->windowAoffset); + + return (void *)((unsigned long)pVesa->base + + (offset - pVesa->windowAoffset)); +} static Bool VESADGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen); @@ -1286,36 +1311,6 @@ VESAUnmapVidMem(ScrnInfoPtr pScrn) pVesa->base = NULL; } -static void * -VESAWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size, void *closure) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - VESAPtr pVesa = VESAGetRec(pScrn); - - *size = pVesa->maxBytesPerScanline; - return ((CARD8 *)pVesa->base + row * pVesa->maxBytesPerScanline + offset); -} - -static void * -VESAWindowWindowed(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size, void *closure) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - VESAPtr pVesa = VESAGetRec(pScrn); - VbeModeInfoBlock *data = ((VbeModeInfoData*)(pScrn->currentMode->Private))->data; - int window; - - offset += pVesa->maxBytesPerScanline * row; - window = offset / (data->WinGranularity * 1024); - pVesa->windowAoffset = window * data->WinGranularity * 1024; - VESABankSwitch(pScreen, window); - *size = data->WinSize * 1024 - (offset - pVesa->windowAoffset); - - return (void *)((unsigned long)pVesa->base + - (offset - pVesa->windowAoffset)); -} - /* This code works, but is very slow for programs that use it intensively */ static void VESALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, |