diff options
-rw-r--r-- | src/sis6326_video.c | 2 | ||||
-rw-r--r-- | src/sis_video.c | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/sis6326_video.c b/src/sis6326_video.c index 8a3927c..245d291 100644 --- a/src/sis6326_video.c +++ b/src/sis6326_video.c @@ -1559,7 +1559,7 @@ SIS6326AllocSurface ( w = (w + 1) & ~1; pPriv->pitch = ((w << 1) + 63) & ~63; /* Only packed pixel modes supported */ size = h * pPriv->pitch; - pPriv->linear = SIS6326AllocateOverlayMemory(pScrn, pPriv->linear, size); + pPriv->linear = SIS6326AllocateOverlayMemory(pScrn, pPriv->linear, ((size + depth - 1) / depth)); if(!pPriv->linear) return BadAlloc; diff --git a/src/sis_video.c b/src/sis_video.c index 0acfe5f..d3b8dff 100644 --- a/src/sis_video.c +++ b/src/sis_video.c @@ -4302,8 +4302,9 @@ SISAllocSurface ( depth = pSiS->CurrentLayout.bitsPerPixel >> 3; w = (w + 1) & ~1; pPriv->pitch = ((w << 1) + 63) & ~63; /* Only packed pixel modes supported */ - size = h * pPriv->pitch; /* / depth; - Why? */ - pPriv->linear = SISAllocateOverlayMemory(pScrn, pPriv->linear, size); + size = h * pPriv->pitch; + pPriv->linear = SISAllocateOverlayMemory(pScrn, pPriv->linear, ((size + depth - 1) / depth)); + if(!pPriv->linear) return BadAlloc; @@ -4771,7 +4772,8 @@ SISPutImageBlit( } /* allocate memory (we do doublebuffering) */ - if(!(pPriv->linear[index] = SISAllocateOverlayMemory(pScrn, pPriv->linear[index], totalSize<<1))) + if(!(pPriv->linear[index] = SISAllocateOverlayMemory(pScrn, pPriv->linear[index], + ((totalSize + depth - 1) / depth) << 1))) return BadAlloc; /* fixup pointers */ |