summaryrefslogtreecommitdiff
path: root/src/i830_memory.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-01-11 10:36:33 -0800
committerEric Anholt <eric@anholt.net>2007-01-11 11:03:13 -0800
commitf5d528f8ea27de31054e7f1843e34d8379f811ea (patch)
tree08473ddc682e2d38381d1f2efab0e34e2ae3e80d /src/i830_memory.c
parentd13bc016c0723f1df633ddaf5610ad73003b7c96 (diff)
Don't limit cachelines to a vertical of 2048, and increase default allocation.
The cachelines are used for two things: XAA pixmap cache and XV memory. Only XAA pixmap cache is referred to using an offset pointing at the beginning of the front buffer in rendering, and XAA only uses the 2d BLT engine, which actually has a vertical limit of 65536. So, pixmap cache is now limited to that much vertical. Additionally, the previous cachelines allocation was too small for our advertised XV limits, so video at the limits would fail with BadAlloc. Now, XAA allocates the same approximate amount of offscreen memory as EXA: 3 times the screen size, plus one packed HD video.
Diffstat (limited to 'src/i830_memory.c')
-rw-r--r--src/i830_memory.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/i830_memory.c b/src/i830_memory.c
index af866889..426242a9 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -637,6 +637,13 @@ GetFreeSpace(ScrnInfoPtr pScrn)
return extra;
}
+/* This is the 2D rendering vertical coordinate limit. We can ignore
+ * the 3D rendering limits in our 2d pixmap cache allocation, because XAA
+ * doesn't do any 3D rendering to/from the cache lines when using an offset
+ * at the start of framebuffer.
+ */
+#define MAX_2D_HEIGHT 65536
+
/**
* Allocates a framebuffer for a screen.
*
@@ -698,25 +705,19 @@ I830AllocateFramebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
"maxCacheLines < 0 in I830Allocate2DMemory()\n");
maxCacheLines = 0;
}
- if (maxCacheLines > (MAX_DISPLAY_HEIGHT - pScrn->virtualY))
- maxCacheLines = MAX_DISPLAY_HEIGHT - pScrn->virtualY;
+ if (maxCacheLines > (MAX_2D_HEIGHT - pScrn->virtualY))
+ maxCacheLines = MAX_2D_HEIGHT - pScrn->virtualY;
if (pI830->CacheLines >= 0) {
cacheLines = pI830->CacheLines;
} else {
-#if 1
- /* Make sure there is enough for two DVD sized YUV buffers */
- cacheLines = (pScrn->depth == 24) ? 256 : 384;
- if (pScrn->displayWidth <= 1024)
- cacheLines *= 2;
-#else
- /*
- * Make sure there is enough for two DVD sized YUV buffers.
- * Make that 1.5MB, which is around what was allocated with
- * the old algorithm
- */
- cacheLines = (MB(1) + KB(512)) / pI830->cpp / pScrn->displayWidth;
-#endif
+ int size;
+
+ size = 3 * lineSize * pScrn->virtualY;
+ size += 1920 * 1088 * 2 * 2;
+ size = ROUND_TO_PAGE(size);
+
+ cacheLines = (size + lineSize - 1) / lineSize;
}
if (cacheLines > maxCacheLines)
cacheLines = maxCacheLines;
@@ -902,8 +903,8 @@ I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags)
maxFb = pI830->FrontBuffer.Size + extra;
lineSize = pScrn->displayWidth * pI830->cpp;
maxFb = ROUND_DOWN_TO(maxFb, lineSize);
- if (maxFb > lineSize * MAX_DISPLAY_HEIGHT)
- maxFb = lineSize * MAX_DISPLAY_HEIGHT;
+ if (maxFb > lineSize * MAX_2D_HEIGHT)
+ maxFb = lineSize * MAX_2D_HEIGHT;
if (0/*maxFb > pI830->FrontBuffer.Size*/) {
unsigned long oldsize;
/*