/* initialize crtc */ struct drm_crtc *mdp4_crtc_init(struct drm_device *dev, struct drm_plane *plane, int id, int ovlp_id, enum mdp4_dma dma_id) { struct drm_crtc *crtc = NULL; struct mdp4_crtc *mdp4_crtc; int ret; mdp4_crtc = kzalloc(sizeof(*mdp4_crtc), GFP_KERNEL); if (!mdp4_crtc) { ret = -ENOMEM; goto fail; } crtc = &mdp4_crtc->base; mdp4_crtc->plane = plane; mdp4_crtc->id = id; mdp4_crtc->ovlp = ovlp_id; mdp4_crtc->dma = dma_id; mdp4_crtc->vblank.irqmask = dma2irq(mdp4_crtc->dma); mdp4_crtc->vblank.irq = mdp4_crtc_vblank_irq; mdp4_crtc->err.irqmask = dma2err(mdp4_crtc->dma); mdp4_crtc->err.irq = mdp4_crtc_err_irq; snprintf(mdp4_crtc->name, sizeof(mdp4_crtc->name), "%s:%d", dma_names[dma_id], ovlp_id); spin_lock_init(&mdp4_crtc->cursor.lock); ret = drm_flip_work_init(&mdp4_crtc->unref_fb_work, 16, "unref fb", unref_fb_worker); if (ret) goto fail; ret = drm_flip_work_init(&mdp4_crtc->unref_cursor_work, 64, "unref cursor", unref_cursor_worker); INIT_FENCE_CB(&mdp4_crtc->pageflip_cb, pageflip_cb); drm_crtc_init_with_planes(dev, crtc, plane, NULL, &mdp4_crtc_funcs); drm_crtc_helper_add(crtc, &mdp4_crtc_helper_funcs); mdp4_plane_install_properties(mdp4_crtc->plane, &crtc->base); return crtc; fail: if (crtc) mdp4_crtc_destroy(crtc); return ERR_PTR(ret); }
static struct msm_commit *new_commit(struct drm_atomic_state *state) { struct msm_commit *c = kzalloc(sizeof(*c), GFP_KERNEL); if (!c) return NULL; c->state = state; /* TODO we might need a way to indicate to run the cb on a * different wq so wait_for_vblanks() doesn't block retiring * bo's.. */ INIT_FENCE_CB(&c->fence_cb, fence_cb); return c; }