EXA: Update sys_pitch/fb_pitch in exaModifyPixmapHeader.
exaModifyPixmapHeader now also only evaluates arguments that have a meaningful value.
This commit is contained in:
parent
4fa89fbe18
commit
26c1801a27
43
exa/exa.c
43
exa/exa.c
|
@ -248,6 +248,19 @@ exaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
|
||||||
pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT;
|
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.
|
* exaCreatePixmap() creates a new pixmap.
|
||||||
*
|
*
|
||||||
|
@ -292,12 +305,8 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
|
||||||
if (paddedWidth / 4 > 32767 || h > 32767)
|
if (paddedWidth / 4 > 32767 || h > 32767)
|
||||||
return NullPixmap;
|
return NullPixmap;
|
||||||
|
|
||||||
if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
|
exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
|
||||||
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);
|
|
||||||
if (paddedWidth < pExaPixmap->fb_pitch)
|
if (paddedWidth < pExaPixmap->fb_pitch)
|
||||||
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->offscreen = FALSE;
|
||||||
|
|
||||||
pExaPixmap->fb_ptr = NULL;
|
pExaPixmap->fb_ptr = NULL;
|
||||||
if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
|
exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
|
||||||
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);
|
|
||||||
pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
|
pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
|
||||||
|
|
||||||
if (pExaPixmap->fb_pitch > 131071) {
|
if (pExaPixmap->fb_pitch > 131071) {
|
||||||
|
@ -384,10 +388,19 @@ exaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
|
||||||
pExaPixmap = ExaGetPixmapPriv(pPixmap);
|
pExaPixmap = ExaGetPixmapPriv(pPixmap);
|
||||||
|
|
||||||
if (pExaPixmap) {
|
if (pExaPixmap) {
|
||||||
pExaPixmap->sys_ptr = pPixData;
|
if (pPixData)
|
||||||
|
pExaPixmap->sys_ptr = pPixData;
|
||||||
|
|
||||||
exaSetAccelBlock(pExaScr, pExaPixmap,
|
if (devKind > 0)
|
||||||
width, height, bitsPerPixel);
|
pExaPixmap->sys_pitch = devKind;
|
||||||
|
|
||||||
|
if (width > 0 && height > 0 && bitsPerPixel > 0) {
|
||||||
|
exaSetFbPitch(pExaScr, pExaPixmap,
|
||||||
|
width, height, bitsPerPixel);
|
||||||
|
|
||||||
|
exaSetAccelBlock(pExaScr, pExaPixmap,
|
||||||
|
width, height, bitsPerPixel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue