diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-08-20 07:54:22 +0300 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-08-28 05:40:47 +0300 |
commit | 6f41c7c56929b3a2ad943d5b6dd4d66d716e74d7 (patch) | |
tree | f7c67518979fb8cfebde4e227eea48ee8096378c /drivers/gpu/drm/nouveau/nvkm/engine/sw | |
parent | 97070f23c60869830039b216ff88230f54ef7107 (diff) | |
download | linux-6f41c7c56929b3a2ad943d5b6dd4d66d716e74d7.tar.xz |
drm/nouveau/sw: convert to new-style nvkm_engine
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/engine/sw')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c | 25 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/sw/gf100.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c | 35 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/sw/nv10.c | 29 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.c | 39 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.h | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/sw/nvsw.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/sw/priv.h | 3 |
8 files changed, 41 insertions, 132 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c index efc18787490c..53c1f7e75b54 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c @@ -82,26 +82,29 @@ nvkm_sw_cclass_get(struct nvkm_fifo_chan *fifoch, return sw->func->chan_new(sw, fifoch, oclass, pobject); } +static void * +nvkm_sw_dtor(struct nvkm_engine *engine) +{ + return nvkm_sw(engine); +} + static const struct nvkm_engine_func nvkm_sw = { + .dtor = nvkm_sw_dtor, .fifo.cclass = nvkm_sw_cclass_get, .fifo.sclass = nvkm_sw_oclass_get, }; int -nvkm_sw_ctor(struct nvkm_object *parent, struct nvkm_object *engine, - struct nvkm_oclass *oclass, int length, void **pobject) +nvkm_sw_new_(const struct nvkm_sw_func *func, struct nvkm_device *device, + int index, struct nvkm_sw **psw) { struct nvkm_sw *sw; - int ret; - ret = nvkm_engine_create_(parent, engine, oclass, true, "sw", - "sw", length, pobject); - sw = *pobject; - if (ret) - return ret; - - sw->engine.func = &nvkm_sw; + if (!(sw = *psw = kzalloc(sizeof(*sw), GFP_KERNEL))) + return -ENOMEM; INIT_LIST_HEAD(&sw->chan); - return 0; + sw->func = func; + + return nvkm_engine_ctor(&nvkm_sw, device, index, 0, true, &sw->engine); } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/sw/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/sw/gf100.c index 5cd7844f1d5f..b01ef7eca906 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/sw/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/sw/gf100.c @@ -140,7 +140,7 @@ gf100_sw_chan_new(struct nvkm_sw *sw, struct nvkm_fifo_chan *fifoch, ******************************************************************************/ static const struct nvkm_sw_func -gf100_sw_func = { +gf100_sw = { .chan_new = gf100_sw_chan_new, .sclass = { { nvkm_nvsw_new, { -1, -1, NVIF_IOCTL_NEW_V0_SW_GF100 } }, @@ -148,14 +148,8 @@ gf100_sw_func = { } }; -struct nvkm_oclass * -gf100_sw_oclass = &(struct nv50_sw_oclass) { - .base.handle = NV_ENGINE(SW, 0xc0), - .base.ofuncs = &(struct nvkm_ofuncs) { - .ctor = nv50_sw_ctor, - .dtor = _nvkm_sw_dtor, - .init = _nvkm_sw_init, - .fini = _nvkm_sw_fini, - }, - .func = &gf100_sw_func, -}.base; +int +gf100_sw_new(struct nvkm_device *device, int index, struct nvkm_sw **psw) +{ + return nvkm_sw_new_(&gf100_sw, device, index, psw); +} diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c b/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c index d8d9d48b66d2..445217ffa791 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c @@ -122,12 +122,6 @@ nv04_sw_chan_new(struct nvkm_sw *sw, struct nvkm_fifo_chan *fifo, * software engine/subdev functions ******************************************************************************/ -void -nv04_sw_intr(struct nvkm_subdev *subdev) -{ - nvkm_mask(subdev->device, 0x000100, 0x80000000, 0x00000000); -} - static const struct nvkm_sw_func nv04_sw = { .chan_new = nv04_sw_chan_new, @@ -137,31 +131,8 @@ nv04_sw = { } }; -static int -nv04_sw_ctor(struct nvkm_object *parent, struct nvkm_object *engine, - struct nvkm_oclass *oclass, void *data, u32 size, - struct nvkm_object **pobject) +int +nv04_sw_new(struct nvkm_device *device, int index, struct nvkm_sw **psw) { - struct nvkm_sw *sw; - int ret; - - ret = nvkm_sw_create(parent, engine, oclass, &sw); - *pobject = nv_object(sw); - if (ret) - return ret; - - sw->func = &nv04_sw; - nv_subdev(sw)->intr = nv04_sw_intr; - return 0; + return nvkm_sw_new_(&nv04_sw, device, index, psw); } - -struct nvkm_oclass * -nv04_sw_oclass = &(struct nvkm_oclass) { - .handle = NV_ENGINE(SW, 0x04), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = nv04_sw_ctor, - .dtor = _nvkm_sw_dtor, - .init = _nvkm_sw_init, - .fini = _nvkm_sw_fini, - }, -}; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv10.c b/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv10.c index 1b9fc1b1f69e..adf70d92b244 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv10.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv10.c @@ -61,31 +61,8 @@ nv10_sw = { } }; -static int -nv10_sw_ctor(struct nvkm_object *parent, struct nvkm_object *engine, - struct nvkm_oclass *oclass, void *data, u32 size, - struct nvkm_object **pobject) +int +nv10_sw_new(struct nvkm_device *device, int index, struct nvkm_sw **psw) { - struct nvkm_sw *sw; - int ret; - - ret = nvkm_sw_create(parent, engine, oclass, &sw); - *pobject = nv_object(sw); - if (ret) - return ret; - - sw->func = &nv10_sw; - nv_subdev(sw)->intr = nv04_sw_intr; - return 0; + return nvkm_sw_new_(&nv10_sw, device, index, psw); } - -struct nvkm_oclass * -nv10_sw_oclass = &(struct nvkm_oclass) { - .handle = NV_ENGINE(SW, 0x10), - .ofuncs = &(struct nvkm_ofuncs) { - .ctor = nv10_sw_ctor, - .dtor = _nvkm_sw_dtor, - .init = _nvkm_sw_init, - .fini = _nvkm_sw_fini, - }, -}; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.c index a00d9a55e53b..ef36ba18bff8 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.c @@ -48,7 +48,7 @@ nv50_sw_chan_vblsem_release(struct nvkm_notify *notify) nvkm_wr32(device, 0x001710, 0x80000000 | chan->vblank.ctxdma); nvkm_bar_flush(device->bar); - if (nv_device(sw)->chipset == 0x50) { + if (device->chipset == 0x50) { nvkm_wr32(device, 0x001570, chan->vblank.offset); nvkm_wr32(device, 0x001574, chan->vblank.value); } else { @@ -133,27 +133,8 @@ nv50_sw_chan_new(struct nvkm_sw *sw, struct nvkm_fifo_chan *fifoch, * software engine/subdev functions ******************************************************************************/ -int -nv50_sw_ctor(struct nvkm_object *parent, struct nvkm_object *engine, - struct nvkm_oclass *oclass, void *data, u32 size, - struct nvkm_object **pobject) -{ - struct nv50_sw_oclass *pclass = (void *)oclass; - struct nvkm_sw *sw; - int ret; - - ret = nvkm_sw_create(parent, engine, oclass, &sw); - *pobject = nv_object(sw); - if (ret) - return ret; - - sw->func = pclass->func; - nv_subdev(sw)->intr = nv04_sw_intr; - return 0; -} - static const struct nvkm_sw_func -nv50_sw_func = { +nv50_sw = { .chan_new = nv50_sw_chan_new, .sclass = { { nvkm_nvsw_new, { -1, -1, NVIF_IOCTL_NEW_V0_SW_NV50 } }, @@ -161,14 +142,8 @@ nv50_sw_func = { } }; -struct nvkm_oclass * -nv50_sw_oclass = &(struct nv50_sw_oclass) { - .base.handle = NV_ENGINE(SW, 0x50), - .base.ofuncs = &(struct nvkm_ofuncs) { - .ctor = nv50_sw_ctor, - .dtor = _nvkm_sw_dtor, - .init = _nvkm_sw_init, - .fini = _nvkm_sw_fini, - }, - .func = &nv50_sw_func, -}.base; +int +nv50_sw_new(struct nvkm_device *device, int index, struct nvkm_sw **psw) +{ + return nvkm_sw_new_(&nv50_sw, device, index, psw); +} diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.h b/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.h index c90a470564e2..25cdfdef2d46 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.h @@ -6,21 +6,6 @@ #include "nvsw.h" #include <core/notify.h> -struct nv50_sw_oclass { - struct nvkm_oclass base; - const struct nvkm_sw_func *func; -}; - -int nv50_sw_ctor(struct nvkm_object *, struct nvkm_object *, - struct nvkm_oclass *, void *, u32, - struct nvkm_object **); - -struct nv50_sw_cclass { - struct nvkm_oclass base; - int (*vblank)(struct nvkm_notify *); - const struct nvkm_sw_chan_func *chan; -}; - struct nv50_sw_chan { struct nvkm_sw_chan base; struct { diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/sw/nvsw.c b/drivers/gpu/drm/nouveau/nvkm/engine/sw/nvsw.c index 6652a9196753..66cf986b9572 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/sw/nvsw.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/sw/nvsw.c @@ -27,18 +27,19 @@ #include <nvif/class.h> static int -nvkm_nvsw_mthd_(struct nvkm_object *base, u32 mthd, void *data, u32 size) +nvkm_nvsw_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size) { - struct nvkm_nvsw *nvsw = nvkm_nvsw(base); + struct nvkm_nvsw *nvsw = nvkm_nvsw(object); if (nvsw->func->mthd) return nvsw->func->mthd(nvsw, mthd, data, size); return -ENODEV; } static int -nvkm_nvsw_ntfy_(struct nvkm_object *base, u32 mthd, struct nvkm_event **pevent) +nvkm_nvsw_ntfy_(struct nvkm_object *object, u32 mthd, + struct nvkm_event **pevent) { - struct nvkm_nvsw *nvsw = nvkm_nvsw(base); + struct nvkm_nvsw *nvsw = nvkm_nvsw(object); switch (mthd) { case NVSW_NTFY_UEVENT: *pevent = &nvsw->chan->event; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/sw/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/sw/priv.h index ae610a32ef5a..0ef1318dc2fd 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/sw/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/sw/priv.h @@ -4,6 +4,9 @@ #include <engine/sw.h> struct nvkm_sw_chan; +int nvkm_sw_new_(const struct nvkm_sw_func *, struct nvkm_device *, + int index, struct nvkm_sw **); + struct nvkm_sw_chan_sclass { int (*ctor)(struct nvkm_sw_chan *, const struct nvkm_oclass *, void *data, u32 size, struct nvkm_object **); |