Commit a7f000ec authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/disp: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 0b26ca68
......@@ -60,7 +60,6 @@ struct nvkm_device {
struct notifier_block nb;
} acpi;
struct nvkm_disp *disp;
struct nvkm_dma *dma;
struct nvkm_fifo *fifo;
struct nvkm_gr *gr;
......@@ -119,7 +118,6 @@ struct nvkm_device_chip {
#undef NVKM_LAYOUT_INST
#undef NVKM_LAYOUT_ONCE
int (*disp )(struct nvkm_device *, int idx, struct nvkm_disp **);
int (*dma )(struct nvkm_device *, int idx, struct nvkm_dma **);
int (*fifo )(struct nvkm_device *, int idx, struct nvkm_fifo **);
int (*gr )(struct nvkm_device *, int idx, struct nvkm_gr **);
......
......@@ -28,4 +28,5 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GSP , struct nvkm_gsp , gsp)
NVKM_LAYOUT_ONCE(NVKM_ENGINE_BSP , struct nvkm_engine , bsp)
NVKM_LAYOUT_INST(NVKM_ENGINE_CE , struct nvkm_engine , ce, 9)
NVKM_LAYOUT_ONCE(NVKM_ENGINE_CIPHER , struct nvkm_engine , cipher)
NVKM_LAYOUT_ONCE(NVKM_ENGINE_DISP , struct nvkm_disp , disp)
NVKM_LAYOUT_ONCE(NVKM_ENGINE_VP , struct nvkm_engine , vp)
......@@ -23,22 +23,22 @@ struct nvkm_disp {
} client;
};
int nv04_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int nv50_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int g84_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int gt200_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int g94_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int mcp77_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int gt215_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int mcp89_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int gf119_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int gk104_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int gk110_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int gm107_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int gm200_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int gp100_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int gp102_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int gv100_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int tu102_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int ga102_disp_new(struct nvkm_device *, int, struct nvkm_disp **);
int nv04_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int nv50_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int g84_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int gt200_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int g94_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int mcp77_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int gt215_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int mcp89_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int gf119_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int gk104_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int gk110_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int gm107_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int gm200_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int gp100_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int gp102_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int gv100_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int tu102_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
int ga102_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **);
#endif
......@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
#include <core/layout.h>
#undef NVKM_LAYOUT_ONCE
#undef NVKM_LAYOUT_INST
[NVKM_ENGINE_DISP ] = "disp",
[NVKM_ENGINE_DMAOBJ ] = "dma",
[NVKM_ENGINE_FIFO ] = "fifo",
[NVKM_ENGINE_GR ] = "gr",
......
......@@ -473,7 +473,7 @@ nvkm_disp = {
int
nvkm_disp_ctor(const struct nvkm_disp_func *func, struct nvkm_device *device,
int index, struct nvkm_disp *disp)
enum nvkm_subdev_type type, int inst, struct nvkm_disp *disp)
{
disp->func = func;
INIT_LIST_HEAD(&disp->head);
......@@ -481,14 +481,14 @@ nvkm_disp_ctor(const struct nvkm_disp_func *func, struct nvkm_device *device,
INIT_LIST_HEAD(&disp->outp);
INIT_LIST_HEAD(&disp->conn);
spin_lock_init(&disp->client.lock);
return nvkm_engine_ctor(&nvkm_disp, device, index, true, &disp->engine);
return nvkm_engine_ctor(&nvkm_disp, device, type, inst, true, &disp->engine);
}
int
nvkm_disp_new_(const struct nvkm_disp_func *func, struct nvkm_device *device,
int index, struct nvkm_disp **pdisp)
enum nvkm_subdev_type type, int inst, struct nvkm_disp **pdisp)
{
if (!(*pdisp = kzalloc(sizeof(**pdisp), GFP_KERNEL)))
return -ENOMEM;
return nvkm_disp_ctor(func, device, index, *pdisp);
return nvkm_disp_ctor(func, device, type, inst, *pdisp);
}
......@@ -41,7 +41,8 @@ g84_disp = {
};
int
g84_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
g84_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&g84_disp, device, index, pdisp);
return nv50_disp_new_(&g84_disp, device, type, inst, pdisp);
}
......@@ -41,7 +41,8 @@ g94_disp = {
};
int
g94_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
g94_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&g94_disp, device, index, pdisp);
return nv50_disp_new_(&g94_disp, device, type, inst, pdisp);
}
......@@ -40,7 +40,8 @@ ga102_disp = {
};
int
ga102_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
ga102_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&ga102_disp, device, index, pdisp);
return nv50_disp_new_(&ga102_disp, device, type, inst, pdisp);
}
......@@ -266,7 +266,8 @@ gf119_disp = {
};
int
gf119_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
gf119_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&gf119_disp, device, index, pdisp);
return nv50_disp_new_(&gf119_disp, device, type, inst, pdisp);
}
......@@ -41,7 +41,8 @@ gk104_disp = {
};
int
gk104_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
gk104_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&gk104_disp, device, index, pdisp);
return nv50_disp_new_(&gk104_disp, device, type, inst, pdisp);
}
......@@ -41,7 +41,8 @@ gk110_disp = {
};
int
gk110_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
gk110_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&gk110_disp, device, index, pdisp);
return nv50_disp_new_(&gk110_disp, device, type, inst, pdisp);
}
......@@ -41,7 +41,8 @@ gm107_disp = {
};
int
gm107_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
gm107_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&gm107_disp, device, index, pdisp);
return nv50_disp_new_(&gm107_disp, device, type, inst, pdisp);
}
......@@ -41,7 +41,8 @@ gm200_disp = {
};
int
gm200_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
gm200_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&gm200_disp, device, index, pdisp);
return nv50_disp_new_(&gm200_disp, device, type, inst, pdisp);
}
......@@ -40,7 +40,8 @@ gp100_disp = {
};
int
gp100_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
gp100_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&gp100_disp, device, index, pdisp);
return nv50_disp_new_(&gp100_disp, device, type, inst, pdisp);
}
......@@ -67,7 +67,8 @@ gp102_disp = {
};
int
gp102_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
gp102_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&gp102_disp, device, index, pdisp);
return nv50_disp_new_(&gp102_disp, device, type, inst, pdisp);
}
......@@ -41,7 +41,8 @@ gt200_disp = {
};
int
gt200_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
gt200_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&gt200_disp, device, index, pdisp);
return nv50_disp_new_(&gt200_disp, device, type, inst, pdisp);
}
......@@ -41,7 +41,8 @@ gt215_disp = {
};
int
gt215_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
gt215_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&gt215_disp, device, index, pdisp);
return nv50_disp_new_(&gt215_disp, device, type, inst, pdisp);
}
......@@ -441,7 +441,8 @@ gv100_disp = {
};
int
gv100_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
gv100_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&gv100_disp, device, index, pdisp);
return nv50_disp_new_(&gv100_disp, device, type, inst, pdisp);
}
......@@ -39,7 +39,8 @@ mcp77_disp = {
};
int
mcp77_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
mcp77_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&mcp77_disp, device, index, pdisp);
return nv50_disp_new_(&mcp77_disp, device, type, inst, pdisp);
}
......@@ -39,7 +39,8 @@ mcp89_disp = {
};
int
mcp89_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
mcp89_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&mcp89_disp, device, index, pdisp);
return nv50_disp_new_(&mcp89_disp, device, type, inst, pdisp);
}
......@@ -64,11 +64,12 @@ nv04_disp = {
};
int
nv04_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
nv04_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
int ret, i;
ret = nvkm_disp_new_(&nv04_disp, device, index, pdisp);
ret = nvkm_disp_new_(&nv04_disp, device, type, inst, pdisp);
if (ret)
return ret;
......
......@@ -154,7 +154,7 @@ nv50_disp_ = {
int
nv50_disp_new_(const struct nv50_disp_func *func, struct nvkm_device *device,
int index, struct nvkm_disp **pdisp)
enum nvkm_subdev_type type, int inst, struct nvkm_disp **pdisp)
{
struct nv50_disp *disp;
int ret;
......@@ -164,7 +164,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, index, &disp->base);
ret = nvkm_disp_ctor(&nv50_disp_, device, type, inst, &disp->base);
if (ret)
return ret;
......@@ -769,7 +769,8 @@ nv50_disp = {
};
int
nv50_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
nv50_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&nv50_disp, device, index, pdisp);
return nv50_disp_new_(&nv50_disp, device, type, inst, pdisp);
}
......@@ -47,8 +47,8 @@ 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 *,
int index, struct nvkm_disp **);
int nv50_disp_new_(const struct nv50_disp_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
struct nvkm_disp **);
struct nv50_disp_func {
int (*init)(struct nv50_disp *);
......
......@@ -4,10 +4,10 @@
#include <engine/disp.h>
#include "outp.h"
int nvkm_disp_ctor(const struct nvkm_disp_func *, struct nvkm_device *,
int index, struct nvkm_disp *);
int nvkm_disp_new_(const struct nvkm_disp_func *, struct nvkm_device *,
int index, struct nvkm_disp **);
int nvkm_disp_ctor(const struct nvkm_disp_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
struct nvkm_disp *);
int nvkm_disp_new_(const struct nvkm_disp_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
struct nvkm_disp **);
void nvkm_disp_vblank(struct nvkm_disp *, int head);
struct nvkm_disp_func {
......
......@@ -146,7 +146,8 @@ tu102_disp = {
};
int
tu102_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
tu102_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_disp **pdisp)
{
return nv50_disp_new_(&tu102_disp, device, index, pdisp);
return nv50_disp_new_(&tu102_disp, device, type, inst, pdisp);
}
......@@ -42,7 +42,7 @@ g84_devinit_disable(struct nvkm_devinit *init)
}
if (!(r00154c & 0x00000004))
disable |= (1ULL << NVKM_ENGINE_DISP);
nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
if (!(r00154c & 0x00000020))
nvkm_subdev_disable(device, NVKM_ENGINE_BSP, 0);
if (!(r00154c & 0x00000040))
......
......@@ -41,7 +41,7 @@ g98_devinit_disable(struct nvkm_devinit *init)
}
if (!(r00154c & 0x00000004))
disable |= (1ULL << NVKM_ENGINE_DISP);
nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
if (!(r00154c & 0x00000020))
disable |= (1ULL << NVKM_ENGINE_MSVLD);
if (!(r00154c & 0x00000040))
......
......@@ -71,7 +71,7 @@ gf100_devinit_disable(struct nvkm_devinit *init)
u64 disable = 0ULL;
if (r022500 & 0x00000001)
disable |= (1ULL << NVKM_ENGINE_DISP);
nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
if (r022500 & 0x00000002) {
disable |= (1ULL << NVKM_ENGINE_MSPDEC);
......
......@@ -39,7 +39,7 @@ gm107_devinit_disable(struct nvkm_devinit *init)
if (r021c00 & 0x00000004)
nvkm_subdev_disable(device, NVKM_ENGINE_CE, 2);
if (r021c04 & 0x00000001)
disable |= (1ULL << NVKM_ENGINE_DISP);
nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
return disable;
}
......
......@@ -76,7 +76,7 @@ gt215_devinit_disable(struct nvkm_devinit *init)
}
if (!(r00154c & 0x00000004))
disable |= (1ULL << NVKM_ENGINE_DISP);
nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
if (!(r00154c & 0x00000020))
disable |= (1ULL << NVKM_ENGINE_MSVLD);
if (!(r00154c & 0x00000200))
......
......@@ -40,7 +40,7 @@ mcp89_devinit_disable(struct nvkm_devinit *init)
}
if (!(r00154c & 0x00000004))
disable |= (1ULL << NVKM_ENGINE_DISP);
nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
if (!(r00154c & 0x00000020))
disable |= (1ULL << NVKM_ENGINE_MSVLD);
if (!(r00154c & 0x00000040))
......
......@@ -101,8 +101,8 @@ nv50_devinit_preinit(struct nvkm_devinit *base)
* missing, assume it's a secondary gpu which requires post
*/
if (!base->post) {
u64 disable = nvkm_devinit_disable(base);
if (disable & (1ULL << NVKM_ENGINE_DISP))
nvkm_devinit_disable(base);
if (!device->disp)
base->post = true;
}
......
......@@ -260,7 +260,7 @@ gk104_ram_calc_gddr5(struct gk104_ram *ram, u32 freq)
ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000);
ram_block(fuc);
if (nvkm_device_engine(ram->base.fb->subdev.device, NVKM_ENGINE_DISP, 0))
if (ram->base.fb->subdev.device->disp)
ram_wr32(fuc, 0x62c000, 0x0f0f0000);
/* MR1: turn termination on early, for some reason.. */
......@@ -661,7 +661,7 @@ gk104_ram_calc_gddr5(struct gk104_ram *ram, u32 freq)
ram_unblock(fuc);
if (nvkm_device_engine(ram->base.fb->subdev.device, NVKM_ENGINE_DISP, 0))
if (ram->base.fb->subdev.device->disp)
ram_wr32(fuc, 0x62c000, 0x0f0f0f00);
if (next->bios.rammap_11_08_01)
......@@ -711,7 +711,7 @@ gk104_ram_calc_sddr3(struct gk104_ram *ram, u32 freq)
ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000);
ram_block(fuc);
if (nvkm_device_engine(ram->base.fb->subdev.device, NVKM_ENGINE_DISP, 0))
if (ram->base.fb->subdev.device->disp)
ram_wr32(fuc, 0x62c000, 0x0f0f0000);
if (vc == 1 && ram_have(fuc, gpio2E)) {
......@@ -943,7 +943,7 @@ gk104_ram_calc_sddr3(struct gk104_ram *ram, u32 freq)
ram_unblock(fuc);
if (nvkm_device_engine(ram->base.fb->subdev.device, NVKM_ENGINE_DISP, 0))
if (ram->base.fb->subdev.device->disp)
ram_wr32(fuc, 0x62c000, 0x0f0f0f00);
if (next->bios.rammap_11_08_01)
......
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