Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20cdeaf9 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

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



Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 8613e731
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -133,6 +133,8 @@ nouveau_fb_create_(struct nouveau_object *parent, struct nouveau_object *engine,
	if (ret)
		return ret;

	pfb->memtype_valid = impl->memtype;

	ret = nouveau_object_ctor(nv_object(pfb), nv_object(pfb),
				  impl->ram, NULL, 0, &ram);
	if (ret) {
+14 −12
Original line number Diff line number Diff line
@@ -22,14 +22,10 @@
 * Authors: Ben Skeggs
 */

#include "priv.h"
#include "nv04.h"

#define NV04_PFB_CFG0						0x00100200

struct nv04_fb_priv {
	struct nouveau_fb base;
};

bool
nv04_fb_memtype_valid(struct nouveau_fb *pfb, u32 tile_flags)
{
@@ -57,11 +53,12 @@ nv04_fb_init(struct nouveau_object *object)
	return 0;
}

static int
int
nv04_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
	     struct nouveau_oclass *oclass, void *data, u32 size,
	     struct nouveau_object **pobject)
{
	struct nv04_fb_impl *impl = (void *)oclass;
	struct nv04_fb_priv *priv;
	int ret;

@@ -70,18 +67,23 @@ nv04_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
	if (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;
}

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,
		.dtor = _nouveau_fb_dtor,
		.init = nv04_fb_init,
		.fini = _nouveau_fb_fini,
	},
	.ram = &nv04_ram_oclass,
}.base;
	.base.memtype = nv04_fb_memtype_valid,
	.base.ram = &nv04_ram_oclass,
}.base.base;
+55 −0
Original line number Diff line number Diff line
#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
Original line number Diff line number Diff line
@@ -24,11 +24,7 @@
 *
 */

#include "priv.h"

struct nv10_fb_priv {
	struct nouveau_fb base;
};
#include "nv04.h"

void
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));
}

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 *
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,
		.init = _nouveau_fb_init,
		.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
Original line number Diff line number Diff line
@@ -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 *
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,
		.init = _nouveau_fb_init,
		.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;
Loading