void nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx) { struct nouveau_fence_priv *priv = (void*)chan->drm->fence; struct nouveau_cli *cli = (void *)chan->user.client; int ret; INIT_LIST_HEAD(&fctx->flip); INIT_LIST_HEAD(&fctx->pending); spin_lock_init(&fctx->lock); fctx->context = priv->context_base + chan->chid; if (chan == chan->drm->cechan) strcpy(fctx->name, "copy engine channel"); else if (chan == chan->drm->channel) strcpy(fctx->name, "generic kernel channel"); else strcpy(fctx->name, nvxx_client(&cli->base)->name); kref_init(&fctx->fence_ref); if (!priv->uevent) return; ret = nvif_notify_init(&chan->user, nouveau_fence_wait_uevent_handler, false, G82_CHANNEL_DMA_V0_NTFY_UEVENT, &(struct nvif_notify_uevent_req) { }, sizeof(struct nvif_notify_uevent_req),
static void nouveau_cli_destroy(struct nouveau_cli *cli) { nvkm_vm_ref(NULL, &nvxx_client(&cli->base)->vm, NULL); nvif_client_fini(&cli->base); usif_client_fini(cli); }
int nouveau_channel_idle(struct nouveau_channel *chan) { if (likely(chan && chan->fence)) { struct nouveau_cli *cli = (void *)chan->user.client; struct nouveau_fence *fence = NULL; int ret; ret = nouveau_fence_new(chan, false, &fence); if (!ret) { ret = nouveau_fence_wait(fence, false, false); nouveau_fence_unref(&fence); } if (ret) { NV_PRINTK(err, cli, "failed to idle channel %d [%s]\n", chan->chid, nvxx_client(&cli->base)->name); return ret; } } return 0; }