]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
agp/intel-gtt: export the scratch page dma address
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 9 Feb 2012 16:15:44 +0000 (17:15 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 9 Feb 2012 20:23:18 +0000 (21:23 +0100)
To implement a PPGTT for drm/i915 that fully aliases the GTT, we also
need to properly alias the scratch page.

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Tested-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/char/agp/intel-gtt.c
include/drm/intel-gtt.h

index c92424ca1a55370dcdaa7798cb6eb1ae6fbdd90c..0a305acb0374b7350f1d60094b161c14bb85f1a9 100644 (file)
@@ -76,7 +76,6 @@ static struct _intel_private {
        struct resource ifp_resource;
        int resource_valid;
        struct page *scratch_page;
-       dma_addr_t scratch_page_dma;
 } intel_private;
 
 #define INTEL_GTT_GEN  intel_private.driver->gen
@@ -306,9 +305,9 @@ static int intel_gtt_setup_scratch_page(void)
                if (pci_dma_mapping_error(intel_private.pcidev, dma_addr))
                        return -EINVAL;
 
-               intel_private.scratch_page_dma = dma_addr;
+               intel_private.base.scratch_page_dma = dma_addr;
        } else
-               intel_private.scratch_page_dma = page_to_phys(page);
+               intel_private.base.scratch_page_dma = page_to_phys(page);
 
        intel_private.scratch_page = page;
 
@@ -631,7 +630,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.scratch_page_dma,
+       pci_unmap_page(intel_private.pcidev, intel_private.base.scratch_page_dma,
                       PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
        put_page(intel_private.scratch_page);
        __free_page(intel_private.scratch_page);
@@ -975,7 +974,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.scratch_page_dma,
+               intel_private.driver->write_entry(intel_private.base.scratch_page_dma,
                                                  i, 0);
        }
        readl(intel_private.gtt+i-1);
index b174620cc9b3a7a228234e56b9355b92a02cb479..6d4c77ac7d760f5dcc9e00b638c570dd16819538 100644 (file)
@@ -15,6 +15,8 @@ const struct intel_gtt {
        unsigned int needs_dmar : 1;
        /* Whether we idle the gpu before mapping/unmapping */
        unsigned int do_idle_maps : 1;
+       /* Share the scratch page dma with ppgtts. */
+       dma_addr_t scratch_page_dma;
 } *intel_gtt_get(void);
 
 void intel_gtt_chipset_flush(void);