All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 4/4] drm: Renesas SH Mobile DRM driver
Date: Wed, 30 May 2012 17:16:46 +0300	[thread overview]
Message-ID: <20120530141646.GT13065@intel.com> (raw)
In-Reply-To: <1338381179-13290-5-git-send-email-laurent.pinchart@ideasonboard.com>

On Wed, May 30, 2012 at 02:32:59PM +0200, Laurent Pinchart wrote:
> +static struct drm_framebuffer *
> +shmob_drm_fb_create(struct drm_device *dev, struct drm_file *file_priv,
> +		    struct drm_mode_fb_cmd2 *mode_cmd)
> +{
> +	const struct shmob_drm_format_info *format;
> +	struct shmob_drm_framebuffer *sfb;
> +	struct drm_framebuffer *fb;
> +	struct drm_gem_object *obj;
> +	unsigned int i;
> +	int ret;
> +
> +	format = shmob_drm_format_info(mode_cmd->pixel_format);
> +	if (format == NULL) {
> +		dev_dbg(dev->dev, "unsupported pixel format %08x\n",
> +			mode_cmd->pixel_format);
> +		return ERR_PTR(-EINVAL);
> +	}
> +
> +	sfb = kzalloc(sizeof(*fb), GFP_KERNEL);
> +	if (sfb == NULL)
> +		return ERR_PTR(-ENOMEM);
> +
> +	sfb->format = format;
> +	fb = &sfb->base;
> +
> +	for (i = 0; i < (format->yuv ? 2 : 1); ++i) {
> +		obj = drm_gem_object_lookup(dev, file_priv,
> +					    mode_cmd->handles[i]);
> +		if (obj == NULL) {
> +			dev_dbg(dev->dev, "GEM object %u not found\n",
> +				mode_cmd->handles[i]);
> +			ret = -ENOENT;
> +			goto error;
> +		}
> +		sfb->sobj[i] = to_shmob_gem_object(obj);
> +	}

offsets[] not checked, nor is it handled in the code that calculates
the final offsets.

Based on the rest of the code, it seems that the hardware assumes
pitches[1] == pitches[0]*chroma_cpp. You should reject other values
here. Also it's not clear from the code if there are other stride
limitations that would need checking.

Also there are no checks to make sure the fb fits inside the gem object.
At one point I tried to cook up a generic function to help with such
checks. I probably need to revisit that issue and try to make something
that'd work for tiled formats as well.

-- 
Ville Syrjälä
Intel OTC

  parent reply	other threads:[~2012-05-30 14:16 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30 12:32 [PATCH 0/4] Renesas SH Mobile DRM driver Laurent Pinchart
2012-05-30 12:32 ` [PATCH 1/4] fbdev: sh_mobile_meram: Add MERAM operations wrappers Laurent Pinchart
2012-05-30 12:32 ` [PATCH 2/4] fbdev: sh_mobile_lcdc: Use " Laurent Pinchart
2012-05-30 12:32 ` [PATCH 3/4] drm: Add NV24 and NV42 pixel formats Laurent Pinchart
2012-05-30 13:09   ` Ville Syrjälä
2012-05-30 13:20     ` Laurent Pinchart
2012-05-30 14:05       ` Ville Syrjälä
2012-05-30 14:09         ` Laurent Pinchart
2012-05-30 12:32 ` [PATCH 4/4] drm: Renesas SH Mobile DRM driver Laurent Pinchart
2012-05-30 13:43   ` Sascha Hauer
2012-05-30 13:48     ` Lars-Peter Clausen
2012-05-30 14:12     ` Laurent Pinchart
2012-05-30 14:16   ` Ville Syrjälä [this message]
2012-06-27 12:40     ` Laurent Pinchart
2012-05-30 14:45   ` Lars-Peter Clausen
2012-05-30 15:10     ` Lars-Peter Clausen
2012-06-27 12:40       ` Laurent Pinchart
2012-06-27 20:06         ` Lars-Peter Clausen
2012-06-27 20:27           ` Laurent Pinchart
2012-06-27 20:56             ` Lars-Peter Clausen
2012-05-30 16:40   ` Sascha Hauer
2012-05-31  9:42     ` 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=20120530141646.GT13065@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --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.