|
@@ -21,117 +21,16 @@
|
|
|
*
|
|
|
* Authors: Ben Skeggs
|
|
|
*/
|
|
|
-#include "dmacnv50.h"
|
|
|
-#include "rootnv50.h"
|
|
|
+#include "channv50.h"
|
|
|
|
|
|
#include <core/client.h>
|
|
|
-#include <core/oproxy.h>
|
|
|
#include <core/ramht.h>
|
|
|
#include <subdev/fb.h>
|
|
|
#include <subdev/timer.h>
|
|
|
#include <engine/dma.h>
|
|
|
|
|
|
-struct nv50_disp_dmac_object {
|
|
|
- struct nvkm_oproxy oproxy;
|
|
|
- struct nv50_disp *disp;
|
|
|
- int hash;
|
|
|
-};
|
|
|
-
|
|
|
-static void
|
|
|
-nv50_disp_dmac_child_del_(struct nvkm_oproxy *base)
|
|
|
-{
|
|
|
- struct nv50_disp_dmac_object *object =
|
|
|
- container_of(base, typeof(*object), oproxy);
|
|
|
- nvkm_ramht_remove(object->disp->ramht, object->hash);
|
|
|
-}
|
|
|
-
|
|
|
-static const struct nvkm_oproxy_func
|
|
|
-nv50_disp_dmac_child_func_ = {
|
|
|
- .dtor[0] = nv50_disp_dmac_child_del_,
|
|
|
-};
|
|
|
-
|
|
|
-static int
|
|
|
-nv50_disp_dmac_child_new_(struct nv50_disp_chan *base,
|
|
|
- const struct nvkm_oclass *oclass,
|
|
|
- void *data, u32 size, struct nvkm_object **pobject)
|
|
|
-{
|
|
|
- struct nv50_disp_dmac *chan = nv50_disp_dmac(base);
|
|
|
- struct nv50_disp *disp = chan->base.disp;
|
|
|
- struct nvkm_device *device = disp->base.engine.subdev.device;
|
|
|
- const struct nvkm_device_oclass *sclass = oclass->priv;
|
|
|
- struct nv50_disp_dmac_object *object;
|
|
|
- int ret;
|
|
|
-
|
|
|
- if (!(object = kzalloc(sizeof(*object), GFP_KERNEL)))
|
|
|
- return -ENOMEM;
|
|
|
- nvkm_oproxy_ctor(&nv50_disp_dmac_child_func_, oclass, &object->oproxy);
|
|
|
- object->disp = disp;
|
|
|
- *pobject = &object->oproxy.base;
|
|
|
-
|
|
|
- ret = sclass->ctor(device, oclass, data, size, &object->oproxy.object);
|
|
|
- if (ret)
|
|
|
- return ret;
|
|
|
-
|
|
|
- object->hash = chan->func->bind(chan, object->oproxy.object,
|
|
|
- oclass->handle);
|
|
|
- if (object->hash < 0)
|
|
|
- return object->hash;
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-static int
|
|
|
-nv50_disp_dmac_child_get_(struct nv50_disp_chan *base, int index,
|
|
|
- struct nvkm_oclass *sclass)
|
|
|
-{
|
|
|
- struct nv50_disp_dmac *chan = nv50_disp_dmac(base);
|
|
|
- struct nv50_disp *disp = chan->base.disp;
|
|
|
- struct nvkm_device *device = disp->base.engine.subdev.device;
|
|
|
- const struct nvkm_device_oclass *oclass = NULL;
|
|
|
-
|
|
|
- sclass->engine = nvkm_device_engine(device, NVKM_ENGINE_DMAOBJ);
|
|
|
- if (sclass->engine && sclass->engine->func->base.sclass) {
|
|
|
- sclass->engine->func->base.sclass(sclass, index, &oclass);
|
|
|
- if (oclass) {
|
|
|
- sclass->priv = oclass;
|
|
|
- return 0;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return -EINVAL;
|
|
|
-}
|
|
|
-
|
|
|
-static void
|
|
|
-nv50_disp_dmac_fini_(struct nv50_disp_chan *base)
|
|
|
-{
|
|
|
- struct nv50_disp_dmac *chan = nv50_disp_dmac(base);
|
|
|
- chan->func->fini(chan);
|
|
|
-}
|
|
|
-
|
|
|
-static int
|
|
|
-nv50_disp_dmac_init_(struct nv50_disp_chan *base)
|
|
|
-{
|
|
|
- struct nv50_disp_dmac *chan = nv50_disp_dmac(base);
|
|
|
- return chan->func->init(chan);
|
|
|
-}
|
|
|
-
|
|
|
-static void *
|
|
|
-nv50_disp_dmac_dtor_(struct nv50_disp_chan *base)
|
|
|
-{
|
|
|
- return nv50_disp_dmac(base);
|
|
|
-}
|
|
|
-
|
|
|
-static const struct nv50_disp_chan_func
|
|
|
-nv50_disp_dmac_func_ = {
|
|
|
- .dtor = nv50_disp_dmac_dtor_,
|
|
|
- .init = nv50_disp_dmac_init_,
|
|
|
- .fini = nv50_disp_dmac_fini_,
|
|
|
- .child_get = nv50_disp_dmac_child_get_,
|
|
|
- .child_new = nv50_disp_dmac_child_new_,
|
|
|
-};
|
|
|
-
|
|
|
int
|
|
|
-nv50_disp_dmac_new_(const struct nv50_disp_dmac_func *func,
|
|
|
+nv50_disp_dmac_new_(const struct nv50_disp_chan_func *func,
|
|
|
const struct nv50_disp_chan_mthd *mthd,
|
|
|
struct nv50_disp *disp, int chid, int head, u64 push,
|
|
|
const struct nvkm_oclass *oclass,
|
|
@@ -139,16 +38,12 @@ nv50_disp_dmac_new_(const struct nv50_disp_dmac_func *func,
|
|
|
{
|
|
|
struct nvkm_client *client = oclass->client;
|
|
|
struct nvkm_dmaobj *dmaobj;
|
|
|
- struct nv50_disp_dmac *chan;
|
|
|
+ struct nv50_disp_chan *chan;
|
|
|
int ret;
|
|
|
|
|
|
- if (!(chan = kzalloc(sizeof(*chan), GFP_KERNEL)))
|
|
|
- return -ENOMEM;
|
|
|
- *pobject = &chan->base.object;
|
|
|
- chan->func = func;
|
|
|
-
|
|
|
- ret = nv50_disp_chan_ctor(&nv50_disp_dmac_func_, mthd, disp,
|
|
|
- chid, chid, head, oclass, &chan->base);
|
|
|
+ ret = nv50_disp_chan_new_(func, mthd, disp, chid, chid, head, oclass,
|
|
|
+ pobject);
|
|
|
+ chan = nv50_disp_chan(*pobject);
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
|
|
@@ -174,23 +69,22 @@ nv50_disp_dmac_new_(const struct nv50_disp_dmac_func *func,
|
|
|
}
|
|
|
|
|
|
int
|
|
|
-nv50_disp_dmac_bind(struct nv50_disp_dmac *chan,
|
|
|
+nv50_disp_dmac_bind(struct nv50_disp_chan *chan,
|
|
|
struct nvkm_object *object, u32 handle)
|
|
|
{
|
|
|
- return nvkm_ramht_insert(chan->base.disp->ramht, object,
|
|
|
- chan->base.chid.user, -10, handle,
|
|
|
- chan->base.chid.user << 28 |
|
|
|
- chan->base.chid.user);
|
|
|
+ return nvkm_ramht_insert(chan->disp->ramht, object,
|
|
|
+ chan->chid.user, -10, handle,
|
|
|
+ chan->chid.user << 28 |
|
|
|
+ chan->chid.user);
|
|
|
}
|
|
|
|
|
|
static void
|
|
|
-nv50_disp_dmac_fini(struct nv50_disp_dmac *chan)
|
|
|
+nv50_disp_dmac_fini(struct nv50_disp_chan *chan)
|
|
|
{
|
|
|
- struct nv50_disp *disp = chan->base.disp;
|
|
|
- struct nvkm_subdev *subdev = &disp->base.engine.subdev;
|
|
|
+ struct nvkm_subdev *subdev = &chan->disp->base.engine.subdev;
|
|
|
struct nvkm_device *device = subdev->device;
|
|
|
- int ctrl = chan->base.chid.ctrl;
|
|
|
- int user = chan->base.chid.user;
|
|
|
+ int ctrl = chan->chid.ctrl;
|
|
|
+ int user = chan->chid.user;
|
|
|
|
|
|
/* deactivate channel */
|
|
|
nvkm_mask(device, 0x610200 + (ctrl * 0x0010), 0x00001010, 0x00001000);
|
|
@@ -208,13 +102,12 @@ nv50_disp_dmac_fini(struct nv50_disp_dmac *chan)
|
|
|
}
|
|
|
|
|
|
static int
|
|
|
-nv50_disp_dmac_init(struct nv50_disp_dmac *chan)
|
|
|
+nv50_disp_dmac_init(struct nv50_disp_chan *chan)
|
|
|
{
|
|
|
- struct nv50_disp *disp = chan->base.disp;
|
|
|
- struct nvkm_subdev *subdev = &disp->base.engine.subdev;
|
|
|
+ struct nvkm_subdev *subdev = &chan->disp->base.engine.subdev;
|
|
|
struct nvkm_device *device = subdev->device;
|
|
|
- int ctrl = chan->base.chid.ctrl;
|
|
|
- int user = chan->base.chid.user;
|
|
|
+ int ctrl = chan->chid.ctrl;
|
|
|
+ int user = chan->chid.user;
|
|
|
|
|
|
/* enable error reporting */
|
|
|
nvkm_mask(device, 0x610028, 0x00010000 << user, 0x00010000 << user);
|
|
@@ -240,7 +133,7 @@ nv50_disp_dmac_init(struct nv50_disp_dmac *chan)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-const struct nv50_disp_dmac_func
|
|
|
+const struct nv50_disp_chan_func
|
|
|
nv50_disp_dmac_func = {
|
|
|
.init = nv50_disp_dmac_init,
|
|
|
.fini = nv50_disp_dmac_fini,
|