summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2011-02-06 20:22:01 +0000
committerMartin-Éric Racine <martin-eric.racine@iki.fi>2011-02-07 01:06:23 +0200
commit509f6085ce7747d76f638a7a30170c437b296a40 (patch)
tree0981d87cc5d800a6c07ffb04005bc389b8ac2244
parent66c375d2a1d1eadb38d2cbfe2d08cfec20213cb4 (diff)
Fix packed overlay offscreen allocations
Commit 5e72a00ad2 caused packed video data to corrupt glyphs and other parts of the screen, but it turns out that the commit actually at fault was d681a844e, incorrectly changing the size of the allocated destination memory from the number of bytes needed to the number of lines needed. While fixing this, I noticed that LXAllocateSurface is probably making the same mistake, and that the height is probably not calculated correctly for some corner cases when calling LXCopyFromSys in the packed video path (but I'm not sure about either). Fixes https://bugs.freedesktop.org/show_bug.cgi?id=33004
-rw-r--r--src/lx_video.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lx_video.c b/src/lx_video.c
index 7b51c5b..35e3ffa 100644
--- a/src/lx_video.c
+++ b/src/lx_video.c
@@ -302,7 +302,7 @@ LXCopyPacked(ScrnInfoPtr pScrni, int id, unsigned char *buf,
lines = ((dstPitch * height) + pGeode->Pitch - 1) / pGeode->Pitch;
- if (LXAllocateVidMem(pScrni, pPriv, lines) == FALSE) {
+ if (LXAllocateVidMem(pScrni, pPriv, dstPitch * height) == FALSE) {
ErrorF("Error allocating an offscreen Packed region.\n");
return FALSE;
}
@@ -334,6 +334,7 @@ LXCopyPacked(ScrnInfoPtr pScrni, int id, unsigned char *buf,
GeodeCopyGreyscale(buf + srcOffset, pGeode->FBBase + dstOffset,
srcPitch, dstPitch, height, pixels >> 1);
} else
+ /* FIXME: should lines be used here instead of height? */
LXCopyFromSys(pGeode, buf + srcOffset, dstOffset, dstPitch, srcPitch,
height, pixels);
@@ -818,6 +819,8 @@ LXAllocateSurface(ScrnInfoPtr pScrni, int id, unsigned short w,
pitch = ((w << 1) + 15) & ~15;
lines = ((pitch * h) + (pGeode->Pitch - 1)) / pGeode->Pitch;
+ /* FIXME: is lines the right parameter to use here,
+ * or should it be height * pitch? */
vidmem = exaOffscreenAlloc(pScrni->pScreen, lines, 4, TRUE,
NULL, NULL);