[Intel-gfx] [PATCH 08/13] drm/i915: Move stolen_size to the new struct

Rodrigo Vivi rodrigo.vivi at gmail.com
Wed Jan 16 21:49:23 CET 2013


Reviewed-by: Rodrigo Vivi <rodrigo.vivi at gmail.com>

On Tue, Jan 15, 2013 at 7:26 PM, Ben Widawsky <ben at bwidawsk.net> wrote:
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> ---
>  drivers/gpu/drm/i915/i915_drv.h        | 2 ++
>  drivers/gpu/drm/i915/i915_gem_gtt.c    | 7 ++++---
>  drivers/gpu/drm/i915/i915_gem_stolen.c | 8 ++++----
>  3 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 9d8f196..201da6d 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -380,6 +380,8 @@ struct i915_gtt {
>         struct io_mapping *mappable;    /* Mapping to our CPU mappable region */
>         phys_addr_t mappable_base;      /* PA of our GMADR */
>
> +       size_t stolen_size;
> +
>         /** "Graphics Stolen Memory" holds the global PTEs */
>         void __iomem *gsm;
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 5a7a4a9..e829f25 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -730,9 +730,9 @@ int i915_gem_gtt_init(struct drm_device *dev)
>         dev_priv->gtt.total = (gtt_size / sizeof(gtt_pte_t)) << PAGE_SHIFT;
>
>         if (INTEL_INFO(dev)->gen < 7)
> -               dev_priv->mm.gtt->stolen_size = gen6_get_stolen_size(snb_gmch_ctl);
> +               dev_priv->gtt.stolen_size = gen6_get_stolen_size(snb_gmch_ctl);
>         else
> -               dev_priv->mm.gtt->stolen_size = gen7_get_stolen_size(snb_gmch_ctl);
> +               dev_priv->gtt.stolen_size = gen7_get_stolen_size(snb_gmch_ctl);
>
>         /* 64/512MB is the current min/max we actually know of, but this is just a
>          * coarse sanity check.
> @@ -763,7 +763,8 @@ int i915_gem_gtt_init(struct drm_device *dev)
>         DRM_INFO("Memory usable by graphics device = %zdM\n",
>                  dev_priv->gtt.total >> 20);
>         DRM_DEBUG_DRIVER("GMADR size = %ldM\n", dev_priv->gtt.mappable_end >> 20);
> -       DRM_DEBUG_DRIVER("GTT stolen size = %dM\n", dev_priv->mm.gtt->stolen_size >> 20);
> +       DRM_DEBUG_DRIVER("GTT stolen size = %zdM\n",
> +                        dev_priv->gtt.stolen_size >> 20);
>
>         return 0;
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index f21ae17..69d97cb 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -187,11 +187,11 @@ int i915_gem_init_stolen(struct drm_device *dev)
>         if (dev_priv->mm.stolen_base == 0)
>                 return 0;
>
> -       DRM_DEBUG_KMS("found %d bytes of stolen memory at %08lx\n",
> -                     dev_priv->mm.gtt->stolen_size, dev_priv->mm.stolen_base);
> +       DRM_DEBUG_KMS("found %zd bytes of stolen memory at %08lx\n",
> +                     dev_priv->gtt.stolen_size, dev_priv->mm.stolen_base);
>
>         /* Basic memrange allocator for stolen space */
> -       drm_mm_init(&dev_priv->mm.stolen, 0, dev_priv->mm.gtt->stolen_size);
> +       drm_mm_init(&dev_priv->mm.stolen, 0, dev_priv->gtt.stolen_size);
>
>         return 0;
>  }
> @@ -205,7 +205,7 @@ i915_pages_create_for_stolen(struct drm_device *dev,
>         struct scatterlist *sg;
>
>         DRM_DEBUG_DRIVER("offset=0x%x, size=%d\n", offset, size);
> -       BUG_ON(offset > dev_priv->mm.gtt->stolen_size - size);
> +       BUG_ON(offset > dev_priv->gtt.stolen_size - size);
>
>         /* We hide that we have no struct page backing our stolen object
>          * by wrapping the contiguous physical allocation with a fake
> --
> 1.8.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Rodrigo Vivi
Blog: http://blog.vivi.eng.br



More information about the Intel-gfx mailing list