public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/i915: check gem bo size when creating framebuffers
Date: Wed, 9 Oct 2013 13:07:49 +0300	[thread overview]
Message-ID: <20131009100749.GB13047@intel.com> (raw)
In-Reply-To: <1381307588-25281-1-git-send-email-daniel.vetter@ffwll.ch>

On Wed, Oct 09, 2013 at 10:33:08AM +0200, Daniel Vetter wrote:
> It's better to catch such fallout early, and this way we can rely on
> the checking done by the drm core on fb->heigh/width at modeset time.
> 
> If we ever support planar formats on intel we might want to look into
> a common helper to do all this, but for now this is good enough.

I had a helper to do that, and I think I even posted it a few times. But
it didn't take tiling into account, so I didn't feel it was quite good
enough. I think this may be the last one:
http://lists.freedesktop.org/archives/dri-devel/2011-December/017581.html

Your patch doesn't account for tiling either.

> 
> Requested-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index f5126b8..3073154 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -10069,6 +10069,10 @@ int intel_framebuffer_init(struct drm_device *dev,
>  	if (mode_cmd->offsets[0] != 0)
>  		return -EINVAL;
>  
> +	/* FIXME drm helper for size checks (especially planar formats)? */
> +	if (obj->base.size < mode_cmd->height * mode_cmd->pitches[0])
> +		return -EINVAL;
> +
>  	drm_helper_mode_fill_fb_struct(&intel_fb->base, mode_cmd);
>  	intel_fb->obj = obj;
>  
> -- 
> 1.8.4.rc3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2013-10-09 10:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-09  8:33 [PATCH] drm/i915: check gem bo size when creating framebuffers Daniel Vetter
2013-10-09 10:07 ` Ville Syrjälä [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-10-09 19:23 [PATCH 4/4] " Daniel Vetter
2013-10-09 19:55 ` [PATCH] " Daniel Vetter

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=20131009100749.GB13047@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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