diff mbox

[02/13] drm/i915: Mappable_end can't ever be > end

Message ID 1358285181-2128-3-git-send-email-ben@bwidawsk.net (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky Jan. 15, 2013, 9:26 p.m. UTC
Both DRI1 and DRI2 can never specify a mappable size which goes past the
GTT size.  Don't pretend otherwise.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Rodrigo Vivi Jan. 16, 2013, 8:26 p.m. UTC | #1
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>

On Tue, Jan 15, 2013 at 7:26 PM, Ben Widawsky <ben@bwidawsk.net> wrote:
> Both DRI1 and DRI2 can never specify a mappable size which goes past the
> GTT size.  Don't pretend otherwise.
>
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 63da446..6c068b0 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -536,6 +536,8 @@ void i915_gem_setup_global_gtt(struct drm_device *dev,
>         struct drm_i915_gem_object *obj;
>         unsigned long hole_start, hole_end;
>
> +       BUG_ON(mappable_end > end);
> +
>         /* Subtract the guard page ... */
>         drm_mm_init(&dev_priv->mm.gtt_space, start, end - start - PAGE_SIZE);
>         if (!HAS_LLC(dev))
> @@ -557,7 +559,7 @@ void i915_gem_setup_global_gtt(struct drm_device *dev,
>         dev_priv->mm.gtt_start = start;
>         dev_priv->mm.gtt_mappable_end = mappable_end;
>         dev_priv->mm.gtt_total = end - start;
> -       dev_priv->mm.mappable_gtt_total = min(end, mappable_end) - start;
> +       dev_priv->mm.mappable_gtt_total = mappable_end - start;
>
>         /* Clear any non-preallocated blocks */
>         drm_mm_for_each_hole(entry, &dev_priv->mm.gtt_space,
> --
> 1.8.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 63da446..6c068b0 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -536,6 +536,8 @@  void i915_gem_setup_global_gtt(struct drm_device *dev,
 	struct drm_i915_gem_object *obj;
 	unsigned long hole_start, hole_end;
 
+	BUG_ON(mappable_end > end);
+
 	/* Subtract the guard page ... */
 	drm_mm_init(&dev_priv->mm.gtt_space, start, end - start - PAGE_SIZE);
 	if (!HAS_LLC(dev))
@@ -557,7 +559,7 @@  void i915_gem_setup_global_gtt(struct drm_device *dev,
 	dev_priv->mm.gtt_start = start;
 	dev_priv->mm.gtt_mappable_end = mappable_end;
 	dev_priv->mm.gtt_total = end - start;
-	dev_priv->mm.mappable_gtt_total = min(end, mappable_end) - start;
+	dev_priv->mm.mappable_gtt_total = mappable_end - start;
 
 	/* Clear any non-preallocated blocks */
 	drm_mm_for_each_hole(entry, &dev_priv->mm.gtt_space,