From: Sascha Hauer Subject: Re: [PATCH v2] DRM: add drm gem cma helper Date: Wed, 6 Jun 2012 10:20:24 +0200 Message-ID: <20120606082024.GW30400@pengutronix.de> References: <1338451734-20232-1-git-send-email-s.hauer@pengutronix.de> <2093871.VgT5F32Ubz@avalon> <20120605075621.GP30400@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Return-path: Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [92.198.50.35]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E9419E811 for ; Wed, 6 Jun 2012 01:20:33 -0700 (PDT) Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: InKi Dae Cc: Laurent Pinchart , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Tue, Jun 05, 2012 at 10:54:10PM +0900, InKi Dae wrote: > 2012/6/5 Sascha Hauer : > > 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 *d= rm, > >> >> + =A0 =A0 =A0 =A0 =A0 =A0 unsigned int size) > >> >> +{ > >> >> + =A0 =A0 struct drm_gem_cma_object *cma_obj; > >> >> + =A0 =A0 struct drm_gem_object *gem_obj; > >> >> + =A0 =A0 int ret; > >> >> + > >> >> + =A0 =A0 size =3D round_up(size, PAGE_SIZE); > >> >> + > >> >> + =A0 =A0 cma_obj =3D kzalloc(sizeof(*cma_obj), GFP_KERNEL); > >> >> + =A0 =A0 if (!cma_obj) > >> >> + =A0 =A0 =A0 =A0 =A0 =A0 return ERR_PTR(-ENOMEM); > >> >> + > >> >> + =A0 =A0 cma_obj->vaddr =3D dma_alloc_writecombine(drm->dev, size, > >> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &cma_obj->paddr, GFP_KERN= EL | __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 |