Add new flag, KAA_OFFSCREEN_ALIGN_POT, which tells KAA to align pixmap
pitches to a power-of-two number of bytes. Useful for Render acceleration on older cards.
This commit is contained in:
parent
2bea33e881
commit
74b2a76947
|
@ -95,6 +95,18 @@ kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
kaaLog2(int val)
|
||||||
|
{
|
||||||
|
int bits;
|
||||||
|
|
||||||
|
if (!val)
|
||||||
|
return 0;
|
||||||
|
for (bits = 0; val != 0; bits++)
|
||||||
|
val >>= 1;
|
||||||
|
return bits - 1;
|
||||||
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
kaaPixmapAllocArea (PixmapPtr pPixmap)
|
kaaPixmapAllocArea (PixmapPtr pPixmap)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +117,12 @@ kaaPixmapAllocArea (PixmapPtr pPixmap)
|
||||||
int bpp = pPixmap->drawable.bitsPerPixel;
|
int bpp = pPixmap->drawable.bitsPerPixel;
|
||||||
CARD16 h = pPixmap->drawable.height;
|
CARD16 h = pPixmap->drawable.height;
|
||||||
CARD16 w = pPixmap->drawable.width;
|
CARD16 w = pPixmap->drawable.width;
|
||||||
int pitch = KaaPixmapPitch (w * bpp / 8);
|
int pitch;
|
||||||
|
|
||||||
|
if (pKaaScr->info->flags & KAA_OFFSCREEN_ALIGN_POT && w != 1)
|
||||||
|
w = 1 << (kaaLog2(w - 1) + 1);
|
||||||
|
pitch = (w * bpp / 8 + pKaaScr->info->offscreenPitch - 1) &
|
||||||
|
~(pKaaScr->info->offscreenPitch - 1);
|
||||||
|
|
||||||
pKaaPixmap->devKind = pPixmap->devKind;
|
pKaaPixmap->devKind = pPixmap->devKind;
|
||||||
pKaaPixmap->devPrivate = pPixmap->devPrivate;
|
pKaaPixmap->devPrivate = pPixmap->devPrivate;
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr)(p)->devPrivates[kaaPixmapPrivateIndex].ptr)
|
#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr)(p)->devPrivates[kaaPixmapPrivateIndex].ptr)
|
||||||
#define KaaSetPixmapPriv(p,a) ((p)->devPrivates[kaaPixmapPrivateIndex].ptr = (pointer) (a))
|
#define KaaSetPixmapPriv(p,a) ((p)->devPrivates[kaaPixmapPrivateIndex].ptr = (pointer) (a))
|
||||||
#define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p)
|
#define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p)
|
||||||
#define KaaPixmapPitch(pitch) (((pitch) + (pKaaScr->info->offscreenPitch - 1)) & ~(pKaaScr->info->offscreenPitch - 1))
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
KaaScreenInfoPtr info;
|
KaaScreenInfoPtr info;
|
||||||
|
|
|
@ -372,7 +372,8 @@ typedef struct _KaaScreenInfo {
|
||||||
PixmapPtr pDst);
|
PixmapPtr pDst);
|
||||||
} KaaScreenInfoRec, *KaaScreenInfoPtr;
|
} KaaScreenInfoRec, *KaaScreenInfoPtr;
|
||||||
|
|
||||||
#define KAA_OFFSCREEN_PIXMAPS (1 << 0)
|
#define KAA_OFFSCREEN_PIXMAPS (1 << 0)
|
||||||
|
#define KAA_OFFSCREEN_ALIGN_POT (1 << 1)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the only completely portable way to
|
* This is the only completely portable way to
|
||||||
|
|
Loading…
Reference in New Issue