···220220nv50_evo_destroy(struct drm_device *dev)221221{222222 struct nv50_display *disp = nv50_display(dev);223223+ int i;223224225225+ for (i = 0; i < 2; i++) {226226+ if (disp->crtc[i].sem.bo) {227227+ nouveau_bo_unmap(disp->crtc[i].sem.bo);228228+ nouveau_bo_ref(NULL, &disp->crtc[i].sem.bo);229229+ }230230+ nv50_evo_channel_del(&disp->crtc[i].sync);231231+ }224232 nouveau_gpuobj_ref(NULL, &disp->ntfy);225233 nv50_evo_channel_del(&disp->master);226234}···240232 struct nv50_display *disp = nv50_display(dev);241233 struct nouveau_gpuobj *ramht = NULL;242234 struct nouveau_channel *evo;243243- int ret;235235+ int ret, i, j;244236245237 /* create primary evo channel, the one we use for modesetting246238 * purporses···319311 if (ret)320312 goto err;321313314314+ /* create "display sync" channels and other structures we need315315+ * to implement page flipping316316+ */317317+ for (i = 0; i < 2; i++) {318318+ struct nv50_display_crtc *dispc = &disp->crtc[i];319319+ u64 offset;320320+321321+ ret = nv50_evo_channel_new(dev, 1 + i, &dispc->sync);322322+ if (ret)323323+ goto err;324324+325325+ ret = nouveau_bo_new(dev, NULL, 4096, 0x1000, TTM_PL_FLAG_VRAM,326326+ 0, 0x0000, false, true, &dispc->sem.bo);327327+ if (!ret) {328328+ offset = dispc->sem.bo->bo.mem.start << PAGE_SHIFT;329329+330330+ ret = nouveau_bo_pin(dispc->sem.bo, TTM_PL_FLAG_VRAM);331331+ if (!ret)332332+ ret = nouveau_bo_map(dispc->sem.bo);333333+ if (ret)334334+ nouveau_bo_ref(NULL, &dispc->sem.bo);335335+ }336336+337337+ if (ret)338338+ goto err;339339+340340+ ret = nv50_evo_dmaobj_new(dispc->sync, NvEvoSync, 0x0000,341341+ offset, 4096, NULL);342342+ if (ret)343343+ goto err;344344+345345+ ret = nv50_evo_dmaobj_new(dispc->sync, NvEvoVRAM_LP, 0x80000000,346346+ 0, dev_priv->vram_size, NULL);347347+ if (ret)348348+ goto err;349349+350350+ ret = nv50_evo_dmaobj_new(dispc->sync, NvEvoFB32, 0x80000000 |351351+ (dev_priv->chipset < 0xc0 ?352352+ 0x7a00 : 0xfe00),353353+ 0, dev_priv->vram_size, NULL);354354+ if (ret)355355+ goto err;356356+357357+ ret = nv50_evo_dmaobj_new(dispc->sync, NvEvoFB16, 0x80000000 |358358+ (dev_priv->chipset < 0xc0 ?359359+ 0x7000 : 0xfe00),360360+ 0, dev_priv->vram_size, NULL);361361+ if (ret)362362+ goto err;363363+364364+ for (j = 0; j < 4096; j += 4)365365+ nouveau_bo_wr32(dispc->sem.bo, j / 4, 0x74b1e000);366366+ dispc->sem.offset = 0;367367+ }368368+322369 return 0;323370324371err:···385322nv50_evo_init(struct drm_device *dev)386323{387324 struct nv50_display *disp = nv50_display(dev);388388- int ret;325325+ int ret, i;389326390327 if (!disp->master) {391328 ret = nv50_evo_create(dev);···393330 return ret;394331 }395332396396- return nv50_evo_channel_init(disp->master);333333+ ret = nv50_evo_channel_init(disp->master);334334+ if (ret)335335+ return ret;336336+337337+ for (i = 0; i < 2; i++) {338338+ ret = nv50_evo_channel_init(disp->crtc[i].sync);339339+ if (ret)340340+ return ret;341341+ }342342+343343+ return 0;397344}398345399346void400347nv50_evo_fini(struct drm_device *dev)401348{402349 struct nv50_display *disp = nv50_display(dev);350350+ int i;351351+352352+ for (i = 0; i < 2; i++) {353353+ if (disp->crtc[i].sync)354354+ nv50_evo_channel_fini(disp->crtc[i].sync);355355+ }403356404357 if (disp->master)405358 nv50_evo_channel_fini(disp->master);359359+406360 nv50_evo_destroy(dev);407361}
+2
drivers/gpu/drm/nouveau/nv50_evo.h
···113113/* Both of these are needed, otherwise nothing happens. */114114#define NV50_EVO_CRTC_SCALE_RES1 0x000008d8115115#define NV50_EVO_CRTC_SCALE_RES2 0x000008dc116116+#define NV50_EVO_CRTC_UNK900 0x00000900117117+#define NV50_EVO_CRTC_UNK904 0x00000904116118117119#endif