Lines Matching refs:cctx
42 nvkm_chan_cctx_bind(struct nvkm_chan *chan, struct nvkm_engn *engn, struct nvkm_cctx *cctx) in nvkm_chan_cctx_bind() argument
51 CHAN_TRACE(chan, "%sbind cctx %d[%s]", cctx ? "" : "un", engn->id, engine->subdev.name); in nvkm_chan_cctx_bind()
63 engn->func->bind(engn, cctx, chan); in nvkm_chan_cctx_bind()
75 struct nvkm_cctx *cctx = *pcctx; in nvkm_chan_cctx_put() local
77 if (cctx) { in nvkm_chan_cctx_put()
78 struct nvkm_engn *engn = cctx->vctx->ectx->engn; in nvkm_chan_cctx_put()
80 if (refcount_dec_and_mutex_lock(&cctx->refs, &chan->cgrp->mutex)) { in nvkm_chan_cctx_put()
82 nvkm_cgrp_vctx_put(chan->cgrp, &cctx->vctx); in nvkm_chan_cctx_put()
83 list_del(&cctx->head); in nvkm_chan_cctx_put()
84 kfree(cctx); in nvkm_chan_cctx_put()
98 struct nvkm_cctx *cctx; in nvkm_chan_cctx_get() local
103 cctx = nvkm_list_find(cctx, &chan->cctxs, head, in nvkm_chan_cctx_get()
104 cctx->vctx->ectx->engn == engn && cctx->vctx->vmm == chan->vmm); in nvkm_chan_cctx_get()
105 if (cctx) { in nvkm_chan_cctx_get()
106 refcount_inc(&cctx->refs); in nvkm_chan_cctx_get()
107 *pcctx = cctx; in nvkm_chan_cctx_get()
121 if (!(cctx = *pcctx = kzalloc(sizeof(*cctx), GFP_KERNEL))) { in nvkm_chan_cctx_get()
127 cctx->vctx = vctx; in nvkm_chan_cctx_get()
128 refcount_set(&cctx->refs, 1); in nvkm_chan_cctx_get()
129 refcount_set(&cctx->uses, 0); in nvkm_chan_cctx_get()
130 list_add_tail(&cctx->head, &chan->cctxs); in nvkm_chan_cctx_get()