drm/nouveau/disp/nv50-: replace user object with engine pointer in 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:20 +0000 (15:01 +1000)
More simplification.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
15 files changed:
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/coregf119.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/cursnv50.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
drivers/gpu/drm/nouveau/nvkm/engine/disp/oimmnv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/ovlynv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/piocgf119.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/piocnv50.c

index f1d6b820d48249ec808b777c02852b7416ab0423..418741a61f115e8a261b1b368745263312d2be00 100644 (file)
@@ -58,7 +58,7 @@ nv50_disp_base_new(const struct nv50_disp_dmac_func *func,
        } else
                return ret;
 
-       return nv50_disp_dmac_new_(func, mthd, root, chid + head,
+       return nv50_disp_dmac_new_(func, mthd, disp, chid + head,
                                   head, push, oclass, pobject);
 }
 
index 723dcbde2ac2fae44de8a30a09d12fb3e2b84ce6..96b732d4b9abd9d2d505c79fe0fd672ff0721263 100644 (file)
@@ -65,7 +65,7 @@ nv50_disp_mthd_list(struct nv50_disp *disp, int debug, u32 base, int c,
 void
 nv50_disp_chan_mthd(struct nv50_disp_chan *chan, int debug)
 {
-       struct nv50_disp *disp = chan->root->disp;
+       struct nv50_disp *disp = chan->disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        const struct nv50_disp_chan_mthd *mthd = chan->mthd;
        const struct nv50_disp_mthd_list *list;
@@ -158,7 +158,7 @@ static int
 nv50_disp_chan_rd32(struct nvkm_object *object, u64 addr, u32 *data)
 {
        struct nv50_disp_chan *chan = nv50_disp_chan(object);
-       struct nv50_disp *disp = chan->root->disp;
+       struct nv50_disp *disp = chan->disp;
        struct nvkm_device *device = disp->base.engine.subdev.device;
        *data = nvkm_rd32(device, 0x640000 + (chan->chid.user * 0x1000) + addr);
        return 0;
@@ -168,7 +168,7 @@ static int
 nv50_disp_chan_wr32(struct nvkm_object *object, u64 addr, u32 data)
 {
        struct nv50_disp_chan *chan = nv50_disp_chan(object);
-       struct nv50_disp *disp = chan->root->disp;
+       struct nv50_disp *disp = chan->disp;
        struct nvkm_device *device = disp->base.engine.subdev.device;
        nvkm_wr32(device, 0x640000 + (chan->chid.user * 0x1000) + addr, data);
        return 0;
@@ -179,7 +179,7 @@ nv50_disp_chan_ntfy(struct nvkm_object *object, u32 type,
                    struct nvkm_event **pevent)
 {
        struct nv50_disp_chan *chan = nv50_disp_chan(object);
-       struct nv50_disp *disp = chan->root->disp;
+       struct nv50_disp *disp = chan->disp;
        switch (type) {
        case NV50_DISP_CORE_CHANNEL_DMA_V0_NTFY_UEVENT:
                *pevent = &disp->uevent;
@@ -195,7 +195,7 @@ nv50_disp_chan_map(struct nvkm_object *object, void *argv, u32 argc,
                   enum nvkm_object_map *type, u64 *addr, u64 *size)
 {
        struct nv50_disp_chan *chan = nv50_disp_chan(object);
-       struct nv50_disp *disp = chan->root->disp;
+       struct nv50_disp *disp = chan->disp;
        struct nvkm_device *device = disp->base.engine.subdev.device;
        *type = NVKM_OBJECT_MAP_IO;
        *addr = device->func->resource_addr(device, 0) +
@@ -245,7 +245,7 @@ static void *
 nv50_disp_chan_dtor(struct nvkm_object *object)
 {
        struct nv50_disp_chan *chan = nv50_disp_chan(object);
-       struct nv50_disp *disp = chan->root->disp;
+       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;
@@ -266,16 +266,14 @@ nv50_disp_chan = {
 int
 nv50_disp_chan_ctor(const struct nv50_disp_chan_func *func,
                    const struct nv50_disp_chan_mthd *mthd,
-                   struct nv50_disp_root *root, int ctrl, int user, int head,
+                   struct nv50_disp *disp, int ctrl, int user, int head,
                    const struct nvkm_oclass *oclass,
                    struct nv50_disp_chan *chan)
 {
-       struct nv50_disp *disp = root->disp;
-
        nvkm_object_ctor(&nv50_disp_chan, oclass, &chan->object);
        chan->func = func;
        chan->mthd = mthd;
-       chan->root = root;
+       chan->disp = disp;
        chan->chid.ctrl = ctrl;
        chan->chid.user = user;
        chan->head = head;
@@ -291,7 +289,7 @@ nv50_disp_chan_ctor(const struct nv50_disp_chan_func *func,
 int
 nv50_disp_chan_new_(const struct nv50_disp_chan_func *func,
                    const struct nv50_disp_chan_mthd *mthd,
-                   struct nv50_disp_root *root, int ctrl, int user, int head,
+                   struct nv50_disp *disp, int ctrl, int user, int head,
                    const struct nvkm_oclass *oclass,
                    struct nvkm_object **pobject)
 {
@@ -301,6 +299,6 @@ nv50_disp_chan_new_(const struct nv50_disp_chan_func *func,
                return -ENOMEM;
        *pobject = &chan->object;
 
-       return nv50_disp_chan_ctor(func, mthd, root, ctrl, user,
+       return nv50_disp_chan_ctor(func, mthd, disp, ctrl, user,
                                   head, oclass, chan);
 }
index b5185853b7d8d448520ecc52f810d1201f42a418..c9dc58ce47dd25c6e96def060a2063d7e008010f 100644 (file)
@@ -9,7 +9,7 @@ struct nv50_disp_root;
 struct nv50_disp_chan {
        const struct nv50_disp_chan_func *func;
        const struct nv50_disp_chan_mthd *mthd;
-       struct nv50_disp_root *root;
+       struct nv50_disp *disp;
 
        struct {
                int ctrl;
@@ -32,11 +32,11 @@ struct nv50_disp_chan_func {
 
 int nv50_disp_chan_ctor(const struct nv50_disp_chan_func *,
                        const struct nv50_disp_chan_mthd *,
-                       struct nv50_disp_root *, int ctrl, int user, int head,
+                       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_root *, int ctrl, int user, int head,
+                       struct nv50_disp *, int ctrl, int user, int head,
                        const struct nvkm_oclass *, struct nvkm_object **);
 
 extern const struct nv50_disp_chan_func nv50_disp_pioc_func;
index 21fbf89b6319fba4f155acceee2a61c5b398b2cf..200dd90e016b4befa05f827561b7c656a2c61753 100644 (file)
@@ -174,7 +174,7 @@ gf119_disp_core_chan_mthd = {
 void
 gf119_disp_core_fini(struct nv50_disp_dmac *chan)
 {
-       struct nv50_disp *disp = chan->base.root->disp;
+       struct nv50_disp *disp = chan->base.disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
 
@@ -197,7 +197,7 @@ gf119_disp_core_fini(struct nv50_disp_dmac *chan)
 static int
 gf119_disp_core_init(struct nv50_disp_dmac *chan)
 {
-       struct nv50_disp *disp = chan->base.root->disp;
+       struct nv50_disp *disp = chan->base.disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
 
index b0df4b752b8c69ecf40dbad735933dadeb4d0e79..6ad5f2fb2ac19b62f359fa9ab3d022da2bae0945 100644 (file)
@@ -31,7 +31,7 @@
 static int
 gp102_disp_core_init(struct nv50_disp_dmac *chan)
 {
-       struct nv50_disp *disp = chan->base.root->disp;
+       struct nv50_disp *disp = chan->base.disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
 
index b547c8b833caba4b134f8e5b886fa3c595ef5919..839cbc83428cf5216847b9e6942453cf5f998d40 100644 (file)
@@ -54,7 +54,7 @@ nv50_disp_core_new(const struct nv50_disp_dmac_func *func,
        } else
                return ret;
 
-       return nv50_disp_dmac_new_(func, mthd, root, chid, 0,
+       return nv50_disp_dmac_new_(func, mthd, root->disp, chid, 0,
                                   push, oclass, pobject);
 }
 
@@ -168,7 +168,7 @@ nv50_disp_core_chan_mthd = {
 static void
 nv50_disp_core_fini(struct nv50_disp_dmac *chan)
 {
-       struct nv50_disp *disp = chan->base.root->disp;
+       struct nv50_disp *disp = chan->base.disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
 
@@ -190,7 +190,7 @@ nv50_disp_core_fini(struct nv50_disp_dmac *chan)
 static int
 nv50_disp_core_init(struct nv50_disp_dmac *chan)
 {
-       struct nv50_disp *disp = chan->base.root->disp;
+       struct nv50_disp *disp = chan->base.disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
 
index ab51121b7982d5bdd379b3cf5b380c1f9a136f05..1f9a6c31ab3bb0b0cd0a422f2376aa10f1954daa 100644 (file)
@@ -55,7 +55,7 @@ nv50_disp_curs_new(const struct nv50_disp_chan_func *func,
        } else
                return ret;
 
-       return nv50_disp_chan_new_(func, mthd, root, ctrl + head, user + head,
+       return nv50_disp_chan_new_(func, mthd, disp, ctrl + head, user + head,
                                   head, oclass, pobject);
 }
 
index 6680ff8bf029a93d2128edc1854c98a5466ea91e..b73bcc38a259859f968fe8bd840057c744d79a69 100644 (file)
@@ -31,7 +31,7 @@ int
 gf119_disp_dmac_bind(struct nv50_disp_dmac *chan,
                     struct nvkm_object *object, u32 handle)
 {
-       return nvkm_ramht_insert(chan->base.root->disp->ramht, object,
+       return nvkm_ramht_insert(chan->base.disp->ramht, object,
                                 chan->base.chid.user, -9, handle,
                                 chan->base.chid.user << 27 | 0x00000001);
 }
@@ -39,7 +39,7 @@ gf119_disp_dmac_bind(struct nv50_disp_dmac *chan,
 void
 gf119_disp_dmac_fini(struct nv50_disp_dmac *chan)
 {
-       struct nv50_disp *disp = chan->base.root->disp;
+       struct nv50_disp *disp = chan->base.disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
        int ctrl = chan->base.chid.ctrl;
@@ -64,7 +64,7 @@ gf119_disp_dmac_fini(struct nv50_disp_dmac *chan)
 static int
 gf119_disp_dmac_init(struct nv50_disp_dmac *chan)
 {
-       struct nv50_disp *disp = chan->base.root->disp;
+       struct nv50_disp *disp = chan->base.disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
        int ctrl = chan->base.chid.ctrl;
index cdead9500343e50e7afd260538f26473be399977..62e9b8430791bf2ff4aecaa17c35bf6ceca65153 100644 (file)
@@ -29,7 +29,7 @@
 static int
 gp102_disp_dmac_init(struct nv50_disp_dmac *chan)
 {
-       struct nv50_disp *disp = chan->base.root->disp;
+       struct nv50_disp *disp = chan->base.disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
        int ctrl = chan->base.chid.ctrl;
index c80d0479c79a38a4cff86645b6f4dab3d02844d4..d081947d0689155b3c2c9a4aa4ab79e1fee096db 100644 (file)
@@ -56,7 +56,7 @@ nv50_disp_dmac_child_new_(struct nv50_disp_chan *base,
                          void *data, u32 size, struct nvkm_object **pobject)
 {
        struct nv50_disp_dmac *chan = nv50_disp_dmac(base);
-       struct nv50_disp *disp = chan->base.root->disp;
+       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;
@@ -85,7 +85,7 @@ 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.root->disp;
+       struct nv50_disp *disp = chan->base.disp;
        struct nvkm_device *device = disp->base.engine.subdev.device;
        const struct nvkm_device_oclass *oclass = NULL;
 
@@ -133,7 +133,7 @@ nv50_disp_dmac_func_ = {
 int
 nv50_disp_dmac_new_(const struct nv50_disp_dmac_func *func,
                    const struct nv50_disp_chan_mthd *mthd,
-                   struct nv50_disp_root *root, int chid, int head, u64 push,
+                   struct nv50_disp *disp, int chid, int head, u64 push,
                    const struct nvkm_oclass *oclass,
                    struct nvkm_object **pobject)
 {
@@ -147,7 +147,7 @@ nv50_disp_dmac_new_(const struct nv50_disp_dmac_func *func,
        *pobject = &chan->base.object;
        chan->func = func;
 
-       ret = nv50_disp_chan_ctor(&nv50_disp_dmac_func_, mthd, root,
+       ret = nv50_disp_chan_ctor(&nv50_disp_dmac_func_, mthd, disp,
                                  chid, chid, head, oclass, &chan->base);
        if (ret)
                return ret;
@@ -177,7 +177,7 @@ int
 nv50_disp_dmac_bind(struct nv50_disp_dmac *chan,
                    struct nvkm_object *object, u32 handle)
 {
-       return nvkm_ramht_insert(chan->base.root->disp->ramht, object,
+       return nvkm_ramht_insert(chan->base.disp->ramht, object,
                                 chan->base.chid.user, -10, handle,
                                 chan->base.chid.user << 28 |
                                 chan->base.chid.user);
@@ -186,7 +186,7 @@ nv50_disp_dmac_bind(struct nv50_disp_dmac *chan,
 static void
 nv50_disp_dmac_fini(struct nv50_disp_dmac *chan)
 {
-       struct nv50_disp *disp = chan->base.root->disp;
+       struct nv50_disp *disp = chan->base.disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
        int ctrl = chan->base.chid.ctrl;
@@ -210,7 +210,7 @@ nv50_disp_dmac_fini(struct nv50_disp_dmac *chan)
 static int
 nv50_disp_dmac_init(struct nv50_disp_dmac *chan)
 {
-       struct nv50_disp *disp = chan->base.root->disp;
+       struct nv50_disp *disp = chan->base.disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
        int ctrl = chan->base.chid.ctrl;
index f9b98211da6a69be1fff7ec29ed37d0b55d9f419..ca323864ebfec2945dc3ee1b66ca6e198f0588aa 100644 (file)
@@ -18,7 +18,7 @@ struct nv50_disp_dmac_func {
 
 int nv50_disp_dmac_new_(const struct nv50_disp_dmac_func *,
                        const struct nv50_disp_chan_mthd *,
-                       struct nv50_disp_root *, int chid, int head, u64 push,
+                       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;
index f3b0fa2c592441a1001d02da8ad51dc4ef2ba771..7e013cdf6f5c98106eeafa6154ff3de6c4ed892a 100644 (file)
@@ -55,7 +55,7 @@ nv50_disp_oimm_new(const struct nv50_disp_chan_func *func,
        } else
                return ret;
 
-       return nv50_disp_chan_new_(func, mthd, root, ctrl + head, user + head,
+       return nv50_disp_chan_new_(func, mthd, disp, ctrl + head, user + head,
                                   head, oclass, pobject);
 }
 
index 9ebaaa6e9e336ce391bc91e80ed6791cd9f86f5f..d0e554601cc18d2cba7e0140af187e9bb97dfd4c 100644 (file)
@@ -58,7 +58,7 @@ nv50_disp_ovly_new(const struct nv50_disp_dmac_func *func,
        } else
                return ret;
 
-       return nv50_disp_dmac_new_(func, mthd, root, chid + head,
+       return nv50_disp_dmac_new_(func, mthd, disp, chid + head,
                                   head, push, oclass, pobject);
 }
 
index 0abaa6431943b917e693a3b06f8bfd22bac9af49..7b1e9bf75abdebe46f3763d93a463eb8ff2a83dd 100644 (file)
@@ -29,7 +29,7 @@
 static void
 gf119_disp_pioc_fini(struct nv50_disp_chan *chan)
 {
-       struct nv50_disp *disp = chan->root->disp;
+       struct nv50_disp *disp = chan->disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
        int ctrl = chan->chid.ctrl;
@@ -52,7 +52,7 @@ gf119_disp_pioc_fini(struct nv50_disp_chan *chan)
 static int
 gf119_disp_pioc_init(struct nv50_disp_chan *chan)
 {
-       struct nv50_disp *disp = chan->root->disp;
+       struct nv50_disp *disp = chan->disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
        int ctrl = chan->chid.ctrl;
index 0211e0e8a35f0fe6c83b676d98bd595bd17b5264..60c20123d84fcb889452978870fb79c5baf7174c 100644 (file)
@@ -29,7 +29,7 @@
 static void
 nv50_disp_pioc_fini(struct nv50_disp_chan *chan)
 {
-       struct nv50_disp *disp = chan->root->disp;
+       struct nv50_disp *disp = chan->disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
        int ctrl = chan->chid.ctrl;
@@ -48,7 +48,7 @@ nv50_disp_pioc_fini(struct nv50_disp_chan *chan)
 static int
 nv50_disp_pioc_init(struct nv50_disp_chan *chan)
 {
-       struct nv50_disp *disp = chan->root->disp;
+       struct nv50_disp *disp = chan->disp;
        struct nvkm_subdev *subdev = &disp->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
        int ctrl = chan->chid.ctrl;