diff options
author | Dave Airlie <airlied@redhat.com> | 2009-08-11 15:00:36 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-08-14 09:33:48 +1000 |
commit | 1545a120df6dffb5b84fe96c5a992357520b7c8d (patch) | |
tree | 2dacc81459efd5b9eb1f0f663b7458aeb0e47814 /exa/exa_driver.c | |
parent | db568f9eabf3450d8a023597ff007df355b13ea8 (diff) |
exa: fix CreatePixmap2 to be useful for tiling.
This adds a pitch return so that the driver can align the pitch to any
value it wishes and not just the one it gave to EXA at startup.
Diffstat (limited to 'exa/exa_driver.c')
-rw-r--r-- | exa/exa_driver.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/exa/exa_driver.c b/exa/exa_driver.c index b4ca42638..97036955b 100644 --- a/exa/exa_driver.c +++ b/exa/exa_driver.c @@ -71,26 +71,29 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth, bpp = pPixmap->drawable.bitsPerPixel; - paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits); - if (paddedWidth / 4 > 32767 || h > 32767) - return NullPixmap; - - exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp); - - if (paddedWidth < pExaPixmap->fb_pitch) - paddedWidth = pExaPixmap->fb_pitch; - - datasize = h * paddedWidth; - /* Set this before driver hooks, to allow for !offscreen pixmaps. * !offscreen pixmaps have a valid pointer at all times. */ pPixmap->devPrivate.ptr = NULL; - if (pExaScr->info->CreatePixmap2) - pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, usage_hint, bpp); - else + if (pExaScr->info->CreatePixmap2) { + int new_pitch = 0; + pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, usage_hint, bpp, &new_pitch); + paddedWidth = pExaPixmap->fb_pitch = new_pitch; + } + else { + paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits); + if (paddedWidth / 4 > 32767 || h > 32767) + return NullPixmap; + + exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp); + + if (paddedWidth < pExaPixmap->fb_pitch) + paddedWidth = pExaPixmap->fb_pitch; + datasize = h * paddedWidth; pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, datasize, 0); + } + if (!pExaPixmap->driverPriv) { swap(pExaScr, pScreen, DestroyPixmap); pScreen->DestroyPixmap (pPixmap); |