drm/nv30-nv40/fb: make use of bankoff for zeta buffers, where supported
authorBen Skeggs <bskeggs@redhat.com>
Wed, 10 Oct 2012 00:41:04 +0000 (10:41 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 28 Nov 2012 23:56:28 +0000 (09:56 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/include/subdev/fb.h
drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c
drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c
drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c
drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c

index 526672555b5307766bb9118c5bc6267e7e463ff6..500998cee0ed4035ea5db697fb37cb32ea573688 100644 (file)
@@ -148,6 +148,9 @@ int  nv41_fb_init(struct nouveau_object *);
 int  nv44_fb_init(struct nouveau_object *);
 void nv41_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
 
+void nv46_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
+                      u32 pitch, u32 flags, struct nouveau_fb_tile *);
+
 void nv50_fb_vram_del(struct nouveau_fb *, struct nouveau_mem **);
 void nv50_fb_trap(struct nouveau_fb *, int display);
 
index edc4ebe2ecc055988ac40b99aa44ca8505dabe67..83e3a88c41fb16a761c44d66575834599e8f1cf5 100644 (file)
@@ -34,7 +34,12 @@ void
 nv30_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
                  u32 flags, struct nouveau_fb_tile *tile)
 {
-       tile->addr = addr | 1;
+       /* for performance, select alternate bank offset for zeta */
+       if (!(flags & 4)) tile->addr = (0 << 4);
+       else              tile->addr = (1 << 4);
+
+       tile->addr |= 0x00000001; /* enable */
+       tile->addr |= addr;
        tile->limit = max(1u, addr + size) - 1;
        tile->pitch = pitch;
 }
index f7e42fa412d99b2861d3bc099e317aab3daadffb..d0804fdb9dbbf33d565537b053733d1c703a1889 100644 (file)
@@ -30,6 +30,16 @@ struct nv44_fb_priv {
        struct nouveau_fb base;
 };
 
+static void
+nv44_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
+                 u32 flags, struct nouveau_fb_tile *tile)
+{
+       tile->addr  = 0x00000001; /* mode = vram */
+       tile->addr |= addr;
+       tile->limit = max(1u, addr + size) - 1;
+       tile->pitch = pitch;
+}
+
 int
 nv44_fb_init(struct nouveau_object *object)
 {
@@ -72,7 +82,7 @@ nv44_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
 
        priv->base.memtype_valid = nv04_fb_memtype_valid;
        priv->base.tile.regions = 12;
-       priv->base.tile.init = nv30_fb_tile_init;
+       priv->base.tile.init = nv44_fb_tile_init;
        priv->base.tile.fini = nv30_fb_tile_fini;
        priv->base.tile.prog = nv41_fb_tile_prog;
        return nouveau_fb_created(&priv->base);
index 5cecb550e1d167837ff3d7e61f574a1cd8d6f3d5..005f8a3df830889b16327fe8cd345eb05225c68c 100644 (file)
@@ -30,6 +30,20 @@ struct nv46_fb_priv {
        struct nouveau_fb base;
 };
 
+void
+nv46_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
+                 u32 flags, struct nouveau_fb_tile *tile)
+{
+       /* for performance, select alternate bank offset for zeta */
+       if (!(flags & 4)) tile->addr = (0 << 3);
+       else              tile->addr = (1 << 3);
+
+       tile->addr |= 0x00000001; /* mode = vram */
+       tile->addr |= addr;
+       tile->limit = max(1u, addr + size) - 1;
+       tile->pitch = pitch;
+}
+
 static int
 nv46_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
             struct nouveau_oclass *oclass, void *data, u32 size,
@@ -57,7 +71,7 @@ nv46_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
 
        priv->base.memtype_valid = nv04_fb_memtype_valid;
        priv->base.tile.regions = 15;
-       priv->base.tile.init = nv30_fb_tile_init;
+       priv->base.tile.init = nv46_fb_tile_init;
        priv->base.tile.fini = nv30_fb_tile_fini;
        priv->base.tile.prog = nv41_fb_tile_prog;
        return nouveau_fb_created(&priv->base);
index 18e880e95cc1860e746775169a337c2a80cdf67c..f839ba02e5325687d0d60b875753659ee3ead0c1 100644 (file)
@@ -48,7 +48,7 @@ nv4e_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
        priv->base.ram.type = NV_MEM_TYPE_STOLEN;
        priv->base.memtype_valid = nv04_fb_memtype_valid;
        priv->base.tile.regions = 12;
-       priv->base.tile.init = nv30_fb_tile_init;
+       priv->base.tile.init = nv46_fb_tile_init;
        priv->base.tile.fini = nv30_fb_tile_fini;
        priv->base.tile.prog = nv41_fb_tile_prog;
        return nouveau_fb_created(&priv->base);