dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4] DRM: add drm gem CMA helper
Date: Wed, 27 Jun 2012 15:47:47 +0200	[thread overview]
Message-ID: <5082837.ba4um2KX8D@avalon> (raw)
In-Reply-To: <1340803818-25834-1-git-send-email-s.hauer@pengutronix.de>

Hi Sascha,

Thanks for the patch.

Just one small comment below.

On Wednesday 27 June 2012 15:30:18 Sascha Hauer wrote:

[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;
> +	int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
> +
> +	if (args->pitch < min_pitch)
> +		args->pitch = min_pitch;

args->pitch is unsigned, so I would make min_pitch an unsigned int.

> +
> +	if (args->size < args->pitch * args->height)
> +		args->size = args->pitch * args->height;
> +
> +	cma_obj = drm_gem_cma_create_with_handle(file_priv, dev,
> +			args->size, &args->handle);
> +	if (IS_ERR(cma_obj))
> +		return PTR_ERR(cma_obj);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(drm_gem_cma_dumb_create);

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2012-06-27 13:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27 13:30 [PATCH v4] DRM: add drm gem CMA helper Sascha Hauer
2012-06-27 13:47 ` Laurent Pinchart [this message]
2012-07-18 14:17 ` Lars-Peter Clausen
2012-08-08 14:44 ` Laurent Pinchart
2012-08-08 16:25   ` Lars-Peter Clausen
2012-08-08 16:31     ` Laurent Pinchart
2012-08-08 21:02       ` Dave Airlie
2012-08-08 21:29         ` Laurent Pinchart

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=5082837.ba4um2KX8D@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=s.hauer@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox