From 5d3d20d908a50ad7742567d58969c7f12dd944f7 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 9 Dec 2010 01:36:32 +0100 Subject: nvc0: change tile_mode to contain 0xZYX instead of 0xZY Warning: the kernel will not like that (EVO) --- src/nouveau_local.h | 3 +++ src/nouveau_wfb.c | 2 +- src/nv_accel_common.c | 13 +++++++------ src/nvc0_exa.c | 10 +++++----- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/nouveau_local.h b/src/nouveau_local.h index 38b861f..98b33dc 100644 --- a/src/nouveau_local.h +++ b/src/nouveau_local.h @@ -43,6 +43,9 @@ #define NOUVEAU_ALIGN(x,bytes) (((x) + ((bytes) - 1)) & ~((bytes) - 1)) +#define NVC0_TILE_PITCH(m) (64 << ((m) & 0xf)) +#define NVC0_TILE_HEIGHT(m) (8 << ((m) >> 4)) + static inline int log2i(int i) { int r = 0; diff --git a/src/nouveau_wfb.c b/src/nouveau_wfb.c index feab54a..47a0a93 100644 --- a/src/nouveau_wfb.c +++ b/src/nouveau_wfb.c @@ -182,7 +182,7 @@ nouveau_wfb_setup_wrap(ReadMemoryProcPtr *pRead, WriteMemoryProcPtr *pWrite, have_tiled = 1; if (1 /* NV_ARCH_C0, FIXME */) - wfb->tile_height += 1; + wfb->tile_height = (bo->tile_mode >> 4) + 3; } out: diff --git a/src/nv_accel_common.c b/src/nv_accel_common.c index ea11cc6..4c2ad97 100644 --- a/src/nv_accel_common.c +++ b/src/nv_accel_common.c @@ -42,22 +42,23 @@ nouveau_allocate_surface(ScrnInfoPtr scrn, int width, int height, int bpp, if (tiled) { if (pNv->Architecture >= NV_ARCH_C0) { if (height > 64) - tile_mode = 4; + tile_mode = 0x40; else if (height > 32) - tile_mode = 3; + tile_mode = 0x30; else if (height > 16) - tile_mode = 2; + tile_mode = 0x20; else if (height > 8) - tile_mode = 1; + tile_mode = 0x10; else - tile_mode = 0; + tile_mode = 0x00; if (usage_hint & NOUVEAU_CREATE_PIXMAP_ZETA) tile_flags = 0x1100; /* S8Z24 */ else tile_flags = 0xfe00; - height = NOUVEAU_ALIGN(height, 1 << (tile_mode + 3)); + height = NOUVEAU_ALIGN( + height, NVC0_TILE_HEIGHT(tile_mode)); } else if (pNv->Architecture >= NV_ARCH_50) { if (height > 32) tile_mode = 4; diff --git a/src/nvc0_exa.c b/src/nvc0_exa.c index 5890195..4f4e104 100644 --- a/src/nvc0_exa.c +++ b/src/nvc0_exa.c @@ -47,7 +47,7 @@ NVC0AccelDownloadM2MF(PixmapPtr pspix, int x, int y, int w, int h, src_offset = (y * src_pitch) + (x * cpp); } else { BEGIN_RING(chan, NvSubM2MF, NVC0_M2MF_TILING_MODE_IN, 5); - OUT_RING (chan, bo->tile_mode << 4); + OUT_RING (chan, bo->tile_mode); OUT_RING (chan, pspix->drawable.width * cpp); OUT_RING (chan, pspix->drawable.height); OUT_RING (chan, 1); @@ -132,7 +132,7 @@ NVC0AccelUploadM2MF(PixmapPtr pdpix, int x, int y, int w, int h, dst_offset = (y * dst_pitch) + (x * cpp); } else { BEGIN_RING(chan, NvSubM2MF, NVC0_M2MF_TILING_MODE_OUT, 5); - OUT_RING (chan, bo->tile_mode << 4); + OUT_RING (chan, bo->tile_mode); OUT_RING (chan, pdpix->drawable.width * cpp); OUT_RING (chan, pdpix->drawable.height); OUT_RING (chan, 1); @@ -301,7 +301,7 @@ NVC0EXAAcquireSurface2D(PixmapPtr ppix, int is_src) BEGIN_RING(chan, NvSub2D, mthd, 5); OUT_RING (chan, fmt); OUT_RING (chan, 0); - OUT_RING (chan, bo->tile_mode << 4); + OUT_RING (chan, bo->tile_mode); OUT_RING (chan, 1); OUT_RING (chan, 0); } @@ -672,7 +672,7 @@ NVC0EXARenderTarget(PixmapPtr ppix, PicturePtr ppict) OUT_RING (chan, ppix->drawable.width); OUT_RING (chan, ppix->drawable.height); OUT_RING (chan, format); - OUT_RING (chan, bo->tile_mode << 4); + OUT_RING (chan, bo->tile_mode); OUT_RING (chan, 0x00000001); OUT_RING (chan, 0x00000000); @@ -846,7 +846,7 @@ NVC0EXATexture(PixmapPtr ppix, PicturePtr ppict, unsigned unit) } #undef _ - mode = 0xd0005000 | (bo->tile_mode << 22); + mode = 0xd0005000 | (bo->tile_mode << (22 - 4)); if (OUT_RELOCl(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD) || OUT_RELOCd(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH | NOUVEAU_BO_OR, mode, mode)) -- cgit v1.2.1