[PATCH v2] DRM: add drm gem cma helper
Sascha Hauer
s.hauer at pengutronix.de
Wed Jun 6 01:20:24 PDT 2012
On Tue, Jun 05, 2012 at 10:54:10PM +0900, InKi Dae wrote:
> 2012/6/5 Sascha Hauer <s.hauer at pengutronix.de>:
> > On Fri, Jun 01, 2012 at 12:29:47AM +0900, InKi Dae wrote:
> >> Hi Sascha,
> >>
> >> >> +struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
> >> >> + unsigned int size)
> >> >> +{
> >> >> + struct drm_gem_cma_object *cma_obj;
> >> >> + struct drm_gem_object *gem_obj;
> >> >> + int ret;
> >> >> +
> >> >> + size = round_up(size, PAGE_SIZE);
> >> >> +
> >> >> + cma_obj = kzalloc(sizeof(*cma_obj), GFP_KERNEL);
> >> >> + if (!cma_obj)
> >> >> + return ERR_PTR(-ENOMEM);
> >> >> +
> >> >> + cma_obj->vaddr = dma_alloc_writecombine(drm->dev, size,
> >> >> + &cma_obj->paddr, GFP_KERNEL | __GFP_NOWARN);
> >>
> >> how about calling drm_gem_cma_buf_allocate() instead of
> >> dma_alloc_wirtecombine() for consistency in using dma api so its call
> >> flow would be "dma_gem_cma_buf_allocate() ->
> >> dma_alloc_writecombine()".
> >
> > What do you mean? There is no drm_gem_cma_buf_allocate() function.
> >
>
> I mean have a pair with drm_gem_cma_buf_destroy() otherwise how about
> removing dem_gem_cma_buf_destroy() and calling dma_free_writecombine()
> directly? drm_gem_cma_buf_destroy() is just a wrapper to
> dma_free_writecombine().
Ok, then I'll remove drm_gem_cma_buf_destroy() and use
dma_free_writecombine() directly instead.
Sascha
--
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 |
More information about the dri-devel
mailing list