|
@@ -31,30 +31,20 @@
|
|
|
#include <nvif/event.h>
|
|
|
#include <nvif/ioctl.h>
|
|
|
|
|
|
-/*******************************************************************************
|
|
|
- * software object classes
|
|
|
- ******************************************************************************/
|
|
|
-
|
|
|
-static struct nvkm_oclass
|
|
|
-nv50_sw_sclass[] = {
|
|
|
- { NVIF_IOCTL_NEW_V0_SW_NV50, &nvkm_nvsw_ofuncs },
|
|
|
- {}
|
|
|
-};
|
|
|
-
|
|
|
/*******************************************************************************
|
|
|
* software context
|
|
|
******************************************************************************/
|
|
|
|
|
|
static int
|
|
|
-nv50_sw_vblsem_release(struct nvkm_notify *notify)
|
|
|
+nv50_sw_chan_vblsem_release(struct nvkm_notify *notify)
|
|
|
{
|
|
|
struct nv50_sw_chan *chan =
|
|
|
container_of(notify, typeof(*chan), vblank.notify[notify->index]);
|
|
|
- struct nvkm_sw *sw = (void *)nv_object(chan)->engine;
|
|
|
+ struct nvkm_sw *sw = chan->base.sw;
|
|
|
struct nvkm_device *device = sw->engine.subdev.device;
|
|
|
struct nvkm_bar *bar = device->bar;
|
|
|
|
|
|
- nvkm_wr32(device, 0x001704, chan->vblank.channel);
|
|
|
+ nvkm_wr32(device, 0x001704, chan->base.fifo->inst->addr >> 12);
|
|
|
nvkm_wr32(device, 0x001710, 0x80000000 | chan->vblank.ctxdma);
|
|
|
bar->flush(bar);
|
|
|
|
|
@@ -73,7 +63,7 @@ static bool
|
|
|
nv50_sw_chan_mthd(struct nvkm_sw_chan *base, int subc, u32 mthd, u32 data)
|
|
|
{
|
|
|
struct nv50_sw_chan *chan = nv50_sw_chan(base);
|
|
|
- struct nvkm_engine *engine = chan->base.base.gpuobj.object.engine;
|
|
|
+ struct nvkm_engine *engine = chan->base.object.engine;
|
|
|
struct nvkm_device *device = engine->subdev.device;
|
|
|
switch (mthd) {
|
|
|
case 0x018c: chan->vblank.ctxdma = data; return true;
|
|
@@ -91,41 +81,41 @@ nv50_sw_chan_mthd(struct nvkm_sw_chan *base, int subc, u32 mthd, u32 data)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-static const struct nvkm_sw_chan_func
|
|
|
-nv50_sw_chan_func = {
|
|
|
- .mthd = nv50_sw_chan_mthd,
|
|
|
-};
|
|
|
-
|
|
|
-void
|
|
|
-nv50_sw_context_dtor(struct nvkm_object *object)
|
|
|
+void *
|
|
|
+nv50_sw_chan_dtor(struct nvkm_sw_chan *base)
|
|
|
{
|
|
|
- struct nv50_sw_chan *chan = (void *)object;
|
|
|
+ struct nv50_sw_chan *chan = nv50_sw_chan(base);
|
|
|
int i;
|
|
|
-
|
|
|
for (i = 0; i < ARRAY_SIZE(chan->vblank.notify); i++)
|
|
|
nvkm_notify_fini(&chan->vblank.notify[i]);
|
|
|
-
|
|
|
- nvkm_sw_chan_dtor(&chan->base.base.gpuobj.object);
|
|
|
+ return chan;
|
|
|
}
|
|
|
|
|
|
-int
|
|
|
-nv50_sw_context_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
|
|
|
- struct nvkm_oclass *oclass, void *data, u32 size,
|
|
|
- struct nvkm_object **pobject)
|
|
|
+static const struct nvkm_sw_chan_func
|
|
|
+nv50_sw_chan = {
|
|
|
+ .dtor = nv50_sw_chan_dtor,
|
|
|
+ .mthd = nv50_sw_chan_mthd,
|
|
|
+};
|
|
|
+
|
|
|
+static int
|
|
|
+nv50_sw_chan_new(struct nvkm_sw *sw, struct nvkm_fifo_chan *fifoch,
|
|
|
+ const struct nvkm_oclass *oclass, struct nvkm_object **pobject)
|
|
|
{
|
|
|
- struct nvkm_disp *disp = parent->engine->subdev.device->disp;
|
|
|
- struct nv50_sw_cclass *pclass = (void *)oclass;
|
|
|
+ struct nvkm_disp *disp = sw->engine.subdev.device->disp;
|
|
|
struct nv50_sw_chan *chan;
|
|
|
int ret, i;
|
|
|
|
|
|
- ret = nvkm_sw_context_create(pclass->chan, parent, engine, oclass, &chan);
|
|
|
- *pobject = nv_object(chan);
|
|
|
+ if (!(chan = kzalloc(sizeof(*chan), GFP_KERNEL)))
|
|
|
+ return -ENOMEM;
|
|
|
+ *pobject = &chan->base.object;
|
|
|
+
|
|
|
+ ret = nvkm_sw_chan_ctor(&nv50_sw_chan, sw, fifoch, oclass, &chan->base);
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
|
|
|
for (i = 0; disp && i < disp->vblank.index_nr; i++) {
|
|
|
- ret = nvkm_notify_init(NULL, &disp->vblank, pclass->vblank,
|
|
|
- false,
|
|
|
+ ret = nvkm_notify_init(NULL, &disp->vblank,
|
|
|
+ nv50_sw_chan_vblsem_release, false,
|
|
|
&(struct nvif_notify_head_req_v0) {
|
|
|
.head = i,
|
|
|
},
|
|
@@ -136,23 +126,9 @@ nv50_sw_context_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
- chan->vblank.channel = nvkm_fifo_chan(parent)->inst->addr >> 12;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static struct nv50_sw_cclass
|
|
|
-nv50_sw_cclass = {
|
|
|
- .base.handle = NV_ENGCTX(SW, 0x50),
|
|
|
- .base.ofuncs = &(struct nvkm_ofuncs) {
|
|
|
- .ctor = nv50_sw_context_ctor,
|
|
|
- .dtor = nv50_sw_context_dtor,
|
|
|
- .init = _nvkm_sw_context_init,
|
|
|
- .fini = _nvkm_sw_context_fini,
|
|
|
- },
|
|
|
- .vblank = nv50_sw_vblsem_release,
|
|
|
- .chan = &nv50_sw_chan_func,
|
|
|
-};
|
|
|
-
|
|
|
/*******************************************************************************
|
|
|
* software engine/subdev functions
|
|
|
******************************************************************************/
|
|
@@ -171,12 +147,20 @@ nv50_sw_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
|
|
|
- nv_engine(sw)->cclass = pclass->cclass;
|
|
|
- nv_engine(sw)->sclass = pclass->sclass;
|
|
|
+ sw->func = pclass->func;
|
|
|
nv_subdev(sw)->intr = nv04_sw_intr;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static const struct nvkm_sw_func
|
|
|
+nv50_sw_func = {
|
|
|
+ .chan_new = nv50_sw_chan_new,
|
|
|
+ .sclass = {
|
|
|
+ { nvkm_nvsw_new, { -1, -1, NVIF_IOCTL_NEW_V0_SW_NV50 } },
|
|
|
+ {}
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
struct nvkm_oclass *
|
|
|
nv50_sw_oclass = &(struct nv50_sw_oclass) {
|
|
|
.base.handle = NV_ENGINE(SW, 0x50),
|
|
@@ -186,6 +170,5 @@ nv50_sw_oclass = &(struct nv50_sw_oclass) {
|
|
|
.init = _nvkm_sw_init,
|
|
|
.fini = _nvkm_sw_fini,
|
|
|
},
|
|
|
- .cclass = &nv50_sw_cclass.base,
|
|
|
- .sclass = nv50_sw_sclass,
|
|
|
+ .func = &nv50_sw_func,
|
|
|
}.base;
|