drm/nouveau/disp/nv50-: delay subunit construction until oneinit
We should be reading registers to determine which subunits are really present on a given board, and this needs to be done after DEVINIT. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
85a3b9c839
commit
3b9ba66ab0
@ -376,6 +376,12 @@ nvkm_disp_oneinit(struct nvkm_engine *engine)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (disp->func->oneinit) {
|
||||
ret = disp->func->oneinit(disp);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
list_for_each_entry(head, &disp->head, head)
|
||||
i = max(i, head->id + 1);
|
||||
|
@ -59,35 +59,14 @@ nv50_disp_dtor_(struct nvkm_disp *base)
|
||||
return disp;
|
||||
}
|
||||
|
||||
static const struct nvkm_disp_func
|
||||
nv50_disp_ = {
|
||||
.dtor = nv50_disp_dtor_,
|
||||
.intr = nv50_disp_intr_,
|
||||
.root = nv50_disp_root_,
|
||||
};
|
||||
|
||||
int
|
||||
nv50_disp_new_(const struct nv50_disp_func *func, struct nvkm_device *device,
|
||||
int index, int heads, struct nvkm_disp **pdisp)
|
||||
static int
|
||||
nv50_disp_oneinit_(struct nvkm_disp *base)
|
||||
{
|
||||
struct nv50_disp *disp;
|
||||
struct nv50_disp *disp = nv50_disp(base);
|
||||
const struct nv50_disp_func *func = disp->func;
|
||||
int ret, i;
|
||||
|
||||
if (!(disp = kzalloc(sizeof(*disp), GFP_KERNEL)))
|
||||
return -ENOMEM;
|
||||
disp->func = func;
|
||||
*pdisp = &disp->base;
|
||||
|
||||
ret = nvkm_disp_ctor(&nv50_disp_, device, index, &disp->base);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
disp->wq = create_singlethread_workqueue("nvkm-disp");
|
||||
if (!disp->wq)
|
||||
return -ENOMEM;
|
||||
INIT_WORK(&disp->supervisor, func->super);
|
||||
|
||||
for (i = 0; func->head.new && i < heads; i++) {
|
||||
for (i = 0; func->head.new && i < disp->head.nr; i++) {
|
||||
ret = func->head.new(&disp->base, i);
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -111,7 +90,42 @@ nv50_disp_new_(const struct nv50_disp_func *func, struct nvkm_device *device,
|
||||
return ret;
|
||||
}
|
||||
|
||||
return nvkm_event_init(func->uevent, 1, 1 + (heads * 4), &disp->uevent);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct nvkm_disp_func
|
||||
nv50_disp_ = {
|
||||
.dtor = nv50_disp_dtor_,
|
||||
.oneinit = nv50_disp_oneinit_,
|
||||
.intr = nv50_disp_intr_,
|
||||
.root = nv50_disp_root_,
|
||||
};
|
||||
|
||||
int
|
||||
nv50_disp_new_(const struct nv50_disp_func *func, struct nvkm_device *device,
|
||||
int index, int heads, struct nvkm_disp **pdisp)
|
||||
{
|
||||
struct nv50_disp *disp;
|
||||
int ret;
|
||||
|
||||
if (!(disp = kzalloc(sizeof(*disp), GFP_KERNEL)))
|
||||
return -ENOMEM;
|
||||
disp->func = func;
|
||||
*pdisp = &disp->base;
|
||||
|
||||
ret = nvkm_disp_ctor(&nv50_disp_, device, index, &disp->base);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
disp->wq = create_singlethread_workqueue("nvkm-disp");
|
||||
if (!disp->wq)
|
||||
return -ENOMEM;
|
||||
|
||||
INIT_WORK(&disp->supervisor, func->super);
|
||||
disp->head.nr = heads;
|
||||
|
||||
return nvkm_event_init(func->uevent, 1, ARRAY_SIZE(disp->chan),
|
||||
&disp->uevent);
|
||||
}
|
||||
|
||||
static u32
|
||||
|
@ -15,6 +15,10 @@ struct nv50_disp {
|
||||
|
||||
struct nvkm_event uevent;
|
||||
|
||||
struct {
|
||||
int nr;
|
||||
} head;
|
||||
|
||||
struct {
|
||||
u32 lvdsconf;
|
||||
} sor;
|
||||
|
@ -12,6 +12,7 @@ void nvkm_disp_vblank(struct nvkm_disp *, int head);
|
||||
|
||||
struct nvkm_disp_func {
|
||||
void *(*dtor)(struct nvkm_disp *);
|
||||
int (*oneinit)(struct nvkm_disp *);
|
||||
void (*intr)(struct nvkm_disp *);
|
||||
|
||||
const struct nvkm_disp_oclass *(*root)(struct nvkm_disp *);
|
||||
|
Loading…
x
Reference in New Issue
Block a user