From: Sascha Hauer Subject: Re: [PATCH] DRM: add drm gem CMA helper Date: Wed, 27 Jun 2012 15:43:11 +0200 Message-ID: <20120627134311.GM1623@pengutronix.de> References: <1340802005-5281-1-git-send-email-s.hauer@pengutronix.de> <2339925.fypckIckO8@avalon> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [92.198.50.35]) by gabe.freedesktop.org (Postfix) with ESMTP id 1AB7A9E819 for ; Wed, 27 Jun 2012 06:43:13 -0700 (PDT) Content-Disposition: inline In-Reply-To: <2339925.fypckIckO8@avalon> 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: Laurent Pinchart Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Wed, Jun 27, 2012 at 03:20:27PM +0200, Laurent Pinchart wrote: > Hi Sascha, > > Thanks for the patch. > > On Wednesday 27 June 2012 15:00:05 Sascha Hauer wrote: > > Many embedded drm devices do not have a IOMMU and no dedicated > > memory for graphics. These devices use CMA (Contiguous Memory > > Allocator) backed graphics memory. This patch provides helper > > functions to be able to share the code. The code technically does > > not depend on CMA as the backend allocator, the name has been chosen > > because cma makes for a nice, short but still descriptive function > > prefix. > > > > Signed-off-by: Sascha Hauer > > --- > > > > changes since v2: > > - make drm_gem_cma_create_with_handle static > > - use DIV_ROUND_UP(args->width * args->bpp, 8) to calculate the pitch > > [snip] > > > diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c > > b/drivers/gpu/drm/drm_gem_cma_helper.c new file mode 100644 > > index 0000000..417f45e5 > > --- /dev/null > > +++ b/drivers/gpu/drm/drm_gem_cma_helper.c > > @@ -0,0 +1,250 @@ > > [snip] > > > +#include > > +#include > > +#include > > +#include > > +#include > > Nitpicking, I usually sort headers alphabetically, that helps locating > duplicates quickly. It's not mandatory though. > > [snip] > > > +/* > > + * drm_gem_cma_dumb_create - (struct drm_driver)->dumb_create callback > > + * function > > + * > > + * This aligns the pitch and size arguments to the minimum required. wrap > > + * this into your own function if you need bigger alignment. > > + */ > > +int drm_gem_cma_dumb_create(struct drm_file *file_priv, > > + struct drm_device *dev, struct drm_mode_create_dumb *args) > > +{ > > + struct drm_gem_cma_object *cma_obj; > > + > > + if (args->pitch < args->width * DIV_ROUND_UP(args->bpp, 8)) > > + args->pitch = args->width * DIV_ROUND_UP(args->bpp, 8); > > It's nice to mention in the changelog that you fixed the problem, but it would > be even nicer to really fix it ;-) Damn ;) 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 |