/* initialize plane */ struct drm_plane *omap_plane_init(struct drm_device *dev, struct omap_overlay *ovl, unsigned int possible_crtcs, bool priv) { struct drm_plane *plane = NULL; struct omap_plane *omap_plane; DBG("%s: possible_crtcs=%08x, priv=%d", ovl->name, possible_crtcs, priv); omap_plane = kzalloc(sizeof(*omap_plane), GFP_KERNEL); if (!omap_plane) { dev_err(dev->dev, "could not allocate plane\n"); goto fail; } omap_plane->ovl = ovl; plane = &omap_plane->base; drm_plane_init(dev, plane, possible_crtcs, &omap_plane_funcs, formats, ARRAY_SIZE(formats), priv); /* get our starting configuration, set defaults for parameters * we don't currently use, etc: */ ovl->get_overlay_info(ovl, &omap_plane->info); omap_plane->info.rotation_type = OMAP_DSS_ROT_DMA; omap_plane->info.rotation = OMAP_DSS_ROT_0; omap_plane->info.global_alpha = 0xff; omap_plane->info.mirror = 0; omap_plane->info.mirror = 0; /* Set defaults depending on whether we are a CRTC or overlay * layer. * TODO add ioctl to give userspace an API to change this.. this * will come in a subsequent patch. */ if (priv) omap_plane->info.zorder = 0; else omap_plane->info.zorder = 1; update_manager(plane); return plane; fail: if (plane) { omap_plane_destroy(plane); } return NULL; }
/* initialize plane */ struct drm_plane *omap_plane_init(struct drm_device *dev, int id, bool private_plane) { struct omap_drm_private *priv = dev->dev_private; struct drm_plane *plane = NULL; struct omap_plane *omap_plane; struct omap_overlay_info *info; int ret; DBG("%s: priv=%d", plane_names[id], private_plane); omap_plane = kzalloc(sizeof(*omap_plane), GFP_KERNEL); if (!omap_plane) goto fail; ret = kfifo_alloc(&omap_plane->unpin_fifo, 16, GFP_KERNEL); if (ret) { dev_err(dev->dev, "could not allocate unpin FIFO\n"); goto fail; } omap_plane->nformats = omap_framebuffer_get_formats( omap_plane->formats, ARRAY_SIZE(omap_plane->formats), dss_feat_get_supported_color_modes(id)); omap_plane->id = id; omap_plane->name = plane_names[id]; plane = &omap_plane->base; omap_plane->apply.pre_apply = omap_plane_pre_apply; omap_plane->apply.post_apply = omap_plane_post_apply; omap_plane->error_irq.irqmask = error_irqs[id]; omap_plane->error_irq.irq = omap_plane_error_irq; omap_irq_register(dev, &omap_plane->error_irq); drm_plane_init(dev, plane, (1 << priv->num_crtcs) - 1, &omap_plane_funcs, omap_plane->formats, omap_plane->nformats, private_plane); omap_plane_install_properties(plane, &plane->base); /* get our starting configuration, set defaults for parameters * we don't currently use, etc: */ info = &omap_plane->info; info->rotation_type = OMAP_DSS_ROT_DMA; info->rotation = OMAP_DSS_ROT_0; info->global_alpha = 0xff; info->mirror = 0; /* Set defaults depending on whether we are a CRTC or overlay * layer. * TODO add ioctl to give userspace an API to change this.. this * will come in a subsequent patch. */ if (private_plane) omap_plane->info.zorder = 0; else omap_plane->info.zorder = id; return plane; fail: if (plane) omap_plane_destroy(plane); return NULL; }