diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-12-15 19:22:49 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2016-01-11 11:17:40 +1000 |
commit | 5bf561eecaeeb23942c556f0e88ba82bdc5d04cb (patch) | |
tree | ccdd1bcbea9100698a858321a1e42b305d270ab6 /drivers | |
parent | f01c4e682c941ba70e0ebec44db754844a1b9b82 (diff) | |
download | linux-5bf561eecaeeb23942c556f0e88ba82bdc5d04cb.tar.bz2 |
drm/nouveau/gr/gf100-: subclass nvkm_object to store channel pointer
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c index 3c6effbf19d6..414521b438f7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c @@ -140,6 +140,12 @@ gf100_gr_zbc_depth_get(struct gf100_gr *gr, int format, /******************************************************************************* * Graphics object classes ******************************************************************************/ +#define gf100_gr_object(p) container_of((p), struct gf100_gr_object, object) + +struct gf100_gr_object { + struct nvkm_object object; + struct gf100_gr_chan *chan; +}; static int gf100_fermi_mthd_zbc_color(struct nvkm_object *object, void *data, u32 size) @@ -258,6 +264,27 @@ gf100_gr_mthd_sw(struct nvkm_device *device, u16 class, u32 mthd, u32 data) return false; } +static const struct nvkm_object_func +gf100_gr_object_func = { +}; + +static int +gf100_gr_object_new(const struct nvkm_oclass *oclass, void *data, u32 size, + struct nvkm_object **pobject) +{ + struct gf100_gr_chan *chan = gf100_gr_chan(oclass->parent); + struct gf100_gr_object *object; + + if (!(object = kzalloc(sizeof(*object), GFP_KERNEL))) + return -ENOMEM; + *pobject = &object->object; + + nvkm_object_ctor(oclass->base.func ? oclass->base.func : + &gf100_gr_object_func, oclass, &object->object); + object->chan = chan; + return 0; +} + static int gf100_gr_object_get(struct nvkm_gr *base, int index, struct nvkm_sclass *sclass) { @@ -267,6 +294,7 @@ gf100_gr_object_get(struct nvkm_gr *base, int index, struct nvkm_sclass *sclass) while (gr->func->sclass[c].oclass) { if (c++ == index) { *sclass = gr->func->sclass[index]; + sclass->ctor = gf100_gr_object_new; return index; } } |