diff options
author | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2005-05-20 15:24:02 +0000 |
---|---|---|
committer | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2005-05-20 15:24:02 +0000 |
commit | 89ec4ac201c09329d5d732323bdce6250b8592fe (patch) | |
tree | 07fe847994c3ca21d927702c514ab558fd3edeff /src/i830_driver.c | |
parent | df0964ea8f92c6b278dd87b95380dbc3ada625e5 (diff) |
Bugzilla #3292: https://bugs.freedesktop.org/show_bug.cgi?id=3292XORG-6_8_99_8
Add shadowFB support to the Intel driver (Dima Dorfman)
Diffstat (limited to 'src/i830_driver.c')
-rw-r--r-- | src/i830_driver.c | 99 |
1 files changed, 94 insertions, 5 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c index 85d3d739..fc02e549 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -160,6 +160,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "vgaHW.h" #include "mipointer.h" #include "micmap.h" +#include "shadowfb.h" #include "fb.h" #include "miscstruct.h" @@ -223,7 +224,9 @@ typedef enum { OPTION_CLONE, OPTION_CLONE_REFRESH, OPTION_CHECKDEVICES, - OPTION_FIXEDPIPE + OPTION_FIXEDPIPE, + OPTION_SHADOW_FB, + OPTION_ROTATE } I830Opts; static OptionInfoRec I830BIOSOptions[] = { @@ -243,6 +246,8 @@ static OptionInfoRec I830BIOSOptions[] = { {OPTION_CLONE_REFRESH,"CloneRefresh",OPTV_INTEGER, {0}, FALSE}, {OPTION_CHECKDEVICES, "CheckDevices",OPTV_BOOLEAN, {0}, FALSE}, {OPTION_FIXEDPIPE, "FixedPipe", OPTV_ANYSTR, {0}, FALSE}, + {OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE} }; /* *INDENT-ON* */ @@ -2427,6 +2432,37 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) } } + xf86GetOptValBool(pI830->Options, OPTION_SHADOW_FB, &pI830->shadowFB); + if (pI830->shadowFB) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: shadow FB enabled\n"); + } + + if ((s = xf86GetOptValString(pI830->Options, OPTION_ROTATE))) { + if(!xf86NameCmp(s, "CW")) { + /* accel is disabled below for shadowFB */ + pI830->shadowFB = TRUE; + pI830->rotate = 1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen clockwise - acceleration disabled\n"); + } else if(!xf86NameCmp(s, "CCW")) { + pI830->shadowFB = TRUE; + pI830->rotate = -1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen" + "counter clockwise - acceleration disabled\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid" + "value for Option \"Rotate\"\n", s); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid options are \"CW\" or \"CCW\"\n"); + } + } + + if (pI830->shadowFB && !pI830->noAccel) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "HW acceleration not supported with \"shadowFB\".\n"); + pI830->noAccel = TRUE; + } + /* * Let's setup the mobile systems to check the lid status */ @@ -3269,6 +3305,15 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int flags) xf86SetOperatingState(resVgaIo, pI830->pEnt->index, ResUnusedOpr); xf86SetOperatingState(resVgaMem, pI830->pEnt->index, ResDisableOpr); + if (pI830->shadowFB) { + if (!xf86LoadSubModule(pScrn, "shadowfb")) { + I830BIOSFreeRec(pScrn); + vbeFree(pI830->pVbe); + return FALSE; + } + xf86LoaderReqSymLists(I810shadowFBSymbols, NULL); + } + VBEFreeVBEInfo(pI830->vbeInfo); pI830->vbeInfo = NULL; vbeFree(pI830->pVbe); @@ -4398,6 +4443,8 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) VisualPtr visual; I830EntPtr pI830Ent = NULL; I830Ptr pI8301 = NULL; + int width, height, displayWidth; + unsigned char *fbbase; #ifdef XF86DRI Bool driDisabled; #endif @@ -4632,10 +4679,26 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) return FALSE; DPRINTF(PFX, "assert( if(!fbScreenInit(pScreen, ...) )\n"); - if (!fbScreenInit(pScreen, pI830->FbBase + pScrn->fbOffset, - pScrn->virtualX, pScrn->virtualY, + if (pI830->rotate) { + height = pScrn->virtualX; + width = pScrn->virtualY; + } else { + width = pScrn->virtualX; + height = pScrn->virtualY; + } + if (pI830->shadowFB) { + pI830->shadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width); + pI830->shadowPtr = xalloc(pI830->shadowPitch * height); + displayWidth = pI830->shadowPitch / (pScrn->bitsPerPixel >> 3); + fbbase = pI830->shadowPtr; + } else { + pI830->shadowPtr = NULL; + fbbase = pI830->FbBase; + displayWidth = pScrn->displayWidth; + } + if (!fbScreenInit(pScreen, fbbase + pScrn->fbOffset, width, height, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth, pScrn->bitsPerPixel)) + displayWidth, pScrn->bitsPerPixel)) return FALSE; if (pScrn->bitsPerPixel > 8) { @@ -4657,7 +4720,8 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86SetBlackWhitePixels(pScreen); - I830DGAInit(pScreen); + if (!pI830->shadowFB) + I830DGAInit(pScreen); DPRINTF(PFX, "assert( if(!xf86InitFBManager(pScreen, &(pI830->FbMemBox))) )\n"); @@ -4695,6 +4759,31 @@ I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } else xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing SW Cursor!\n"); + if (pI830->shadowFB) { + RefreshAreaFuncPtr refreshArea = I830RefreshArea; + if (pI830->rotate) { + if (!pI830->PointerMoved) { + pI830->PointerMoved = pScrn->PointerMoved; + pScrn->PointerMoved = I830PointerMoved; + } + switch (pScrn->bitsPerPixel) { + case 8: + refreshArea = I830RefreshArea8; + break; + case 16: + refreshArea = I830RefreshArea16; + break; + case 24: + refreshArea = I830RefreshArea24; + break; + case 32: + refreshArea = I830RefreshArea32; + break; + } + } + ShadowFBInit(pScreen, refreshArea); + } + DPRINTF(PFX, "assert( if(!miCreateDefColormap(pScreen)) )\n"); if (!miCreateDefColormap(pScreen)) return FALSE; |