]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c
drm/nv30/fb: enable z compression
[karo-tx-linux.git] / drivers / gpu / drm / nouveau / core / subdev / fb / nv30.c
index b002902966801cc28d63233ab44f835c33ff169e..a7ba0d048aec041b90932ecc192cf299f780f1e1 100644 (file)
@@ -53,7 +53,17 @@ static void
 nv30_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 |= 0x01000000; /* Z16 */
+               else           tile->zcomp |= 0x02000000; /* Z24S8 */
+               tile->zcomp |= ((tile->tag->offset           ) >> 6);
+               tile->zcomp |= ((tile->tag->offset + tags - 1) >> 6) << 12;
+#ifdef __BIG_ENDIAN
+               tile->zcomp |= 0x10000000;
+#endif
+       }
 }
 
 static int