On Tue, May 29, 2012 at 08:20:35PM +0200, Lars-Peter Clausen wrote: > This patchset introduces a set of helper function for implementing the KMS > framebuffer layer for drivers which use the drm gem CMA helper function. I just integrated this into my series. Works great, thanks. Would be great to have this mainline. Only some nitpicking and one missing kfree below. Sascha > +static void drm_fb_cma_destroy(struct drm_framebuffer *fb) > +{ > + struct drm_fb_cma *fb_cma = to_fb_cma(fb); > + > + if (fb_cma->obj) > + drm_gem_object_unreference_unlocked(&fb_cma->obj->base); > + > + drm_framebuffer_cleanup(fb); > + kfree(fb_cma); > +} > + > +static int drm_fb_cma_create_handle(struct drm_framebuffer *fb, > + struct drm_file *file_priv, unsigned int *handle) > +{ > + struct drm_fb_cma *fb_cma = to_fb_cma(fb); > + > + return drm_gem_handle_create(file_priv, > + &fb_cma->obj->base, handle); > +} > + > +static struct drm_framebuffer_funcs drm_fb_cma_funcs = { > + .destroy = drm_fb_cma_destroy, > + .create_handle = drm_fb_cma_create_handle, > +}; > + > +static struct drm_fb_cma *drm_fb_cma_alloc(struct drm_device *dev, > + struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_cma_obj *obj) > +{ > + struct drm_fb_cma *fb_cma; > + int ret; > + > + fb_cma = kzalloc(sizeof(*fb_cma), GFP_KERNEL); > + if (!fb_cma) > + return ERR_PTR(-ENOMEM); > + > + ret = drm_framebuffer_init(dev, &fb_cma->fb, &drm_fb_cma_funcs); > + if (ret) { > + dev_err(dev->dev, "Failed to initalize framebuffer: %d\n", ret); s/initalize/initialize/ kfree(fb_cma)? > + return ERR_PTR(ret); > + } > + > + > +/** > + * drm_fbdev_cma_init() - Allocate and initlaize a drm_fbdev_cma struct s/initlaize/initialize/ > + * @dev: DRM device > + * @prefered_bpp: Prefered bits per pixel for the device s/prefered/preferred/ > + * @num_crtc: Number of CRTCs > + * @max_conn_count: Maximum number of connectors > + * > + * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR. > + */ -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel