diff options
author | Francisco Jerez <currojerez@riseup.net> | 2010-10-10 04:36:17 +0200 |
---|---|---|
committer | Francisco Jerez <currojerez@riseup.net> | 2010-10-10 04:51:34 +0200 |
commit | 8c8f15c9d3a31c35bf2ef20faf8c4133295a678f (patch) | |
tree | 814d0340a4e84dff92a8333ab85d69003ccf18fe | |
parent | a47c274f329b3b8bfbdcf155d6d832599d823dc8 (diff) | |
download | xorg-driver-xf86-video-nouveau-8c8f15c9d3a31c35bf2ef20faf8c4133295a678f.tar.gz |
nv10-nv40/exa: Fix tiled pixmap pitch alignment calculation.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
-rw-r--r-- | src/nouveau_exa.c | 5 | ||||
-rw-r--r-- | src/nouveau_local.h | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/nouveau_exa.c b/src/nouveau_exa.c index f2995be..92dc946 100644 --- a/src/nouveau_exa.c +++ b/src/nouveau_exa.c @@ -347,8 +347,9 @@ nouveau_exa_create_pixmap(ScreenPtr pScreen, int width, int height, int depth, height = NOUVEAU_ALIGN(height, 1 << (tile_mode + 2)); } else { if (usage_hint & NOUVEAU_CREATE_PIXMAP_TILED) { - int pitch_align = - pNv->dev->chipset >= 0x40 ? 1024 : 256; + int pitch_align = max( + pNv->dev->chipset >= 0x40 ? 1024 : 256, + round_down_pow2(*new_pitch / 4)); *new_pitch = NOUVEAU_ALIGN(*new_pitch, pitch_align); diff --git a/src/nouveau_local.h b/src/nouveau_local.h index a950db4..5d3200a 100644 --- a/src/nouveau_local.h +++ b/src/nouveau_local.h @@ -69,4 +69,9 @@ static inline int log2i(int i) return r; } +static inline int round_down_pow2(int x) +{ + return 1 << log2i(x); +} + #endif |