[Intel-gfx] [PATCH 12/13] drm/i915: Remove scratch page from shared

Rodrigo Vivi rodrigo.vivi at gmail.com
Thu Jan 17 00:10:55 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:
> We already had a mapping in both (minus the phys_addr in AGP).
>
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> ---
>  drivers/char/agp/intel-gtt.c        |  9 +++++----
>  drivers/gpu/drm/i915/i915_drv.h     |  2 ++
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 16 ++++++++--------
>  include/drm/intel-gtt.h             |  3 ---
>  4 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
> index f54ddc0..773ce8b 100644
> --- a/drivers/char/agp/intel-gtt.c
> +++ b/drivers/char/agp/intel-gtt.c
> @@ -75,6 +75,7 @@ static struct _intel_private {
>         struct resource ifp_resource;
>         int resource_valid;
>         struct page *scratch_page;
> +       phys_addr_t scratch_page_dma;
>         int refcount;
>         /* Size of memory reserved for graphics by the BIOS */
>         unsigned int stolen_size;
> @@ -307,9 +308,9 @@ static int intel_gtt_setup_scratch_page(void)
>                 if (pci_dma_mapping_error(intel_private.pcidev, dma_addr))
>                         return -EINVAL;
>
> -               intel_private.base.scratch_page_dma = dma_addr;
> +               intel_private.scratch_page_dma = dma_addr;
>         } else
> -               intel_private.base.scratch_page_dma = page_to_phys(page);
> +               intel_private.scratch_page_dma = page_to_phys(page);
>
>         intel_private.scratch_page = page;
>
> @@ -556,7 +557,7 @@ static unsigned int intel_gtt_mappable_entries(void)
>  static void intel_gtt_teardown_scratch_page(void)
>  {
>         set_pages_wb(intel_private.scratch_page, 1);
> -       pci_unmap_page(intel_private.pcidev, intel_private.base.scratch_page_dma,
> +       pci_unmap_page(intel_private.pcidev, intel_private.scratch_page_dma,
>                        PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
>         put_page(intel_private.scratch_page);
>         __free_page(intel_private.scratch_page);
> @@ -900,7 +901,7 @@ void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries)
>         unsigned int i;
>
>         for (i = first_entry; i < (first_entry + num_entries); i++) {
> -               intel_private.driver->write_entry(intel_private.base.scratch_page_dma,
> +               intel_private.driver->write_entry(intel_private.scratch_page_dma,
>                                                   i, 0);
>         }
>         readl(intel_private.gtt+i-1);
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 6c8b0b8..6637090 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -386,6 +386,8 @@ struct i915_gtt {
>         void __iomem *gsm;
>
>         bool do_idle_maps;
> +       dma_addr_t scratch_page_dma;
> +       struct page *scratch_page;
>  };
>  #define gtt_total_entries(gtt) ((gtt).total >> PAGE_SHIFT)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index afd5ec7..b7641f7 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -158,7 +158,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
>                 ppgtt->pt_dma_addr[i] = pt_addr;
>         }
>
> -       ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt->scratch_page_dma;
> +       ppgtt->scratch_page_dma_addr = dev_priv->gtt.scratch_page_dma;
>
>         i915_ppgtt_clear_range(ppgtt, 0,
>                                ppgtt->num_pd_entries*I915_PPGTT_PT_ENTRIES);
> @@ -391,7 +391,7 @@ static void i915_ggtt_clear_range(struct drm_device *dev,
>                  first_entry, num_entries, max_entries))
>                 num_entries = max_entries;
>
> -       scratch_pte = pte_encode(dev, dev_priv->mm.gtt->scratch_page_dma, I915_CACHE_LLC);
> +       scratch_pte = pte_encode(dev, dev_priv->gtt.scratch_page_dma, I915_CACHE_LLC);
>         for (i = 0; i < num_entries; i++)
>                 iowrite32(scratch_pte, &gtt_base[i]);
>         readl(gtt_base);
> @@ -656,8 +656,8 @@ static int setup_scratch_page(struct drm_device *dev)
>  #else
>         dma_addr = page_to_phys(page);
>  #endif
> -       dev_priv->mm.gtt->scratch_page = page;
> -       dev_priv->mm.gtt->scratch_page_dma = dma_addr;
> +       dev_priv->gtt.scratch_page = page;
> +       dev_priv->gtt.scratch_page_dma = dma_addr;
>
>         return 0;
>  }
> @@ -665,11 +665,11 @@ static int setup_scratch_page(struct drm_device *dev)
>  static void teardown_scratch_page(struct drm_device *dev)
>  {
>         struct drm_i915_private *dev_priv = dev->dev_private;
> -       set_pages_wb(dev_priv->mm.gtt->scratch_page, 1);
> -       pci_unmap_page(dev->pdev, dev_priv->mm.gtt->scratch_page_dma,
> +       set_pages_wb(dev_priv->gtt.scratch_page, 1);
> +       pci_unmap_page(dev->pdev, dev_priv->gtt.scratch_page_dma,
>                        PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
> -       put_page(dev_priv->mm.gtt->scratch_page);
> -       __free_page(dev_priv->mm.gtt->scratch_page);
> +       put_page(dev_priv->gtt.scratch_page);
> +       __free_page(dev_priv->gtt.scratch_page);
>  }
>
>  static inline unsigned int gen6_get_total_gtt_size(u16 snb_gmch_ctl)
> diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
> index 4982dca..ae55605 100644
> --- a/include/drm/intel-gtt.h
> +++ b/include/drm/intel-gtt.h
> @@ -4,9 +4,6 @@
>  #define        _DRM_INTEL_GTT_H
>
>  struct intel_gtt {
> -       /* Whether we idle the gpu before mapping/unmapping */
> -       dma_addr_t scratch_page_dma;
> -       struct page *scratch_page;
>  } *intel_gtt_get(void);
>
>  int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,
> --
> 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