diff options
author | Michel Dänzer <michel@tungstengraphics.com> | 2007-03-06 09:28:52 +0100 |
---|---|---|
committer | Michel Dänzer <michel@tungstengraphics.com> | 2007-03-06 09:28:52 +0100 |
commit | 6c299aea8e87e72c68c96c03594706c976601ede (patch) | |
tree | 9fc7d6b2a1acc764ad35e2d24e91434aeeba9300 /src/i830_driver.c | |
parent | 330815251dee808754b328cd2fd60db39f2460eb (diff) | |
parent | 4042b27f01fdb94e7fc0d4e991e054fff88479ea (diff) |
Merge remote branch 'origin/master' into i830-pageflip
Conflicts:
src/i830_display.c
src/i830_driver.c
Diffstat (limited to 'src/i830_driver.c')
-rw-r--r-- | src/i830_driver.c | 97 |
1 files changed, 50 insertions, 47 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c index 8379b6b4..0de4d0df 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -272,8 +272,10 @@ typedef enum { OPTION_COLOR_KEY, OPTION_CHECKDEVICES, OPTION_LINEARALLOC, +#ifdef XF86DRI_MM OPTION_INTELTEXPOOL, OPTION_INTELMMSIZE, +#endif OPTION_TRIPLEBUFFER, } I830Opts; @@ -291,8 +293,10 @@ static OptionInfoRec I830Options[] = { {OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE}, {OPTION_CHECKDEVICES, "CheckDevices",OPTV_BOOLEAN, {0}, FALSE}, {OPTION_LINEARALLOC, "LinearAlloc", OPTV_INTEGER, {0}, FALSE}, +#ifdef XF86DRI_MM {OPTION_INTELTEXPOOL,"Legacy3D", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_INTELMMSIZE, "AperTexSize", OPTV_INTEGER, {0}, FALSE}, +#endif {OPTION_TRIPLEBUFFER, "TripleBuffer", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE} }; @@ -1231,30 +1235,38 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) pI830->mmModeFlags = 0; if (!pI830->directRenderingDisabled) { +#ifdef XF86DRI_MM Bool tmp = FALSE; - pI830->mmModeFlags |= I830_KERNEL_TEX; -#ifdef XF86DRI_MM if (!IS_I965G(pI830)) pI830->mmModeFlags |= I830_KERNEL_MM; + else #endif + pI830->mmModeFlags |= I830_KERNEL_TEX; from = X_PROBED; + +#ifdef XF86DRI_MM if (xf86GetOptValBool(pI830->Options, OPTION_INTELTEXPOOL, &tmp)) { from = X_CONFIG; if (tmp) { pI830->mmModeFlags |= I830_KERNEL_TEX; + pI830->mmModeFlags &= ~I830_KERNEL_MM; } else { pI830->mmModeFlags &= ~I830_KERNEL_TEX; + pI830->mmModeFlags |= I830_KERNEL_MM; } } +#endif + xf86DrvMsg(pScrn->scrnIndex, from, "Will %stry to allocate texture pool " "for old Mesa 3D driver.\n", (pI830->mmModeFlags & I830_KERNEL_TEX) ? "" : "not "); +#ifdef XF86DRI_MM pI830->mmSize = I830_MM_MAXSIZE; from = X_INFO; if (xf86GetOptValInteger(pI830->Options, OPTION_INTELMMSIZE, @@ -1267,6 +1279,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) pI830->mmSize); } } +#endif #endif @@ -2140,8 +2153,10 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) MessageType from; #ifdef XF86DRI Bool driDisabled; +#ifdef XF86DRI_MM unsigned long savedMMSize; #endif +#endif pScrn = xf86Screens[pScreen->myNum]; pI830 = I830PTR(pScrn); @@ -2268,7 +2283,9 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!I830CheckDRIAvailable(pScrn)) { pI830->directRenderingDisabled = TRUE; +#ifdef XF86DRI_MM pI830->mmSize = 0; +#endif } if (!pI830->directRenderingDisabled) { @@ -2318,12 +2335,17 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) */ pI830->disableTiling = FALSE; +#ifdef XF86DRI_MM savedMMSize = pI830->mmSize; - for (i = 0; i < 4; i++) { +#define MM_TURNS 4 +#else +#define MM_TURNS 2 +#endif + for (i = 0; i < MM_TURNS; i++) { if (!tiled && i < 2) continue; - if (i >= 2) { + if (i >= MM_TURNS/2) { /* For further allocations, disable tiling */ pI830->disableTiling = TRUE; pScrn->displayWidth = savedDisplayWidth; @@ -2334,6 +2356,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pI830->allowPageFlip = FALSE; } +#ifdef XF86DRI_MM if (i & 1) { /* For this allocation, switch to a smaller DRI memory manager * size. @@ -2348,6 +2371,11 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) "\t %s DRI memory manager reservation:\n", (i & 2) ? "untiled" : "tiled", (i & 1) ? "small" : "large"); +#else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Attempting memory allocation with %s buffers:\n", + (i & 1) ? "untiled" : "tiled"); +#endif if (i830_allocate_2d_memory(pScrn) && i830_allocate_3d_memory(pScrn)) @@ -2366,10 +2394,12 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) i830_reset_allocations(pScrn); } - if (i == 4) { + if (i == MM_TURNS) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Not enough video memory. Disabling DRI.\n"); +#ifdef XF86DRI_MM pI830->mmSize = 0; +#endif pI830->directRenderingDisabled = TRUE; } } else @@ -2752,13 +2782,17 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) I830DRICloseScreen(pScreen); pI830->directRenderingEnabled = FALSE; } else { + unsigned long aperEnd = ROUND_DOWN_TO(pI830->memory_manager->offset + + pI830->memory_manager->size, + GTT_PAGE_SIZE) / GTT_PAGE_SIZE; + unsigned long aperStart = ROUND_TO(pI830->memory_manager->offset, + GTT_PAGE_SIZE) / GTT_PAGE_SIZE; + #ifndef XSERVER_LIBDRM_MM - if (I830DrmMMInit(pI830->drmSubFD, pI830->memory_manager->offset, - pI830->memory_manager->size, + if (I830DrmMMInit(pI830->drmSubFD, aperStart, aperEnd - aperStart, DRM_BO_MEM_TT)) { #else - if (drmMMInit(pI830->drmSubFD, pI830->memory_manager->offset, - pI830->memory_manager->size, + if (drmMMInit(pI830->drmSubFD, aperStart, aperEnd - aperStart, DRM_BO_MEM_TT)) { #endif xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -2869,9 +2903,7 @@ static Bool I830EnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); I830Ptr pI830 = I830PTR(pScrn); - int i; DPRINTF(PFX, "Enter VT\n"); @@ -2886,12 +2918,6 @@ I830EnterVT(int scrnIndex, int flags) pI830->leaving = FALSE; -#if 1 - /* Clear the framebuffer */ - memset(pI830->FbBase + pScrn->fbOffset, 0, - pScrn->virtualY * pScrn->displayWidth * pI830->cpp); -#endif - if (I830IsPrimary(pScrn)) if (!i830_bind_all_memory(pScrn)) return FALSE; @@ -2904,27 +2930,13 @@ I830EnterVT(int scrnIndex, int flags) ResetState(pScrn, FALSE); SetHWOperatingState(pScrn); - for (i = 0; i < xf86_config->num_crtc; i++) - { - xf86CrtcPtr crtc = xf86_config->crtc[i]; - - /* Mark that we'll need to re-set the mode for sure */ - memset(&crtc->mode, 0, sizeof(crtc->mode)); - if (!crtc->desiredMode.CrtcHDisplay) - { - crtc->desiredMode = *i830PipeFindClosestMode (crtc, pScrn->currentMode); - crtc->desiredRotation = RR_Rotate_0; - crtc->desiredX = 0; - crtc->desiredY = 0; - } - - if (!xf86CrtcSetMode (crtc, &crtc->desiredMode, crtc->desiredRotation, - crtc->desiredX, crtc->desiredY)) - return FALSE; - } - - xf86DisableUnusedFunctions(pScrn); + /* Clear the framebuffer */ + memset(pI830->FbBase + pScrn->fbOffset, 0, + pScrn->virtualY * pScrn->displayWidth * pI830->cpp); + if (!xf86SetDesiredModes (pScrn)) + return FALSE; + i830DumpRegs (pScrn); i830DescribeOutputConfiguration(pScrn); @@ -2983,8 +2995,6 @@ I830EnterVT(int scrnIndex, int flags) if (pI830->checkDevices) pI830->devicesTimer = TimerSet(NULL, 0, 1000, I830CheckDevicesTimer, pScrn); - pI830->currentMode = pScrn->currentMode; - /* Force invarient 3D state to be emitted */ *pI830->used3D = 1<<31; @@ -2994,17 +3004,10 @@ I830EnterVT(int scrnIndex, int flags) static Bool I830SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; I830Ptr pI830 = I830PTR(pScrn); - Bool ret = TRUE; - DPRINTF(PFX, "I830SwitchMode: mode == %p\n", mode); - - if (!i830SetMode(pScrn, mode, pI830->rotation)) - pI830->currentMode = mode; - - return ret; + return xf86SetSingleMode (pScrn, mode, pI830->rotation); } static Bool |