Browse Source

drm/nouveau/fb: merge more bits and pieces into oclass definitions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs 12 years ago
parent
commit
20cdeaf938
27 changed files with 272 additions and 519 deletions
  1. 2 0
      drivers/gpu/drm/nouveau/core/subdev/fb/base.c
  2. 14 12
      drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c
  3. 55 0
      drivers/gpu/drm/nouveau/core/subdev/fb/nv04.h
  4. 12 32
      drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c
  5. 12 32
      drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c
  6. 13 33
      drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c
  7. 13 33
      drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c
  8. 16 36
      drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c
  9. 13 33
      drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c
  10. 13 33
      drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c
  11. 14 35
      drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c
  12. 14 35
      drivers/gpu/drm/nouveau/core/subdev/fb/nv41.c
  13. 13 34
      drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c
  14. 12 33
      drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c
  15. 13 34
      drivers/gpu/drm/nouveau/core/subdev/fb/nv47.c
  16. 13 34
      drivers/gpu/drm/nouveau/core/subdev/fb/nv49.c
  17. 12 32
      drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c
  18. 2 2
      drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c
  19. 3 0
      drivers/gpu/drm/nouveau/core/subdev/fb/nv50.h
  20. 1 0
      drivers/gpu/drm/nouveau/core/subdev/fb/nv84.c
  21. 1 0
      drivers/gpu/drm/nouveau/core/subdev/fb/nva3.c
  22. 1 0
      drivers/gpu/drm/nouveau/core/subdev/fb/nvaa.c
  23. 1 0
      drivers/gpu/drm/nouveau/core/subdev/fb/nvaf.c
  24. 2 4
      drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
  25. 4 31
      drivers/gpu/drm/nouveau/core/subdev/fb/priv.h
  26. 2 1
      drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c
  27. 1 0
      drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c

+ 2 - 0
drivers/gpu/drm/nouveau/core/subdev/fb/base.c

@@ -133,6 +133,8 @@ nouveau_fb_create_(struct nouveau_object *parent, struct nouveau_object *engine,
 	if (ret)
 	if (ret)
 		return ret;
 		return ret;
 
 
+	pfb->memtype_valid = impl->memtype;
+
 	ret = nouveau_object_ctor(nv_object(pfb), nv_object(pfb),
 	ret = nouveau_object_ctor(nv_object(pfb), nv_object(pfb),
 				  impl->ram, NULL, 0, &ram);
 				  impl->ram, NULL, 0, &ram);
 	if (ret) {
 	if (ret) {

+ 14 - 12
drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c

@@ -22,14 +22,10 @@
  * Authors: Ben Skeggs
  * Authors: Ben Skeggs
  */
  */
 
 
-#include "priv.h"
+#include "nv04.h"
 
 
 #define NV04_PFB_CFG0						0x00100200
 #define NV04_PFB_CFG0						0x00100200
 
 
-struct nv04_fb_priv {
-	struct nouveau_fb base;
-};
-
 bool
 bool
 nv04_fb_memtype_valid(struct nouveau_fb *pfb, u32 tile_flags)
 nv04_fb_memtype_valid(struct nouveau_fb *pfb, u32 tile_flags)
 {
 {
@@ -57,11 +53,12 @@ nv04_fb_init(struct nouveau_object *object)
 	return 0;
 	return 0;
 }
 }
 
 
-static int
+int
 nv04_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
 nv04_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
 	     struct nouveau_oclass *oclass, void *data, u32 size,
 	     struct nouveau_oclass *oclass, void *data, u32 size,
 	     struct nouveau_object **pobject)
 	     struct nouveau_object **pobject)
 {
 {
+	struct nv04_fb_impl *impl = (void *)oclass;
 	struct nv04_fb_priv *priv;
 	struct nv04_fb_priv *priv;
 	int ret;
 	int ret;
 
 
@@ -70,18 +67,23 @@ nv04_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
 	if (ret)
 	if (ret)
 		return ret;
 		return ret;
 
 
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
+	priv->base.tile.regions = impl->tile.regions;
+	priv->base.tile.init = impl->tile.init;
+	priv->base.tile.comp = impl->tile.comp;
+	priv->base.tile.fini = impl->tile.fini;
+	priv->base.tile.prog = impl->tile.prog;
 	return 0;
 	return 0;
 }
 }
 
 
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv04_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x04),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
+nv04_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x04),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
 		.ctor = nv04_fb_ctor,
 		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = nv04_fb_init,
 		.init = nv04_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv04_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv04_ram_oclass,
+}.base.base;

+ 55 - 0
drivers/gpu/drm/nouveau/core/subdev/fb/nv04.h

@@ -0,0 +1,55 @@
+#ifndef __NVKM_FB_NV04_H__
+#define __NVKM_FB_NV04_H__
+
+#include "priv.h"
+
+struct nv04_fb_priv {
+	struct nouveau_fb base;
+};
+
+int  nv04_fb_ctor(struct nouveau_object *, struct nouveau_object *,
+		  struct nouveau_oclass *, void *, u32,
+		  struct nouveau_object **);
+
+struct nv04_fb_impl {
+	struct nouveau_fb_impl base;
+	struct {
+		int regions;
+		void (*init)(struct nouveau_fb *, int i, u32 addr, u32 size,
+			     u32 pitch, u32 flags, struct nouveau_fb_tile *);
+		void (*comp)(struct nouveau_fb *, int i, u32 size, u32 flags,
+			     struct nouveau_fb_tile *);
+		void (*fini)(struct nouveau_fb *, int i,
+			     struct nouveau_fb_tile *);
+		void (*prog)(struct nouveau_fb *, int i,
+			     struct nouveau_fb_tile *);
+	} tile;
+};
+
+void nv10_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
+		       u32 pitch, u32 flags, struct nouveau_fb_tile *);
+void nv10_fb_tile_fini(struct nouveau_fb *, int i, struct nouveau_fb_tile *);
+void nv10_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
+
+void nv20_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
+		       u32 pitch, u32 flags, struct nouveau_fb_tile *);
+void nv20_fb_tile_fini(struct nouveau_fb *, int i, struct nouveau_fb_tile *);
+void nv20_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
+
+int  nv30_fb_init(struct nouveau_object *);
+void nv30_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
+		       u32 pitch, u32 flags, struct nouveau_fb_tile *);
+
+void nv40_fb_tile_comp(struct nouveau_fb *, int i, u32 size, u32 flags,
+		       struct nouveau_fb_tile *);
+
+int  nv41_fb_init(struct nouveau_object *);
+void nv41_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
+
+int  nv44_fb_init(struct nouveau_object *);
+void nv44_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 *);
+
+#endif

+ 12 - 32
drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c

@@ -24,11 +24,7 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv10_fb_priv {
-	struct nouveau_fb base;
-};
+#include "nv04.h"
 
 
 void
 void
 nv10_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
 nv10_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
@@ -57,35 +53,19 @@ nv10_fb_tile_prog(struct nouveau_fb *pfb, int i, struct nouveau_fb_tile *tile)
 	nv_rd32(pfb, 0x100240 + (i * 0x10));
 	nv_rd32(pfb, 0x100240 + (i * 0x10));
 }
 }
 
 
-static int
-nv10_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv10_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 8;
-	priv->base.tile.init = nv10_fb_tile_init;
-	priv->base.tile.fini = nv10_fb_tile_fini;
-	priv->base.tile.prog = nv10_fb_tile_prog;
-	return 0;
-}
-
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv10_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x10),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv10_fb_ctor,
+nv10_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x10),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = _nouveau_fb_init,
 		.init = _nouveau_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv10_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv10_ram_oclass,
+	.tile.regions = 8,
+	.tile.init = nv10_fb_tile_init,
+	.tile.fini = nv10_fb_tile_fini,
+	.tile.prog = nv10_fb_tile_prog,
+}.base.base;

+ 12 - 32
drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c

@@ -24,41 +24,21 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv1a_fb_priv {
-	struct nouveau_fb base;
-};
-
-static int
-nv1a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv1a_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 8;
-	priv->base.tile.init = nv10_fb_tile_init;
-	priv->base.tile.fini = nv10_fb_tile_fini;
-	priv->base.tile.prog = nv10_fb_tile_prog;
-	return 0;
-}
+#include "nv04.h"
 
 
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv1a_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x1a),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv1a_fb_ctor,
+nv1a_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x1a),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = _nouveau_fb_init,
 		.init = _nouveau_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv10_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv10_ram_oclass,
+	.tile.regions = 8,
+	.tile.init = nv10_fb_tile_init,
+	.tile.fini = nv10_fb_tile_fini,
+	.tile.prog = nv10_fb_tile_prog,
+}.base.base;

+ 13 - 33
drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c

@@ -24,11 +24,7 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv20_fb_priv {
-	struct nouveau_fb base;
-};
+#include "nv04.h"
 
 
 void
 void
 nv20_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
 nv20_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
@@ -80,36 +76,20 @@ nv20_fb_tile_prog(struct nouveau_fb *pfb, int i, struct nouveau_fb_tile *tile)
 	nv_wr32(pfb, 0x100300 + (i * 0x04), tile->zcomp);
 	nv_wr32(pfb, 0x100300 + (i * 0x04), tile->zcomp);
 }
 }
 
 
-static int
-nv20_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv20_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 8;
-	priv->base.tile.init = nv20_fb_tile_init;
-	priv->base.tile.comp = nv20_fb_tile_comp;
-	priv->base.tile.fini = nv20_fb_tile_fini;
-	priv->base.tile.prog = nv20_fb_tile_prog;
-	return 0;
-}
-
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv20_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x20),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv20_fb_ctor,
+nv20_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x20),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = _nouveau_fb_init,
 		.init = _nouveau_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv20_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv20_ram_oclass,
+	.tile.regions = 8,
+	.tile.init = nv20_fb_tile_init,
+	.tile.comp = nv20_fb_tile_comp,
+	.tile.fini = nv20_fb_tile_fini,
+	.tile.prog = nv20_fb_tile_prog,
+}.base.base;

+ 13 - 33
drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c

@@ -24,11 +24,7 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv25_fb_priv {
-	struct nouveau_fb base;
-};
+#include "nv04.h"
 
 
 static void
 static void
 nv25_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
 nv25_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
@@ -46,36 +42,20 @@ nv25_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
 	}
 	}
 }
 }
 
 
-static int
-nv25_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv25_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 8;
-	priv->base.tile.init = nv20_fb_tile_init;
-	priv->base.tile.comp = nv25_fb_tile_comp;
-	priv->base.tile.fini = nv20_fb_tile_fini;
-	priv->base.tile.prog = nv20_fb_tile_prog;
-	return 0;
-}
-
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv25_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x25),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv25_fb_ctor,
+nv25_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x25),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = _nouveau_fb_init,
 		.init = _nouveau_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv20_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv20_ram_oclass,
+	.tile.regions = 8,
+	.tile.init = nv20_fb_tile_init,
+	.tile.comp = nv25_fb_tile_comp,
+	.tile.fini = nv20_fb_tile_fini,
+	.tile.prog = nv20_fb_tile_prog,
+}.base.base;

+ 16 - 36
drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c

@@ -24,11 +24,7 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv30_fb_priv {
-	struct nouveau_fb base;
-};
+#include "nv04.h"
 
 
 void
 void
 nv30_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
 nv30_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
@@ -67,7 +63,7 @@ nv30_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
 }
 }
 
 
 static int
 static int
-calc_bias(struct nv30_fb_priv *priv, int k, int i, int j)
+calc_bias(struct nv04_fb_priv *priv, int k, int i, int j)
 {
 {
 	struct nouveau_device *device = nv_device(priv);
 	struct nouveau_device *device = nv_device(priv);
 	int b = (device->chipset > 0x30 ?
 	int b = (device->chipset > 0x30 ?
@@ -78,7 +74,7 @@ calc_bias(struct nv30_fb_priv *priv, int k, int i, int j)
 }
 }
 
 
 static int
 static int
-calc_ref(struct nv30_fb_priv *priv, int l, int k, int i)
+calc_ref(struct nv04_fb_priv *priv, int l, int k, int i)
 {
 {
 	int j, x = 0;
 	int j, x = 0;
 
 
@@ -95,7 +91,7 @@ int
 nv30_fb_init(struct nouveau_object *object)
 nv30_fb_init(struct nouveau_object *object)
 {
 {
 	struct nouveau_device *device = nv_device(object);
 	struct nouveau_device *device = nv_device(object);
-	struct nv30_fb_priv *priv = (void *)object;
+	struct nv04_fb_priv *priv = (void *)object;
 	int ret, i, j;
 	int ret, i, j;
 
 
 	ret = nouveau_fb_init(&priv->base);
 	ret = nouveau_fb_init(&priv->base);
@@ -124,36 +120,20 @@ nv30_fb_init(struct nouveau_object *object)
 	return 0;
 	return 0;
 }
 }
 
 
-static int
-nv30_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv30_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 8;
-	priv->base.tile.init = nv30_fb_tile_init;
-	priv->base.tile.comp = nv30_fb_tile_comp;
-	priv->base.tile.fini = nv20_fb_tile_fini;
-	priv->base.tile.prog = nv20_fb_tile_prog;
-	return 0;
-}
-
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv30_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x30),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv30_fb_ctor,
+nv30_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x30),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = nv30_fb_init,
 		.init = nv30_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv20_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv20_ram_oclass,
+	.tile.regions = 8,
+	.tile.init = nv30_fb_tile_init,
+	.tile.comp = nv30_fb_tile_comp,
+	.tile.fini = nv20_fb_tile_fini,
+	.tile.prog = nv20_fb_tile_prog,
+}.base.base;

+ 13 - 33
drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c

@@ -24,11 +24,7 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv35_fb_priv {
-	struct nouveau_fb base;
-};
+#include "nv04.h"
 
 
 static void
 static void
 nv35_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
 nv35_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
@@ -47,36 +43,20 @@ nv35_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
 	}
 	}
 }
 }
 
 
-static int
-nv35_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv35_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 8;
-	priv->base.tile.init = nv30_fb_tile_init;
-	priv->base.tile.comp = nv35_fb_tile_comp;
-	priv->base.tile.fini = nv20_fb_tile_fini;
-	priv->base.tile.prog = nv20_fb_tile_prog;
-	return 0;
-}
-
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv35_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x35),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv35_fb_ctor,
+nv35_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x35),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = nv30_fb_init,
 		.init = nv30_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv20_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv20_ram_oclass,
+	.tile.regions = 8,
+	.tile.init = nv30_fb_tile_init,
+	.tile.comp = nv35_fb_tile_comp,
+	.tile.fini = nv20_fb_tile_fini,
+	.tile.prog = nv20_fb_tile_prog,
+}.base.base;

+ 13 - 33
drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c

@@ -24,11 +24,7 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv36_fb_priv {
-	struct nouveau_fb base;
-};
+#include "nv04.h"
 
 
 static void
 static void
 nv36_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
 nv36_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
@@ -47,36 +43,20 @@ nv36_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
 	}
 	}
 }
 }
 
 
-static int
-nv36_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv36_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 8;
-	priv->base.tile.init = nv30_fb_tile_init;
-	priv->base.tile.comp = nv36_fb_tile_comp;
-	priv->base.tile.fini = nv20_fb_tile_fini;
-	priv->base.tile.prog = nv20_fb_tile_prog;
-	return 0;
-}
-
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv36_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x36),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv36_fb_ctor,
+nv36_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x36),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = nv30_fb_init,
 		.init = nv30_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv20_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv20_ram_oclass,
+	.tile.regions = 8,
+	.tile.init = nv30_fb_tile_init,
+	.tile.comp = nv36_fb_tile_comp,
+	.tile.fini = nv20_fb_tile_fini,
+	.tile.prog = nv20_fb_tile_prog,
+}.base.base;

+ 14 - 35
drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c

@@ -24,11 +24,7 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv40_fb_priv {
-	struct nouveau_fb base;
-};
+#include "nv04.h"
 
 
 void
 void
 nv40_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
 nv40_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
@@ -50,7 +46,7 @@ nv40_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
 static int
 static int
 nv40_fb_init(struct nouveau_object *object)
 nv40_fb_init(struct nouveau_object *object)
 {
 {
-	struct nv40_fb_priv *priv = (void *)object;
+	struct nv04_fb_priv *priv = (void *)object;
 	int ret;
 	int ret;
 
 
 	ret = nouveau_fb_init(&priv->base);
 	ret = nouveau_fb_init(&priv->base);
@@ -61,37 +57,20 @@ nv40_fb_init(struct nouveau_object *object)
 	return 0;
 	return 0;
 }
 }
 
 
-static int
-nv40_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv40_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 8;
-	priv->base.tile.init = nv30_fb_tile_init;
-	priv->base.tile.comp = nv40_fb_tile_comp;
-	priv->base.tile.fini = nv20_fb_tile_fini;
-	priv->base.tile.prog = nv20_fb_tile_prog;
-	return 0;
-}
-
-
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv40_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x40),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv40_fb_ctor,
+nv40_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x40),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = nv40_fb_init,
 		.init = nv40_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv40_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv40_ram_oclass,
+	.tile.regions = 8,
+	.tile.init = nv30_fb_tile_init,
+	.tile.comp = nv40_fb_tile_comp,
+	.tile.fini = nv20_fb_tile_fini,
+	.tile.prog = nv20_fb_tile_prog,
+}.base.base;

+ 14 - 35
drivers/gpu/drm/nouveau/core/subdev/fb/nv41.c

@@ -24,11 +24,7 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv41_fb_priv {
-	struct nouveau_fb base;
-};
+#include "nv04.h"
 
 
 void
 void
 nv41_fb_tile_prog(struct nouveau_fb *pfb, int i, struct nouveau_fb_tile *tile)
 nv41_fb_tile_prog(struct nouveau_fb *pfb, int i, struct nouveau_fb_tile *tile)
@@ -43,7 +39,7 @@ nv41_fb_tile_prog(struct nouveau_fb *pfb, int i, struct nouveau_fb_tile *tile)
 int
 int
 nv41_fb_init(struct nouveau_object *object)
 nv41_fb_init(struct nouveau_object *object)
 {
 {
-	struct nv41_fb_priv *priv = (void *)object;
+	struct nv04_fb_priv *priv = (void *)object;
 	int ret;
 	int ret;
 
 
 	ret = nouveau_fb_init(&priv->base);
 	ret = nouveau_fb_init(&priv->base);
@@ -54,37 +50,20 @@ nv41_fb_init(struct nouveau_object *object)
 	return 0;
 	return 0;
 }
 }
 
 
-static int
-nv41_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv41_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 12;
-	priv->base.tile.init = nv30_fb_tile_init;
-	priv->base.tile.comp = nv40_fb_tile_comp;
-	priv->base.tile.fini = nv20_fb_tile_fini;
-	priv->base.tile.prog = nv41_fb_tile_prog;
-	return 0;
-}
-
-
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv41_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x41),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv41_fb_ctor,
+nv41_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x41),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = nv41_fb_init,
 		.init = nv41_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv41_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv41_ram_oclass,
+	.tile.regions = 12,
+	.tile.init = nv30_fb_tile_init,
+	.tile.comp = nv40_fb_tile_comp,
+	.tile.fini = nv20_fb_tile_fini,
+	.tile.prog = nv41_fb_tile_prog,
+}.base.base;

+ 13 - 34
drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c

@@ -24,11 +24,7 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv44_fb_priv {
-	struct nouveau_fb base;
-};
+#include "nv04.h"
 
 
 static void
 static void
 nv44_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
 nv44_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
@@ -52,7 +48,7 @@ nv44_fb_tile_prog(struct nouveau_fb *pfb, int i, struct nouveau_fb_tile *tile)
 int
 int
 nv44_fb_init(struct nouveau_object *object)
 nv44_fb_init(struct nouveau_object *object)
 {
 {
-	struct nv44_fb_priv *priv = (void *)object;
+	struct nv04_fb_priv *priv = (void *)object;
 	int ret;
 	int ret;
 
 
 	ret = nouveau_fb_init(&priv->base);
 	ret = nouveau_fb_init(&priv->base);
@@ -64,36 +60,19 @@ nv44_fb_init(struct nouveau_object *object)
 	return 0;
 	return 0;
 }
 }
 
 
-static int
-nv44_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv44_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 12;
-	priv->base.tile.init = nv44_fb_tile_init;
-	priv->base.tile.fini = nv20_fb_tile_fini;
-	priv->base.tile.prog = nv44_fb_tile_prog;
-	return 0;
-}
-
-
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv44_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x44),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv44_fb_ctor,
+nv44_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x44),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = nv44_fb_init,
 		.init = nv44_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv44_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv44_ram_oclass,
+	.tile.regions = 12,
+	.tile.init = nv44_fb_tile_init,
+	.tile.fini = nv20_fb_tile_fini,
+	.tile.prog = nv44_fb_tile_prog,
+}.base.base;

+ 12 - 33
drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c

@@ -24,11 +24,7 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv46_fb_priv {
-	struct nouveau_fb base;
-};
+#include "nv04.h"
 
 
 void
 void
 nv46_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
 nv46_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
@@ -44,36 +40,19 @@ nv46_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
 	tile->pitch = pitch;
 	tile->pitch = pitch;
 }
 }
 
 
-static int
-nv46_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv46_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 15;
-	priv->base.tile.init = nv46_fb_tile_init;
-	priv->base.tile.fini = nv20_fb_tile_fini;
-	priv->base.tile.prog = nv44_fb_tile_prog;
-	return 0;
-}
-
-
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv46_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x46),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv46_fb_ctor,
+nv46_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x46),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = nv44_fb_init,
 		.init = nv44_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv44_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv44_ram_oclass,
+	.tile.regions = 15,
+	.tile.init = nv46_fb_tile_init,
+	.tile.fini = nv20_fb_tile_fini,
+	.tile.prog = nv44_fb_tile_prog,
+}.base.base;

+ 13 - 34
drivers/gpu/drm/nouveau/core/subdev/fb/nv47.c

@@ -24,43 +24,22 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv47_fb_priv {
-	struct nouveau_fb base;
-};
-
-static int
-nv47_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv47_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 15;
-	priv->base.tile.init = nv30_fb_tile_init;
-	priv->base.tile.comp = nv40_fb_tile_comp;
-	priv->base.tile.fini = nv20_fb_tile_fini;
-	priv->base.tile.prog = nv41_fb_tile_prog;
-	return 0;
-}
-
+#include "nv04.h"
 
 
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv47_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x47),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv47_fb_ctor,
+nv47_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x47),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = nv41_fb_init,
 		.init = nv41_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv41_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv41_ram_oclass,
+	.tile.regions = 15,
+	.tile.init = nv30_fb_tile_init,
+	.tile.comp = nv40_fb_tile_comp,
+	.tile.fini = nv20_fb_tile_fini,
+	.tile.prog = nv41_fb_tile_prog,
+}.base.base;

+ 13 - 34
drivers/gpu/drm/nouveau/core/subdev/fb/nv49.c

@@ -24,43 +24,22 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv49_fb_priv {
-	struct nouveau_fb base;
-};
-
-static int
-nv49_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv49_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 15;
-	priv->base.tile.init = nv30_fb_tile_init;
-	priv->base.tile.comp = nv40_fb_tile_comp;
-	priv->base.tile.fini = nv20_fb_tile_fini;
-	priv->base.tile.prog = nv41_fb_tile_prog;
-	return 0;
-}
-
+#include "nv04.h"
 
 
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv49_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x49),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv49_fb_ctor,
+nv49_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x49),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = nv41_fb_init,
 		.init = nv41_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv49_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv49_ram_oclass,
+	.tile.regions = 15,
+	.tile.init = nv30_fb_tile_init,
+	.tile.comp = nv40_fb_tile_comp,
+	.tile.fini = nv20_fb_tile_fini,
+	.tile.prog = nv41_fb_tile_prog,
+}.base.base;

+ 12 - 32
drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c

@@ -24,41 +24,21 @@
  *
  *
  */
  */
 
 
-#include "priv.h"
-
-struct nv4e_fb_priv {
-	struct nouveau_fb base;
-};
-
-static int
-nv4e_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
-	     struct nouveau_oclass *oclass, void *data, u32 size,
-	     struct nouveau_object **pobject)
-{
-	struct nv4e_fb_priv *priv;
-	int ret;
-
-	ret = nouveau_fb_create(parent, engine, oclass, &priv);
-	*pobject = nv_object(priv);
-	if (ret)
-		return ret;
-
-	priv->base.memtype_valid = nv04_fb_memtype_valid;
-	priv->base.tile.regions = 12;
-	priv->base.tile.init = nv46_fb_tile_init;
-	priv->base.tile.fini = nv20_fb_tile_fini;
-	priv->base.tile.prog = nv44_fb_tile_prog;
-	return 0;
-}
+#include "nv04.h"
 
 
 struct nouveau_oclass *
 struct nouveau_oclass *
-nv4e_fb_oclass = &(struct nouveau_fb_impl) {
-	.base.handle = NV_SUBDEV(FB, 0x4e),
-	.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv4e_fb_ctor,
+nv4e_fb_oclass = &(struct nv04_fb_impl) {
+	.base.base.handle = NV_SUBDEV(FB, 0x4e),
+	.base.base.ofuncs = &(struct nouveau_ofuncs) {
+		.ctor = nv04_fb_ctor,
 		.dtor = _nouveau_fb_dtor,
 		.dtor = _nouveau_fb_dtor,
 		.init = nv44_fb_init,
 		.init = nv44_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
-	.ram = &nv4e_ram_oclass,
-}.base;
+	.base.memtype = nv04_fb_memtype_valid,
+	.base.ram = &nv4e_ram_oclass,
+	.tile.regions = 12,
+	.tile.init = nv46_fb_tile_init,
+	.tile.fini = nv20_fb_tile_fini,
+	.tile.prog = nv44_fb_tile_prog,
+}.base.base;

+ 2 - 2
drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c

@@ -43,7 +43,7 @@ nv50_fb_memtype[0x80] = {
 	1, 0, 2, 0, 1, 0, 2, 0, 1, 1, 2, 2, 1, 1, 0, 0
 	1, 0, 2, 0, 1, 0, 2, 0, 1, 1, 2, 2, 1, 1, 0, 0
 };
 };
 
 
-static bool
+bool
 nv50_fb_memtype_valid(struct nouveau_fb *pfb, u32 memtype)
 nv50_fb_memtype_valid(struct nouveau_fb *pfb, u32 memtype)
 {
 {
 	return nv50_fb_memtype[(memtype & 0xff00) >> 8] != 0;
 	return nv50_fb_memtype[(memtype & 0xff00) >> 8] != 0;
@@ -259,7 +259,6 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
 		nv_warn(priv, "failed 0x100c08 page alloc\n");
 		nv_warn(priv, "failed 0x100c08 page alloc\n");
 	}
 	}
 
 
-	priv->base.memtype_valid = nv50_fb_memtype_valid;
 	nv_subdev(priv)->intr = nv50_fb_intr;
 	nv_subdev(priv)->intr = nv50_fb_intr;
 	return 0;
 	return 0;
 }
 }
@@ -311,6 +310,7 @@ nv50_fb_oclass = &(struct nv50_fb_impl) {
 		.init = nv50_fb_init,
 		.init = nv50_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
+	.base.memtype = nv50_fb_memtype_valid,
 	.base.ram = &nv50_ram_oclass,
 	.base.ram = &nv50_ram_oclass,
 	.trap = 0x000707ff,
 	.trap = 0x000707ff,
 }.base.base;
 }.base.base;

+ 3 - 0
drivers/gpu/drm/nouveau/core/subdev/fb/nv50.h

@@ -20,4 +20,7 @@ struct nv50_fb_impl {
 	u32 trap;
 	u32 trap;
 };
 };
 
 
+void __nv50_ram_put(struct nouveau_fb *, struct nouveau_mem *);
+extern int nv50_fb_memtype[0x80];
+
 #endif
 #endif

+ 1 - 0
drivers/gpu/drm/nouveau/core/subdev/fb/nv84.c

@@ -33,6 +33,7 @@ nv84_fb_oclass = &(struct nv50_fb_impl) {
 		.init = nv50_fb_init,
 		.init = nv50_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
+	.base.memtype = nv50_fb_memtype_valid,
 	.base.ram = &nv50_ram_oclass,
 	.base.ram = &nv50_ram_oclass,
 	.trap = 0x001d07ff,
 	.trap = 0x001d07ff,
 }.base.base;
 }.base.base;

+ 1 - 0
drivers/gpu/drm/nouveau/core/subdev/fb/nva3.c

@@ -33,6 +33,7 @@ nva3_fb_oclass = &(struct nv50_fb_impl) {
 		.init = nv50_fb_init,
 		.init = nv50_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
+	.base.memtype = nv50_fb_memtype_valid,
 	.base.ram = &nv50_ram_oclass,
 	.base.ram = &nv50_ram_oclass,
 	.trap = 0x000d0fff,
 	.trap = 0x000d0fff,
 }.base.base;
 }.base.base;

+ 1 - 0
drivers/gpu/drm/nouveau/core/subdev/fb/nvaa.c

@@ -33,6 +33,7 @@ nvaa_fb_oclass = &(struct nv50_fb_impl) {
 		.init = nv50_fb_init,
 		.init = nv50_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
+	.base.memtype = nv50_fb_memtype_valid,
 	.base.ram = &nv50_ram_oclass,
 	.base.ram = &nv50_ram_oclass,
 	.trap = 0x001d07ff,
 	.trap = 0x001d07ff,
 }.base.base;
 }.base.base;

+ 1 - 0
drivers/gpu/drm/nouveau/core/subdev/fb/nvaf.c

@@ -33,6 +33,7 @@ nvaf_fb_oclass = &(struct nv50_fb_impl) {
 		.init = nv50_fb_init,
 		.init = nv50_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
+	.base.memtype = nv50_fb_memtype_valid,
 	.base.ram = &nv50_ram_oclass,
 	.base.ram = &nv50_ram_oclass,
 	.trap = 0x089d1fff,
 	.trap = 0x089d1fff,
 }.base.base;
 }.base.base;

+ 2 - 4
drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c

@@ -22,7 +22,7 @@
  * Authors: Ben Skeggs
  * Authors: Ben Skeggs
  */
  */
 
 
-#include "priv.h"
+#include "nv04.h"
 
 
 struct nvc0_fb_priv {
 struct nvc0_fb_priv {
 	struct nouveau_fb base;
 	struct nouveau_fb base;
@@ -83,8 +83,6 @@ nvc0_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
 	if (ret)
 	if (ret)
 		return ret;
 		return ret;
 
 
-	priv->base.memtype_valid = nvc0_fb_memtype_valid;
-
 	priv->r100c10_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
 	priv->r100c10_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
 	if (priv->r100c10_page) {
 	if (priv->r100c10_page) {
 		priv->r100c10 = pci_map_page(device->pdev, priv->r100c10_page,
 		priv->r100c10 = pci_map_page(device->pdev, priv->r100c10_page,
@@ -97,7 +95,6 @@ nvc0_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
 	return 0;
 	return 0;
 }
 }
 
 
-
 struct nouveau_oclass *
 struct nouveau_oclass *
 nvc0_fb_oclass = &(struct nouveau_fb_impl) {
 nvc0_fb_oclass = &(struct nouveau_fb_impl) {
 	.base.handle = NV_SUBDEV(FB, 0xc0),
 	.base.handle = NV_SUBDEV(FB, 0xc0),
@@ -107,5 +104,6 @@ nvc0_fb_oclass = &(struct nouveau_fb_impl) {
 		.init = nvc0_fb_init,
 		.init = nvc0_fb_init,
 		.fini = _nouveau_fb_fini,
 		.fini = _nouveau_fb_fini,
 	},
 	},
+	.memtype = nvc0_fb_memtype_valid,
 	.ram = &nvc0_ram_oclass,
 	.ram = &nvc0_ram_oclass,
 }.base;
 }.base;

+ 4 - 31
drivers/gpu/drm/nouveau/core/subdev/fb/priv.h

@@ -54,40 +54,13 @@ int  _nouveau_fb_fini(struct nouveau_object *, bool);
 struct nouveau_fb_impl {
 struct nouveau_fb_impl {
 	struct nouveau_oclass base;
 	struct nouveau_oclass base;
 	struct nouveau_oclass *ram;
 	struct nouveau_oclass *ram;
+	bool (*memtype)(struct nouveau_fb *, u32);
 };
 };
 
 
-struct nouveau_bios;
-int  nouveau_fb_bios_memtype(struct nouveau_bios *);
-
 bool nv04_fb_memtype_valid(struct nouveau_fb *, u32 memtype);
 bool nv04_fb_memtype_valid(struct nouveau_fb *, u32 memtype);
+bool nv50_fb_memtype_valid(struct nouveau_fb *, u32 memtype);
 
 
-void nv10_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
-		       u32 pitch, u32 flags, struct nouveau_fb_tile *);
-void nv10_fb_tile_fini(struct nouveau_fb *, int i, struct nouveau_fb_tile *);
-void nv10_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
-
-void nv20_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
-		       u32 pitch, u32 flags, struct nouveau_fb_tile *);
-void nv20_fb_tile_fini(struct nouveau_fb *, int i, struct nouveau_fb_tile *);
-void nv20_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
-
-int  nv30_fb_init(struct nouveau_object *);
-void nv30_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size,
-		       u32 pitch, u32 flags, struct nouveau_fb_tile *);
-
-void nv40_fb_tile_comp(struct nouveau_fb *, int i, u32 size, u32 flags,
-		       struct nouveau_fb_tile *);
-
-int  nv41_fb_init(struct nouveau_object *);
-void nv41_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *);
-
-int  nv44_fb_init(struct nouveau_object *);
-void nv44_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_ram_put(struct nouveau_fb *, struct nouveau_mem *);
-extern int nv50_fb_memtype[0x80];
+struct nouveau_bios;
+int  nouveau_fb_bios_memtype(struct nouveau_bios *);
 
 
 #endif
 #endif

+ 2 - 1
drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c

@@ -24,7 +24,8 @@
 
 
 #include <subdev/bios.h>
 #include <subdev/bios.h>
 #include <core/mm.h>
 #include <core/mm.h>
-#include "priv.h"
+
+#include "nv50.h"
 
 
 void
 void
 __nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem *mem)
 __nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem *mem)

+ 1 - 0
drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c

@@ -26,6 +26,7 @@
 #include <subdev/ltcg.h>
 #include <subdev/ltcg.h>
 
 
 #include "priv.h"
 #include "priv.h"
+#include "nv50.h"
 
 
 extern const u8 nvc0_pte_storage_type_map[256];
 extern const u8 nvc0_pte_storage_type_map[256];