diff options
author | Dave Airlie <airlied@redhat.com> | 2009-06-12 00:11:41 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-06-18 20:21:42 -0400 |
commit | 07613ba2f464f59949266f4337b75b91eb610795 (patch) | |
tree | 8e43a82571686492aba2269c2e7a49c323783af1 /drivers/gpu | |
parent | 2908826d045a89805714e0a3055a99dc40565d41 (diff) |
agp: switch AGP to use page array instead of unsigned long array
This switches AGP to use an array of pages for tracking the
pages allocated to the GART. This should enable GEM on PAE to work
a lot better as we can pass highmem pages to the PAT code and it will
do the right thing with them.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/drm_agpsupport.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_memory.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_vm.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_agp_backend.c | 3 |
4 files changed, 8 insertions, 9 deletions
diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c index 7a0d042c8d6a..d68888fe3df9 100644 --- a/drivers/gpu/drm/drm_agpsupport.c +++ b/drivers/gpu/drm/drm_agpsupport.c | |||
@@ -482,7 +482,7 @@ drm_agp_bind_pages(struct drm_device *dev, | |||
482 | } | 482 | } |
483 | 483 | ||
484 | for (i = 0; i < num_pages; i++) | 484 | for (i = 0; i < num_pages; i++) |
485 | mem->memory[i] = phys_to_gart(page_to_phys(pages[i])); | 485 | mem->pages[i] = pages[i]; |
486 | mem->page_count = num_pages; | 486 | mem->page_count = num_pages; |
487 | 487 | ||
488 | mem->is_flushed = true; | 488 | mem->is_flushed = true; |
diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c index 0a436184dd88..e4865f99989c 100644 --- a/drivers/gpu/drm/drm_memory.c +++ b/drivers/gpu/drm/drm_memory.c | |||
@@ -59,10 +59,11 @@ int drm_mem_info(char *buf, char **start, off_t offset, | |||
59 | static void *agp_remap(unsigned long offset, unsigned long size, | 59 | static void *agp_remap(unsigned long offset, unsigned long size, |
60 | struct drm_device * dev) | 60 | struct drm_device * dev) |
61 | { | 61 | { |
62 | unsigned long *phys_addr_map, i, num_pages = | 62 | unsigned long i, num_pages = |
63 | PAGE_ALIGN(size) / PAGE_SIZE; | 63 | PAGE_ALIGN(size) / PAGE_SIZE; |
64 | struct drm_agp_mem *agpmem; | 64 | struct drm_agp_mem *agpmem; |
65 | struct page **page_map; | 65 | struct page **page_map; |
66 | struct page **phys_page_map; | ||
66 | void *addr; | 67 | void *addr; |
67 | 68 | ||
68 | size = PAGE_ALIGN(size); | 69 | size = PAGE_ALIGN(size); |
@@ -89,10 +90,9 @@ static void *agp_remap(unsigned long offset, unsigned long size, | |||
89 | if (!page_map) | 90 | if (!page_map) |
90 | return NULL; | 91 | return NULL; |
91 | 92 | ||
92 | phys_addr_map = | 93 | phys_page_map = (agpmem->memory->pages + (offset - agpmem->bound) / PAGE_SIZE); |
93 | agpmem->memory->memory + (offset - agpmem->bound) / PAGE_SIZE; | ||
94 | for (i = 0; i < num_pages; ++i) | 94 | for (i = 0; i < num_pages; ++i) |
95 | page_map[i] = pfn_to_page(phys_addr_map[i] >> PAGE_SHIFT); | 95 | page_map[i] = phys_page_map[i]; |
96 | addr = vmap(page_map, num_pages, VM_IOREMAP, PAGE_AGP); | 96 | addr = vmap(page_map, num_pages, VM_IOREMAP, PAGE_AGP); |
97 | vfree(page_map); | 97 | vfree(page_map); |
98 | 98 | ||
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c index f95d03ac9784..7e1fbe5d4779 100644 --- a/drivers/gpu/drm/drm_vm.c +++ b/drivers/gpu/drm/drm_vm.c | |||
@@ -144,14 +144,14 @@ static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
144 | * Get the page, inc the use count, and return it | 144 | * Get the page, inc the use count, and return it |
145 | */ | 145 | */ |
146 | offset = (baddr - agpmem->bound) >> PAGE_SHIFT; | 146 | offset = (baddr - agpmem->bound) >> PAGE_SHIFT; |
147 | page = virt_to_page(__va(agpmem->memory->memory[offset])); | 147 | page = agpmem->memory->pages[offset]; |
148 | get_page(page); | 148 | get_page(page); |
149 | vmf->page = page; | 149 | vmf->page = page; |
150 | 150 | ||
151 | DRM_DEBUG | 151 | DRM_DEBUG |
152 | ("baddr = 0x%llx page = 0x%p, offset = 0x%llx, count=%d\n", | 152 | ("baddr = 0x%llx page = 0x%p, offset = 0x%llx, count=%d\n", |
153 | (unsigned long long)baddr, | 153 | (unsigned long long)baddr, |
154 | __va(agpmem->memory->memory[offset]), | 154 | agpmem->memory->pages[offset], |
155 | (unsigned long long)offset, | 155 | (unsigned long long)offset, |
156 | page_count(page)); | 156 | page_count(page)); |
157 | return 0; | 157 | return 0; |
diff --git a/drivers/gpu/drm/ttm/ttm_agp_backend.c b/drivers/gpu/drm/ttm/ttm_agp_backend.c index e8f6d2229d8c..4648ed2f0143 100644 --- a/drivers/gpu/drm/ttm/ttm_agp_backend.c +++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c | |||
@@ -63,8 +63,7 @@ static int ttm_agp_populate(struct ttm_backend *backend, | |||
63 | if (!page) | 63 | if (!page) |
64 | page = dummy_read_page; | 64 | page = dummy_read_page; |
65 | 65 | ||
66 | mem->memory[mem->page_count++] = | 66 | mem->pages[mem->page_count++] = page; |
67 | phys_to_gart(page_to_phys(page)); | ||
68 | } | 67 | } |
69 | agp_be->mem = mem; | 68 | agp_be->mem = mem; |
70 | return 0; | 69 | return 0; |