diff options
author | Tilman Sauerbeck <tilman@code-monkey.de> | 2008-04-21 11:03:27 +0200 |
---|---|---|
committer | Tilman Sauerbeck <tilman@code-monkey.de> | 2008-04-21 23:07:39 +0200 |
commit | 26c1801a27b81fdd988d5bd210ba0e76ecc274ae (patch) | |
tree | 92cf7b8b57bd4a8b08690819990462fc3cf45455 | |
parent | 4fa89fbe18c929e0d36305ab47e7e17841309ffd (diff) |
EXA: Update sys_pitch/fb_pitch in exaModifyPixmapHeader.
exaModifyPixmapHeader now also only evaluates arguments that have a
meaningful value.
-rw-r--r-- | exa/exa.c | 43 |
1 files changed, 28 insertions, 15 deletions
@@ -248,6 +248,19 @@ exaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap, pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT; } +static void +exaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap, + int w, int h, int bpp) +{ + if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1) + pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8; + else + pExaPixmap->fb_pitch = w * bpp / 8; + + pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch, + pExaScr->info->pixmapPitchAlign); +} + /** * exaCreatePixmap() creates a new pixmap. * @@ -292,12 +305,8 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, if (paddedWidth / 4 > 32767 || h > 32767) return NullPixmap; - if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1) - pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8; - else - pExaPixmap->fb_pitch = w * bpp / 8; - pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch, - pExaScr->info->pixmapPitchAlign); + exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp); + if (paddedWidth < pExaPixmap->fb_pitch) paddedWidth = pExaPixmap->fb_pitch; @@ -331,12 +340,7 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, pExaPixmap->offscreen = FALSE; pExaPixmap->fb_ptr = NULL; - if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1) - pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8; - else - pExaPixmap->fb_pitch = w * bpp / 8; - pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch, - pExaScr->info->pixmapPitchAlign); + exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp); pExaPixmap->fb_size = pExaPixmap->fb_pitch * h; if (pExaPixmap->fb_pitch > 131071) { @@ -384,10 +388,19 @@ exaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, pExaPixmap = ExaGetPixmapPriv(pPixmap); if (pExaPixmap) { - pExaPixmap->sys_ptr = pPixData; + if (pPixData) + pExaPixmap->sys_ptr = pPixData; - exaSetAccelBlock(pExaScr, pExaPixmap, - width, height, bitsPerPixel); + if (devKind > 0) + pExaPixmap->sys_pitch = devKind; + + if (width > 0 && height > 0 && bitsPerPixel > 0) { + exaSetFbPitch(pExaScr, pExaPixmap, + width, height, bitsPerPixel); + + exaSetAccelBlock(pExaScr, pExaPixmap, + width, height, bitsPerPixel); + } } |