Commit 0407b33f authored by Ben Skeggs's avatar Ben Skeggs Committed by Dave Airlie

drm/nouveau/disp: collapse nv50_disp_func into nvkm_disp_func

Aside from a chicken-and-egg problem with a duplicate 'root' member,
this is a straight dump of function pointers from one struct into
another.

The left-over wrapping mess in >=nv50 structs will be fixed later.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 412dfcf3
......@@ -197,9 +197,8 @@ nvkm_disp_class_get(struct nvkm_oclass *oclass, int index,
{
struct nvkm_disp *disp = nvkm_disp(oclass->engine);
if (index == 0) {
const struct nvkm_disp_oclass *root = disp->func->root(disp);
oclass->base = root->base;
oclass->engn = root;
oclass->base = disp->func->root->base;
oclass->engn = disp->func->root;
*class = &nvkm_disp_sclass;
return 0;
}
......
......@@ -26,11 +26,16 @@
#include "ior.h"
#include "rootnv50.h"
static const struct nv50_disp_func
static const struct nvkm_disp_func
g84_disp = {
.init = nv50_disp_init,
.fini = nv50_disp_fini,
.intr = nv50_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = nv50_disp_init,
.fini_ = nv50_disp_fini,
.intr_ = nv50_disp_intr,
.uevent = &nv50_disp_chan_uevent,
.super = nv50_disp_super,
.root = &g84_disp_root_oclass,
......
......@@ -26,11 +26,16 @@
#include "ior.h"
#include "rootnv50.h"
static const struct nv50_disp_func
static const struct nvkm_disp_func
g94_disp = {
.init = nv50_disp_init,
.fini = nv50_disp_fini,
.intr = nv50_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = nv50_disp_init,
.fini_ = nv50_disp_fini,
.intr_ = nv50_disp_intr,
.uevent = &nv50_disp_chan_uevent,
.super = nv50_disp_super,
.root = &g94_disp_root_oclass,
......
......@@ -25,11 +25,16 @@
#include "channv50.h"
#include "rootnv50.h"
static const struct nv50_disp_func
static const struct nvkm_disp_func
ga102_disp = {
.init = tu102_disp_init,
.fini = gv100_disp_fini,
.intr = gv100_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = tu102_disp_init,
.fini_ = gv100_disp_fini,
.intr_ = gv100_disp_intr,
.uevent = &gv100_disp_chan_uevent,
.super = gv100_disp_super,
.root = &ga102_disp_root_oclass,
......
......@@ -251,11 +251,16 @@ gf119_disp_init(struct nv50_disp *disp)
return 0;
}
static const struct nv50_disp_func
static const struct nvkm_disp_func
gf119_disp = {
.init = gf119_disp_init,
.fini = gf119_disp_fini,
.intr = gf119_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = gf119_disp_init,
.fini_ = gf119_disp_fini,
.intr_ = gf119_disp_intr,
.intr_error = gf119_disp_intr_error,
.uevent = &gf119_disp_chan_uevent,
.super = gf119_disp_super,
......
......@@ -26,11 +26,16 @@
#include "ior.h"
#include "rootnv50.h"
static const struct nv50_disp_func
static const struct nvkm_disp_func
gk104_disp = {
.init = gf119_disp_init,
.fini = gf119_disp_fini,
.intr = gf119_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = gf119_disp_init,
.fini_ = gf119_disp_fini,
.intr_ = gf119_disp_intr,
.intr_error = gf119_disp_intr_error,
.uevent = &gf119_disp_chan_uevent,
.super = gf119_disp_super,
......
......@@ -26,11 +26,16 @@
#include "ior.h"
#include "rootnv50.h"
static const struct nv50_disp_func
static const struct nvkm_disp_func
gk110_disp = {
.init = gf119_disp_init,
.fini = gf119_disp_fini,
.intr = gf119_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = gf119_disp_init,
.fini_ = gf119_disp_fini,
.intr_ = gf119_disp_intr,
.intr_error = gf119_disp_intr_error,
.uevent = &gf119_disp_chan_uevent,
.super = gf119_disp_super,
......
......@@ -26,11 +26,16 @@
#include "ior.h"
#include "rootnv50.h"
static const struct nv50_disp_func
static const struct nvkm_disp_func
gm107_disp = {
.init = gf119_disp_init,
.fini = gf119_disp_fini,
.intr = gf119_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = gf119_disp_init,
.fini_ = gf119_disp_fini,
.intr_ = gf119_disp_intr,
.intr_error = gf119_disp_intr_error,
.uevent = &gf119_disp_chan_uevent,
.super = gf119_disp_super,
......
......@@ -26,11 +26,16 @@
#include "ior.h"
#include "rootnv50.h"
static const struct nv50_disp_func
static const struct nvkm_disp_func
gm200_disp = {
.init = gf119_disp_init,
.fini = gf119_disp_fini,
.intr = gf119_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = gf119_disp_init,
.fini_ = gf119_disp_fini,
.intr_ = gf119_disp_intr,
.intr_error = gf119_disp_intr_error,
.uevent = &gf119_disp_chan_uevent,
.super = gf119_disp_super,
......
......@@ -26,11 +26,16 @@
#include "ior.h"
#include "rootnv50.h"
static const struct nv50_disp_func
static const struct nvkm_disp_func
gp100_disp = {
.init = gf119_disp_init,
.fini = gf119_disp_fini,
.intr = gf119_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = gf119_disp_init,
.fini_ = gf119_disp_fini,
.intr_ = gf119_disp_intr,
.intr_error = gf119_disp_intr_error,
.uevent = &gf119_disp_chan_uevent,
.super = gf119_disp_super,
......
......@@ -53,11 +53,16 @@ gp102_disp_intr_error(struct nv50_disp *disp, int chid)
nvkm_wr32(device, 0x6111f0 + (chid * 12), 0x90000000);
}
static const struct nv50_disp_func
static const struct nvkm_disp_func
gp102_disp = {
.init = gf119_disp_init,
.fini = gf119_disp_fini,
.intr = gf119_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = gf119_disp_init,
.fini_ = gf119_disp_fini,
.intr_ = gf119_disp_intr,
.intr_error = gp102_disp_intr_error,
.uevent = &gf119_disp_chan_uevent,
.super = gf119_disp_super,
......
......@@ -26,11 +26,16 @@
#include "ior.h"
#include "rootnv50.h"
static const struct nv50_disp_func
static const struct nvkm_disp_func
gt200_disp = {
.init = nv50_disp_init,
.fini = nv50_disp_fini,
.intr = nv50_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = nv50_disp_init,
.fini_ = nv50_disp_fini,
.intr_ = nv50_disp_intr,
.uevent = &nv50_disp_chan_uevent,
.super = nv50_disp_super,
.root = &gt200_disp_root_oclass,
......
......@@ -26,11 +26,16 @@
#include "ior.h"
#include "rootnv50.h"
static const struct nv50_disp_func
static const struct nvkm_disp_func
gt215_disp = {
.init = nv50_disp_init,
.fini = nv50_disp_fini,
.intr = nv50_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = nv50_disp_init,
.fini_ = nv50_disp_fini,
.intr_ = nv50_disp_intr,
.uevent = &nv50_disp_chan_uevent,
.super = nv50_disp_super,
.root = &gt215_disp_root_oclass,
......
......@@ -426,11 +426,16 @@ gv100_disp_init(struct nv50_disp *disp)
return 0;
}
static const struct nv50_disp_func
static const struct nvkm_disp_func
gv100_disp = {
.init = gv100_disp_init,
.fini = gv100_disp_fini,
.intr = gv100_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = gv100_disp_init,
.fini_ = gv100_disp_fini,
.intr_ = gv100_disp_intr,
.uevent = &gv100_disp_chan_uevent,
.super = gv100_disp_super,
.root = &gv100_disp_root_oclass,
......
......@@ -24,11 +24,16 @@
#include "ior.h"
#include "rootnv50.h"
static const struct nv50_disp_func
static const struct nvkm_disp_func
mcp77_disp = {
.init = nv50_disp_init,
.fini = nv50_disp_fini,
.intr = nv50_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = nv50_disp_init,
.fini_ = nv50_disp_fini,
.intr_ = nv50_disp_intr,
.uevent = &nv50_disp_chan_uevent,
.super = nv50_disp_super,
.root = &g94_disp_root_oclass,
......
......@@ -24,11 +24,16 @@
#include "ior.h"
#include "rootnv50.h"
static const struct nv50_disp_func
static const struct nvkm_disp_func
mcp89_disp = {
.init = nv50_disp_init,
.fini = nv50_disp_fini,
.intr = nv50_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = nv50_disp_init,
.fini_ = nv50_disp_fini,
.intr_ = nv50_disp_intr,
.uevent = &nv50_disp_chan_uevent,
.super = nv50_disp_super,
.root = &gt215_disp_root_oclass,
......
......@@ -24,12 +24,6 @@
#include "priv.h"
#include "head.h"
static const struct nvkm_disp_oclass *
nv04_disp_root(struct nvkm_disp *disp)
{
return &nv04_disp_root_oclass;
}
static void
nv04_disp_intr(struct nvkm_disp *disp)
{
......@@ -60,7 +54,7 @@ nv04_disp_intr(struct nvkm_disp *disp)
static const struct nvkm_disp_func
nv04_disp = {
.intr = nv04_disp_intr,
.root = nv04_disp_root,
.root = &nv04_disp_root_oclass,
};
int
......
......@@ -36,34 +36,28 @@
#include <subdev/devinit.h>
#include <subdev/timer.h>
static const struct nvkm_disp_oclass *
nv50_disp_root_(struct nvkm_disp *base)
{
return nv50_disp(base)->func->root;
}
static void
void
nv50_disp_intr_(struct nvkm_disp *base)
{
struct nv50_disp *disp = nv50_disp(base);
disp->func->intr(disp);
disp->func->intr_(disp);
}
static void
void
nv50_disp_fini_(struct nvkm_disp *base)
{
struct nv50_disp *disp = nv50_disp(base);
disp->func->fini(disp);
disp->func->fini_(disp);
}
static int
int
nv50_disp_init_(struct nvkm_disp *base)
{
struct nv50_disp *disp = nv50_disp(base);
return disp->func->init(disp);
return disp->func->init_(disp);
}
static void *
void *
nv50_disp_dtor_(struct nvkm_disp *base)
{
struct nv50_disp *disp = nv50_disp(base);
......@@ -78,11 +72,11 @@ nv50_disp_dtor_(struct nvkm_disp *base)
return disp;
}
static int
int
nv50_disp_oneinit_(struct nvkm_disp *base)
{
struct nv50_disp *disp = nv50_disp(base);
const struct nv50_disp_func *func = disp->func;
const struct nvkm_disp_func *func = disp->func;
struct nvkm_subdev *subdev = &disp->base.engine.subdev;
struct nvkm_device *device = subdev->device;
int ret, i;
......@@ -142,18 +136,8 @@ nv50_disp_oneinit_(struct nvkm_disp *base)
0x1000, 0, disp->inst, &disp->ramht);
}
static const struct nvkm_disp_func
nv50_disp_ = {
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.root = nv50_disp_root_,
};
int
nv50_disp_new_(const struct nv50_disp_func *func, struct nvkm_device *device,
nv50_disp_new_(const struct nvkm_disp_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_disp **pdisp)
{
struct nv50_disp *disp;
......@@ -164,7 +148,7 @@ nv50_disp_new_(const struct nv50_disp_func *func, struct nvkm_device *device,
disp->func = func;
*pdisp = &disp->base;
ret = nvkm_disp_ctor(&nv50_disp_, device, type, inst, &disp->base);
ret = nvkm_disp_ctor(func, device, type, inst, &disp->base);
if (ret)
return ret;
......@@ -754,11 +738,16 @@ nv50_disp_init(struct nv50_disp *disp)
return 0;
}
static const struct nv50_disp_func
static const struct nvkm_disp_func
nv50_disp = {
.init = nv50_disp_init,
.fini = nv50_disp_fini,
.intr = nv50_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = nv50_disp_init,
.fini_ = nv50_disp_fini,
.intr_ = nv50_disp_intr,
.uevent = &nv50_disp_chan_uevent,
.super = nv50_disp_super,
.root = &nv50_disp_root_oclass,
......
......@@ -8,7 +8,7 @@ struct nvkm_head;
#include <core/enum.h>
struct nv50_disp {
const struct nv50_disp_func *func;
const struct nvkm_disp_func *func;
struct nvkm_disp base;
struct workqueue_struct *wq;
......@@ -47,28 +47,9 @@ void nv50_disp_super_2_1(struct nv50_disp *, struct nvkm_head *);
void nv50_disp_super_2_2(struct nv50_disp *, struct nvkm_head *);
void nv50_disp_super_3_0(struct nv50_disp *, struct nvkm_head *);
int nv50_disp_new_(const struct nv50_disp_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
int nv50_disp_new_(const struct nvkm_disp_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
struct nvkm_disp **);
struct nv50_disp_func {
int (*init)(struct nv50_disp *);
void (*fini)(struct nv50_disp *);
void (*intr)(struct nv50_disp *);
void (*intr_error)(struct nv50_disp *, int chid);
const struct nvkm_event_func *uevent;
void (*super)(struct work_struct *);
const struct nvkm_disp_oclass *root;
struct {
int (*cnt)(struct nvkm_disp *, unsigned long *mask);
int (*new)(struct nvkm_disp *, int id);
} wndw, head, dac, sor, pior;
u16 ramht_size;
};
int nv50_disp_init(struct nv50_disp *);
void nv50_disp_fini(struct nv50_disp *);
void nv50_disp_intr(struct nv50_disp *);
......
......@@ -3,6 +3,7 @@
#define __NVKM_DISP_PRIV_H__
#include <engine/disp.h>
#include "outp.h"
struct nv50_disp;
int nvkm_disp_ctor(const struct nvkm_disp_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
struct nvkm_disp *);
......@@ -17,13 +18,34 @@ struct nvkm_disp_func {
void (*fini)(struct nvkm_disp *);
void (*intr)(struct nvkm_disp *);
const struct nvkm_disp_oclass *(*root)(struct nvkm_disp *);
const struct nvkm_disp_oclass *root;
int (*init_)(struct nv50_disp *);
void (*fini_)(struct nv50_disp *);
void (*intr_)(struct nv50_disp *);
void (*intr_error)(struct nv50_disp *, int chid);
const struct nvkm_event_func *uevent;
void (*super)(struct work_struct *);
struct {
int (*cnt)(struct nvkm_disp *, unsigned long *mask);
int (*new)(struct nvkm_disp *, int id);
} wndw, head, dac, sor, pior;
u16 ramht_size;
};
int nvkm_disp_ntfy(struct nvkm_object *, u32, struct nvkm_event **);
extern const struct nvkm_disp_oclass nv04_disp_root_oclass;
void *nv50_disp_dtor_(struct nvkm_disp *);
int nv50_disp_oneinit_(struct nvkm_disp *);
int nv50_disp_init_(struct nvkm_disp *);
void nv50_disp_fini_(struct nvkm_disp *);
void nv50_disp_intr_(struct nvkm_disp *);
struct nvkm_disp_oclass {
int (*ctor)(struct nvkm_disp *, const struct nvkm_oclass *,
void *data, u32 size, struct nvkm_object **);
......
......@@ -131,11 +131,16 @@ tu102_disp_init(struct nv50_disp *disp)
return 0;
}
static const struct nv50_disp_func
static const struct nvkm_disp_func
tu102_disp = {
.init = tu102_disp_init,
.fini = gv100_disp_fini,
.intr = gv100_disp_intr,
.dtor = nv50_disp_dtor_,
.oneinit = nv50_disp_oneinit_,
.init = nv50_disp_init_,
.fini = nv50_disp_fini_,
.intr = nv50_disp_intr_,
.init_ = tu102_disp_init,
.fini_ = gv100_disp_fini,
.intr_ = gv100_disp_intr,
.uevent = &gv100_disp_chan_uevent,
.super = gv100_disp_super,
.root = &tu102_disp_root_oclass,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment