drm/nouveau/disp/nv50-: merge handling of pio and dma channels
authorBen Skeggs <bskeggs@redhat.com>
Tue, 8 May 2018 10:39:46 +0000 (20:39 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 18 May 2018 05:01:21 +0000 (15:01 +1000)
Unnecessarily complicated, and a barrier to cleanly supporting Volta.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
38 files changed:
drivers/gpu/drm/nouveau/nvkm/engine/disp/baseg84.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/basegf119.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/basegp102.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/basenv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.h
drivers/gpu/drm/nouveau/nvkm/engine/disp/coreg84.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/coreg94.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/coregf119.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/coregk104.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/coregp102.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/corenv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacgf119.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacgp102.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacnv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacnv50.h [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gp102.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h
drivers/gpu/drm/nouveau/nvkm/engine/disp/ovlyg84.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/ovlygf119.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/ovlygk104.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/ovlygp102.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/ovlygt200.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/ovlynv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootg84.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootg94.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgf119.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgk104.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgk110.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgm107.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgm200.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgp100.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgp102.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgt200.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootgt215.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h

index 03ec508d19f05c0e70a8194855363469ec210c53..01253f4a99467ad732019e48c19da6c974317478 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 static const struct nv50_disp_mthd_list
 g84_disp_base_mthd_base = {
index 4c372dc6a1286722be1b5e431884c6871df0239b..389e19dfc514198a50092e6b375ef918f5035571 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 static const struct nv50_disp_mthd_list
 gf119_disp_base_mthd_base = {
index 3a25259de0574287990e59697afa0c09aca89ecf..0cb23d673aa0cd30ec25be033b6a1eda46187cea 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs <bskeggs@redhat.com>
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 int
 gp102_disp_base_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
index 11639e2a792f4ad5e19f7e108de19448a7dd299e..19eb7dde01f2efb6de3b0705f2c1c5c4236cf2a5 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 #include "head.h"
 
 #include <core/client.h>
@@ -30,7 +30,7 @@
 #include <nvif/unpack.h>
 
 int
-nv50_disp_base_new_(const struct nv50_disp_dmac_func *func,
+nv50_disp_base_new_(const struct nv50_disp_chan_func *func,
                    const struct nv50_disp_chan_mthd *mthd,
                    struct nv50_disp *disp, int chid,
                    const struct nvkm_oclass *oclass, void *argv, u32 argc,
index 96b732d4b9abd9d2d505c79fe0fd672ff0721263..91a2f0c64731e7ea3b8d3b5eba74f9baa0d31f97 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <core/client.h>
 #include <core/notify.h>
+#include <core/oproxy.h>
 #include <core/ramht.h>
 #include <engine/dma.h>
 
@@ -204,25 +205,76 @@ nv50_disp_chan_map(struct nvkm_object *object, void *argv, u32 argc,
        return 0;
 }
 
+struct nv50_disp_chan_object {
+       struct nvkm_oproxy oproxy;
+       struct nv50_disp *disp;
+       int hash;
+};
+
+static void
+nv50_disp_chan_child_del_(struct nvkm_oproxy *base)
+{
+       struct nv50_disp_chan_object *object =
+               container_of(base, typeof(*object), oproxy);
+       nvkm_ramht_remove(object->disp->ramht, object->hash);
+}
+
+static const struct nvkm_oproxy_func
+nv50_disp_chan_child_func_ = {
+       .dtor[0] = nv50_disp_chan_child_del_,
+};
+
 static int
 nv50_disp_chan_child_new(const struct nvkm_oclass *oclass,
-                        void *data, u32 size, struct nvkm_object **pobject)
+                        void *argv, u32 argc, struct nvkm_object **pobject)
 {
        struct nv50_disp_chan *chan = nv50_disp_chan(oclass->parent);
-       return chan->func->child_new(chan, oclass, data, size, pobject);
+       struct nv50_disp *disp = chan->disp;
+       struct nvkm_device *device = disp->base.engine.subdev.device;
+       const struct nvkm_device_oclass *sclass = oclass->priv;
+       struct nv50_disp_chan_object *object;
+       int ret;
+
+       if (!(object = kzalloc(sizeof(*object), GFP_KERNEL)))
+               return -ENOMEM;
+       nvkm_oproxy_ctor(&nv50_disp_chan_child_func_, oclass, &object->oproxy);
+       object->disp = disp;
+       *pobject = &object->oproxy.base;
+
+       ret = sclass->ctor(device, oclass, argv, argc, &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_chan_child_get(struct nvkm_object *object, int index,
-                        struct nvkm_oclass *oclass)
+                        struct nvkm_oclass *sclass)
 {
        struct nv50_disp_chan *chan = nv50_disp_chan(object);
-       if (chan->func->child_get) {
-               int ret = chan->func->child_get(chan, index, oclass);
-               if (ret == 0)
-                       oclass->ctor = nv50_disp_chan_child_new;
-               return ret;
+       struct nvkm_device *device = chan->disp->base.engine.subdev.device;
+       const struct nvkm_device_oclass *oclass = NULL;
+
+       if (chan->func->bind)
+               sclass->engine = nvkm_device_engine(device, NVKM_ENGINE_DMAOBJ);
+       else
+               sclass->engine = NULL;
+
+       if (sclass->engine && sclass->engine->func->base.sclass) {
+               sclass->engine->func->base.sclass(sclass, index, &oclass);
+               if (oclass) {
+                       sclass->ctor = nv50_disp_chan_child_new,
+                       sclass->priv = oclass;
+                       return 0;
+               }
        }
+
        return -EINVAL;
 }
 
@@ -248,7 +300,7 @@ nv50_disp_chan_dtor(struct nvkm_object *object)
        struct nv50_disp *disp = chan->disp;
        if (chan->chid.user >= 0)
                disp->chan[chan->chid.user] = NULL;
-       return chan->func->dtor ? chan->func->dtor(chan) : chan;
+       return chan;
 }
 
 static const struct nvkm_object_func
@@ -264,12 +316,18 @@ nv50_disp_chan = {
 };
 
 int
-nv50_disp_chan_ctor(const struct nv50_disp_chan_func *func,
+nv50_disp_chan_new_(const struct nv50_disp_chan_func *func,
                    const struct nv50_disp_chan_mthd *mthd,
                    struct nv50_disp *disp, int ctrl, int user, int head,
                    const struct nvkm_oclass *oclass,
-                   struct nv50_disp_chan *chan)
+                   struct nvkm_object **pobject)
 {
+       struct nv50_disp_chan *chan;
+
+       if (!(chan = kzalloc(sizeof(*chan), GFP_KERNEL)))
+               return -ENOMEM;
+       *pobject = &chan->object;
+
        nvkm_object_ctor(&nv50_disp_chan, oclass, &chan->object);
        chan->func = func;
        chan->mthd = mthd;
@@ -285,20 +343,3 @@ nv50_disp_chan_ctor(const struct nv50_disp_chan_func *func,
        disp->chan[chan->chid.user] = chan;
        return 0;
 }
-
-int
-nv50_disp_chan_new_(const struct nv50_disp_chan_func *func,
-                   const struct nv50_disp_chan_mthd *mthd,
-                   struct nv50_disp *disp, int ctrl, int user, int head,
-                   const struct nvkm_oclass *oclass,
-                   struct nvkm_object **pobject)
-{
-       struct nv50_disp_chan *chan;
-
-       if (!(chan = kzalloc(sizeof(*chan), GFP_KERNEL)))
-               return -ENOMEM;
-       *pobject = &chan->object;
-
-       return nv50_disp_chan_ctor(func, mthd, disp, ctrl, user,
-                                  head, oclass, chan);
-}
index 10ce217cc08185c73ff628fef980e6948207720b..feb8a56fcc858c55b14785c16a10af5dd0bc4567 100644 (file)
@@ -5,7 +5,6 @@
 #include <core/object.h>
 #include "nv50.h"
 struct nv50_disp_root;
-struct nv50_disp_dmac_func;
 
 struct nv50_disp_chan {
        const struct nv50_disp_chan_func *func;
@@ -19,36 +18,38 @@ struct nv50_disp_chan {
        int head;
 
        struct nvkm_object object;
+
+       u64 push;
 };
 
 struct nv50_disp_chan_func {
-       void *(*dtor)(struct nv50_disp_chan *);
        int (*init)(struct nv50_disp_chan *);
        void (*fini)(struct nv50_disp_chan *);
-       int (*child_get)(struct nv50_disp_chan *, int index,
-                        struct nvkm_oclass *);
-       int (*child_new)(struct nv50_disp_chan *, const struct nvkm_oclass *,
-                        void *data, u32 size, struct nvkm_object **);
+       int (*bind)(struct nv50_disp_chan *, struct nvkm_object *, u32 handle);
 };
 
-int nv50_disp_chan_ctor(const struct nv50_disp_chan_func *,
-                       const struct nv50_disp_chan_mthd *,
-                       struct nv50_disp *, int ctrl, int user, int head,
-                       const struct nvkm_oclass *, struct nv50_disp_chan *);
 int nv50_disp_chan_new_(const struct nv50_disp_chan_func *,
                        const struct nv50_disp_chan_mthd *,
                        struct nv50_disp *, int ctrl, int user, int head,
                        const struct nvkm_oclass *, struct nvkm_object **);
+int nv50_disp_dmac_new_(const struct nv50_disp_chan_func *,
+                       const struct nv50_disp_chan_mthd *,
+                       struct nv50_disp *, int chid, int head, u64 push,
+                       const struct nvkm_oclass *, struct nvkm_object **);
 
 extern const struct nv50_disp_chan_func nv50_disp_pioc_func;
-extern const struct nv50_disp_chan_func gf119_disp_pioc_func;
+extern const struct nv50_disp_chan_func nv50_disp_dmac_func;
+int nv50_disp_dmac_bind(struct nv50_disp_chan *, struct nvkm_object *, u32);
+extern const struct nv50_disp_chan_func nv50_disp_core_func;
 
-extern const struct nvkm_event_func nv50_disp_chan_uevent;
-int  nv50_disp_chan_uevent_ctor(struct nvkm_object *, void *, u32,
-                               struct nvkm_notify *);
-void nv50_disp_chan_uevent_send(struct nv50_disp *, int);
+extern const struct nv50_disp_chan_func gf119_disp_pioc_func;
+extern const struct nv50_disp_chan_func gf119_disp_dmac_func;
+void gf119_disp_dmac_fini(struct nv50_disp_chan *);
+int gf119_disp_dmac_bind(struct nv50_disp_chan *, struct nvkm_object *, u32);
+extern const struct nv50_disp_chan_func gf119_disp_core_func;
+void gf119_disp_core_fini(struct nv50_disp_chan *);
 
-extern const struct nvkm_event_func gf119_disp_chan_uevent;
+extern const struct nv50_disp_chan_func gp102_disp_dmac_func;
 
 int nv50_disp_curs_new_(const struct nv50_disp_chan_func *,
                        struct nv50_disp *, int ctrl, int user,
@@ -58,17 +59,17 @@ int nv50_disp_oimm_new_(const struct nv50_disp_chan_func *,
                        struct nv50_disp *, int ctrl, int user,
                        const struct nvkm_oclass *, void *argv, u32 argc,
                        struct nvkm_object **);
-int nv50_disp_base_new_(const struct nv50_disp_dmac_func *,
+int nv50_disp_base_new_(const struct nv50_disp_chan_func *,
                        const struct nv50_disp_chan_mthd *,
                        struct nv50_disp *, int chid,
                        const struct nvkm_oclass *, void *argv, u32 argc,
                        struct nvkm_object **);
-int nv50_disp_core_new_(const struct nv50_disp_dmac_func *,
+int nv50_disp_core_new_(const struct nv50_disp_chan_func *,
                        const struct nv50_disp_chan_mthd *,
                        struct nv50_disp *, int chid,
                        const struct nvkm_oclass *oclass, void *argv, u32 argc,
                        struct nvkm_object **);
-int nv50_disp_ovly_new_(const struct nv50_disp_dmac_func *,
+int nv50_disp_ovly_new_(const struct nv50_disp_chan_func *,
                        const struct nv50_disp_chan_mthd *,
                        struct nv50_disp *, int chid,
                        const struct nvkm_oclass *, void *argv, u32 argc,
index b16857f468eecffedb90b4e3b6855884ade98e3f..cfc54aad3e7cbb36cba5e9781cd5e9540457bfb8 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 const struct nv50_disp_mthd_list
 g84_disp_core_mthd_dac = {
index ea5f48912c77a663752a0feabbd8eaca345b1bf4..e911925f1182d608f9a8e0f3953b2f1d24763c66 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 static const struct nv50_disp_mthd_list
 g94_disp_core_mthd_sor = {
index 9e48cc3625b5b9f63066edcaf5d42590c9dbe0f8..17c66162417bd285887c3506a0a375fd8aca46c6 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <subdev/timer.h>
 
@@ -167,10 +167,9 @@ gf119_disp_core_mthd = {
 };
 
 void
-gf119_disp_core_fini(struct nv50_disp_dmac *chan)
+gf119_disp_core_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;
 
        /* deactivate channel */
@@ -190,10 +189,9 @@ gf119_disp_core_fini(struct nv50_disp_dmac *chan)
 }
 
 static int
-gf119_disp_core_init(struct nv50_disp_dmac *chan)
+gf119_disp_core_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;
 
        /* enable error reporting */
@@ -220,7 +218,7 @@ gf119_disp_core_init(struct nv50_disp_dmac *chan)
        return 0;
 }
 
-const struct nv50_disp_dmac_func
+const struct nv50_disp_chan_func
 gf119_disp_core_func = {
        .init = gf119_disp_core_init,
        .fini = gf119_disp_core_fini,
index ca095958efdf395528018fdfaaa1ab4cb372b5a8..5c800174e0791728d1a32cb1e933b83721ad68fe 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 static const struct nv50_disp_mthd_list
 gk104_disp_core_mthd_head = {
index 3ec353e90b3e8ee7f1dd540db101a361cf9992bc..57d26051bc95b3d83db365ebd8a9a423dbd603e0 100644 (file)
  *
  * Authors: Ben Skeggs <bskeggs@redhat.com>
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <subdev/timer.h>
 
 static int
-gp102_disp_core_init(struct nv50_disp_dmac *chan)
+gp102_disp_core_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;
 
        /* enable error reporting */
@@ -56,7 +55,7 @@ gp102_disp_core_init(struct nv50_disp_dmac *chan)
        return 0;
 }
 
-static const struct nv50_disp_dmac_func
+static const struct nv50_disp_chan_func
 gp102_disp_core_func = {
        .init = gp102_disp_core_init,
        .fini = gf119_disp_core_fini,
index 8cdcf5b590e737a8ae9694d9c08cc453018d68c2..d648c4d7b55c595b1aa6f2b2b7cf5574a6ebd73b 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <core/client.h>
 #include <subdev/timer.h>
@@ -30,7 +30,7 @@
 #include <nvif/unpack.h>
 
 int
-nv50_disp_core_new_(const struct nv50_disp_dmac_func *func,
+nv50_disp_core_new_(const struct nv50_disp_chan_func *func,
                    const struct nv50_disp_chan_mthd *mthd,
                    struct nv50_disp *disp, int chid,
                    const struct nvkm_oclass *oclass, void *argv, u32 argc,
@@ -164,10 +164,9 @@ nv50_disp_core_mthd = {
 };
 
 static void
-nv50_disp_core_fini(struct nv50_disp_dmac *chan)
+nv50_disp_core_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;
 
        /* deactivate channel */
@@ -186,10 +185,9 @@ nv50_disp_core_fini(struct nv50_disp_dmac *chan)
 }
 
 static int
-nv50_disp_core_init(struct nv50_disp_dmac *chan)
+nv50_disp_core_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;
 
        /* enable error reporting */
@@ -222,7 +220,7 @@ nv50_disp_core_init(struct nv50_disp_dmac *chan)
        return 0;
 }
 
-const struct nv50_disp_dmac_func
+const struct nv50_disp_chan_func
 nv50_disp_core_func = {
        .init = nv50_disp_core_init,
        .fini = nv50_disp_core_fini,
index b73bcc38a259859f968fe8bd840057c744d79a69..f69749a29df8653d510358a1db82ffa653440a8c 100644 (file)
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
-#include "rootnv50.h"
+#include "channv50.h"
 
 #include <core/ramht.h>
 #include <subdev/timer.h>
 
 int
-gf119_disp_dmac_bind(struct nv50_disp_dmac *chan,
+gf119_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, -9, handle,
-                                chan->base.chid.user << 27 | 0x00000001);
+       return nvkm_ramht_insert(chan->disp->ramht, object,
+                                chan->chid.user, -9, handle,
+                                chan->chid.user << 27 | 0x00000001);
 }
 
 void
-gf119_disp_dmac_fini(struct nv50_disp_dmac *chan)
+gf119_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, 0x610490 + (ctrl * 0x0010), 0x00001010, 0x00001000);
@@ -62,13 +60,12 @@ gf119_disp_dmac_fini(struct nv50_disp_dmac *chan)
 }
 
 static int
-gf119_disp_dmac_init(struct nv50_disp_dmac *chan)
+gf119_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, 0x6100a0, 0x00000001 << user, 0x00000001 << user);
@@ -94,7 +91,7 @@ gf119_disp_dmac_init(struct nv50_disp_dmac *chan)
        return 0;
 }
 
-const struct nv50_disp_dmac_func
+const struct nv50_disp_chan_func
 gf119_disp_dmac_func = {
        .init = gf119_disp_dmac_init,
        .fini = gf119_disp_dmac_fini,
index 62e9b8430791bf2ff4aecaa17c35bf6ceca65153..22fa5925644a0c7c59f40c4e22dca26f15d3599a 100644 (file)
  *
  * Authors: Ben Skeggs <bskeggs@redhat.com>
  */
-#include "dmacnv50.h"
-#include "rootnv50.h"
+#include "channv50.h"
 
 #include <subdev/timer.h>
 
 static int
-gp102_disp_dmac_init(struct nv50_disp_dmac *chan)
+gp102_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, 0x6100a0, 0x00000001 << user, 0x00000001 << user);
@@ -59,7 +57,7 @@ gp102_disp_dmac_init(struct nv50_disp_dmac *chan)
        return 0;
 }
 
-const struct nv50_disp_dmac_func
+const struct nv50_disp_chan_func
 gp102_disp_dmac_func = {
        .init = gp102_disp_dmac_init,
        .fini = gf119_disp_dmac_fini,
index d081947d0689155b3c2c9a4aa4ab79e1fee096db..5cd08cad2c2698715556af576f42def4d47f3071 100644 (file)
  *
  * 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,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacnv50.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dmacnv50.h
deleted file mode 100644 (file)
index feeb588..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __NV50_DISP_DMAC_H__
-#define __NV50_DISP_DMAC_H__
-#define nv50_disp_dmac(p) container_of((p), struct nv50_disp_dmac, base)
-#include "channv50.h"
-
-struct nv50_disp_dmac {
-       const struct nv50_disp_dmac_func *func;
-       struct nv50_disp_chan base;
-       u32 push;
-};
-
-struct nv50_disp_dmac_func {
-       int  (*init)(struct nv50_disp_dmac *);
-       void (*fini)(struct nv50_disp_dmac *);
-       int  (*bind)(struct nv50_disp_dmac *, struct nvkm_object *, u32 handle);
-};
-
-int nv50_disp_dmac_new_(const struct nv50_disp_dmac_func *,
-                       const struct nv50_disp_chan_mthd *,
-                       struct nv50_disp *, int chid, int head, u64 push,
-                       const struct nvkm_oclass *, struct nvkm_object **);
-
-extern const struct nv50_disp_dmac_func nv50_disp_dmac_func;
-int nv50_disp_dmac_bind(struct nv50_disp_dmac *, struct nvkm_object *, u32);
-extern const struct nv50_disp_dmac_func nv50_disp_core_func;
-
-extern const struct nv50_disp_dmac_func gf119_disp_dmac_func;
-void gf119_disp_dmac_fini(struct nv50_disp_dmac *);
-int gf119_disp_dmac_bind(struct nv50_disp_dmac *, struct nvkm_object *, u32);
-extern const struct nv50_disp_dmac_func gf119_disp_core_func;
-void gf119_disp_core_fini(struct nv50_disp_dmac *);
-
-extern const struct nv50_disp_dmac_func gp102_disp_dmac_func;
-#endif
index 382e6a6a6ff2c23cbecb9d2fbf1adac4db5a5645..794e90982641e6dc384428885ab078efc96affb3 100644 (file)
@@ -24,6 +24,7 @@
 #include "nv50.h"
 #include "head.h"
 #include "ior.h"
+#include "channv50.h"
 #include "rootnv50.h"
 
 #include <core/ramht.h>
index 0a2c5b5f87eb620287cbea27d363eb2969469c66..3468ddec1270b635e7348fee05b13ac16a50cbfa 100644 (file)
@@ -24,6 +24,7 @@
 #include "nv50.h"
 #include "head.h"
 #include "ior.h"
+#include "channv50.h"
 #include "rootnv50.h"
 
 static void
index bb622d0f6d639bb0e07cf97d863a941f8a8a137a..77aa2c8cfcd6a25d83c6ca2b5b9d51ae72d76037 100644 (file)
@@ -79,4 +79,11 @@ void gf119_disp_intr_error(struct nv50_disp *, int);
 void nv50_disp_dptmds_war_2(struct nv50_disp *, struct dcb_output *);
 void nv50_disp_dptmds_war_3(struct nv50_disp *, struct dcb_output *);
 void nv50_disp_update_sppll1(struct nv50_disp *);
+
+extern const struct nvkm_event_func nv50_disp_chan_uevent;
+int  nv50_disp_chan_uevent_ctor(struct nvkm_object *, void *, u32,
+                               struct nvkm_notify *);
+void nv50_disp_chan_uevent_send(struct nv50_disp *, int);
+
+extern const struct nvkm_event_func gf119_disp_chan_uevent;
 #endif
index 6b55cf483fe2a977c05aa2d2a97b720effc40b65..31b915d486995ef4b0b3806fd8a7ca4304b7b86c 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 static const struct nv50_disp_mthd_list
 g84_disp_ovly_mthd_base = {
index 30901caf75dc39f336b43c7e46c4d9d6b8b0004c..83fd534c44dabe089dd9c55f66df6d1e9b5e7c01 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 static const struct nv50_disp_mthd_list
 gf119_disp_ovly_mthd_base = {
index 682c146c39d4e1dfed5eb4a8831a5432ef15b044..a7acacbc92c1591fa72ee5ccc3eb71686b63891d 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 static const struct nv50_disp_mthd_list
 gk104_disp_ovly_mthd_base = {
index bcc5ac40f6f9559b0eec670826d4171b36f81b7b..e0eca6ea914ca407e47a529ba0d82d95055b81ed 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 int
 gp102_disp_ovly_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
index 655deb0d2fa0d1da9581537fab1e14402d25c75f..dc60cd00dc16e7d6ca344b080c8b0a48d5d4685b 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 
 static const struct nv50_disp_mthd_list
 gt200_disp_ovly_mthd_base = {
index 46f5df0b3a1e28164e759a5d50fd07085222fa74..6974c12c4518680707a109f66a500188aa96d89d 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Authors: Ben Skeggs
  */
-#include "dmacnv50.h"
+#include "channv50.h"
 #include "head.h"
 
 #include <core/client.h>
@@ -30,7 +30,7 @@
 #include <nvif/unpack.h>
 
 int
-nv50_disp_ovly_new_(const struct nv50_disp_dmac_func *func,
+nv50_disp_ovly_new_(const struct nv50_disp_chan_func *func,
                    const struct nv50_disp_chan_mthd *mthd,
                    struct nv50_disp *disp, int chid,
                    const struct nvkm_oclass *oclass, void *argv, u32 argc,
index e51f89f325075bd6eca62b86dd601c113da0f327..1ed371fd7ddfa91e85f40e4f38437fb177bd4d8e 100644 (file)
@@ -22,7 +22,7 @@
  * Authors: Ben Skeggs
  */
 #include "rootnv50.h"
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <nvif/class.h>
 
index ed7838eedb2cee7c4fb3635fd2dd434187016e74..ef579eb00238c9f94ad2b436a2e0be2c3d7edabd 100644 (file)
@@ -22,7 +22,7 @@
  * Authors: Ben Skeggs
  */
 #include "rootnv50.h"
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <nvif/class.h>
 
index ac92e65131c9cef7c0e039d963825573db878c7f..fe011165dc0201e0923a29e5a56672267474ae61 100644 (file)
@@ -22,7 +22,7 @@
  * Authors: Ben Skeggs
  */
 #include "rootnv50.h"
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <nvif/class.h>
 
index 3bb6d601aed2ce0e8ab188ff51009a6548740983..9e8ffd348b5040661efd88cac432fab18b9a7081 100644 (file)
@@ -22,7 +22,7 @@
  * Authors: Ben Skeggs
  */
 #include "rootnv50.h"
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <nvif/class.h>
 
index 336419815d983185f6d45fde199e076873079228..dc85cc1c94907d0dfe115d3e093ad25952500c3a 100644 (file)
@@ -22,7 +22,7 @@
  * Authors: Ben Skeggs
  */
 #include "rootnv50.h"
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <nvif/class.h>
 
index c53e71ee69e78f34e0008b7cc458447a94cc60f9..e0181ca088406d785352afce8c881f9e4a0c84ad 100644 (file)
@@ -22,7 +22,7 @@
  * Authors: Ben Skeggs
  */
 #include "rootnv50.h"
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <nvif/class.h>
 
index 85409d1bc7bca2086274b927de93bbaf70095046..e5e590e19f6218a3f5fcf5048423091284999d8c 100644 (file)
@@ -22,7 +22,7 @@
  * Authors: Ben Skeggs
  */
 #include "rootnv50.h"
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <nvif/class.h>
 
index ebfd245c573af664982163eac76b6e3f64938874..762a1a922e051d526e9f92130d52259525874bff 100644 (file)
@@ -22,7 +22,7 @@
  * Authors: Ben Skeggs <bskeggs@redhat.com>
  */
 #include "rootnv50.h"
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <nvif/class.h>
 
index 54b5fda992087af1dbce91a646a1fb5916db0b0d..c7f00946c9af84f0a74433d560326a21125c7a8f 100644 (file)
@@ -22,7 +22,7 @@
  * Authors: Ben Skeggs <bskeggs@redhat.com>
  */
 #include "rootnv50.h"
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <nvif/class.h>
 
index 14ac83bf3693760fca1b90787fb77af337d12a93..a6963654087cb65750a9151b02a7f60efc7c21dc 100644 (file)
@@ -22,7 +22,7 @@
  * Authors: Ben Skeggs
  */
 #include "rootnv50.h"
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <nvif/class.h>
 
index cb1a208e68bd980a9447548cb2e34e0a68981e14..4fe0a3ae8891f2369fe3feb79e52f81bcc282e64 100644 (file)
@@ -22,7 +22,7 @@
  * Authors: Ben Skeggs
  */
 #include "rootnv50.h"
-#include "dmacnv50.h"
+#include "channv50.h"
 
 #include <nvif/class.h>
 
index 9d716ee7621e5760e76d2ea638c4d91ecbe6c3d4..3aa5a287923931a9b9c8d86666d14022665e957e 100644 (file)
@@ -22,7 +22,7 @@
  * Authors: Ben Skeggs
  */
 #include "rootnv50.h"
-#include "dmacnv50.h"
+#include "channv50.h"
 #include "dp.h"
 #include "head.h"
 #include "ior.h"
index 12fc13b397edaaf613a5c5bffab6ad6f0eb2c14b..9983a424d30dbda5be4c8ce2d5733f151dbea31f 100644 (file)
@@ -2,8 +2,8 @@
 #ifndef __NV50_DISP_ROOT_H__
 #define __NV50_DISP_ROOT_H__
 #define nv50_disp_root(p) container_of((p), struct nv50_disp_root, object)
+#include <core/object.h>
 #include "nv50.h"
-#include "dmacnv50.h"
 
 struct nv50_disp_root {
        const struct nv50_disp_root_func *func;