diff options
author | Michel Dänzer <michel@tungstengraphics.com> | 2007-03-05 11:53:09 +0100 |
---|---|---|
committer | Michel Dänzer <michel@tungstengraphics.com> | 2007-03-05 12:06:51 +0100 |
commit | 7358642e64ab6d13bc1dc1a44703ee66d715ff61 (patch) | |
tree | 5d70bbeabf3b72c20171acb376a26c5fb56ab403 /src/i830_driver.c | |
parent | 015027034e970f1e3bb6ab239f7e0119235e404f (diff) |
Fix handling of new vs. old texture pools.
Only one of them can be active.
Diffstat (limited to 'src/i830_driver.c')
-rw-r--r-- | src/i830_driver.c | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c index ac4e38c1..373c6360 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 } I830Opts; static OptionInfoRec I830Options[] = { @@ -290,8 +292,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 {-1, NULL, OPTV_NONE, {0}, FALSE} }; /* *INDENT-ON* */ @@ -1230,30 +1234,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, @@ -1266,6 +1278,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) pI830->mmSize); } } +#endif #endif @@ -2129,8 +2142,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); @@ -2257,7 +2272,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) { @@ -2307,18 +2324,24 @@ 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; pI830->allowPageFlip = FALSE; } +#ifdef XF86DRI_MM if (i & 1) { /* For this allocation, switch to a smaller DRI memory manager * size. @@ -2333,6 +2356,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)) @@ -2351,10 +2379,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 |