All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2] DRM: add drm gem cma helper
Date: Tue, 5 Jun 2012 09:49:48 +0200	[thread overview]
Message-ID: <20120605074948.GO30400@pengutronix.de> (raw)
In-Reply-To: <2093871.VgT5F32Ubz@avalon>

On Thu, May 31, 2012 at 11:36:15AM +0200, Laurent Pinchart wrote:
> Hi Sascha,
> 
> > +	depends on DRM
> > +	help
> > +	  Choose this if you need the GEM cma helper functions
> 
> I would put CMA in uppercase, but that's just nitpicking.
> 
> BTW this helper is not strictly dedicated to CMA. It uses the DMA API to 
> allocate memory, without caring about the underlying allocator.

Yes, I know. It's just that 'CMA' is short and expresses very much what
I mean. I first had 'dma_alloc' instead, but this makes the function
names quite long.

> > +
> > +/*
> > + * 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);
> 
> Shouldn't this be DIV_ROUND_UP(args->width * args->bpp, 8) ? Not all formats 
> might need to pad pixels to an integer number of bytes.

Are you thinking about YUV formats? I can't imagine RGB formats where
this might be an issue.

Integrated the rest of you comments.

Thanks
 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 |

  parent reply	other threads:[~2012-06-05  7:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-31  8:08 [PATCH v2] DRM: add drm gem cma helper Sascha Hauer
2012-05-31  9:36 ` Laurent Pinchart
2012-05-31 15:29   ` InKi Dae
2012-06-05  7:56     ` Sascha Hauer
2012-06-05 13:54       ` InKi Dae
2012-06-06  8:20         ` Sascha Hauer
2012-06-05  7:49   ` Sascha Hauer [this message]
2012-06-05  8:05     ` Laurent Pinchart
2012-06-04  9:08 ` Lars-Peter Clausen
2012-06-27 11:38 ` Laurent Pinchart
2012-06-27 13:01   ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120605074948.GO30400@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.