summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-10-11 15:46:30 +1000
committerBen Skeggs <bskeggs@redhat.com>2012-11-29 09:56:33 +1000
commitd7da62845be013171b5a3807214bc63874d89bb3 (patch)
treece5b4f05081f5a266f09eb8d6f66f542896ebbf3 /drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c
parent2f1cb96d656418815f8f83ce027f5d96095ba717 (diff)
drm/nv30/fb: enable z compression
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c')
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c
index 60d1fcb585fe..092f6f4f3521 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c
@@ -34,7 +34,17 @@ static void
nv35_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
struct nouveau_fb_tile *tile)
{
- tile->zcomp = 0x00000000;
+ u32 tiles = DIV_ROUND_UP(size, 0x40);
+ u32 tags = round_up(tiles / pfb->ram.parts, 0x40);
+ if (!nouveau_mm_head(&pfb->tags, 1, tags, tags, 1, &tile->tag)) {
+ if (flags & 2) tile->zcomp |= 0x04000000; /* Z16 */
+ else tile->zcomp |= 0x08000000; /* Z24S8 */
+ tile->zcomp |= ((tile->tag->offset ) >> 6);
+ tile->zcomp |= ((tile->tag->offset + tags - 1) >> 6) << 13;
+#ifdef __BIG_ENDIAN
+ tile->zcomp |= 0x40000000;
+#endif
+ }
}
static int