Proper allocation of AGP pages for ttms.

main
Thomas Hellstrom 2006-12-27 15:32:09 +01:00
parent c38ede0667
commit 975136d6e5
4 changed files with 9 additions and 20 deletions

View File

@ -251,7 +251,8 @@ struct page *drm_vm_ttm_nopage(struct vm_area_struct *vma,
page = NOPAGE_OOM;
goto out;
}
page = ttm->pages[page_offset] = drm_alloc_gatt_pages(0);
page = ttm->pages[page_offset] =
alloc_page(GFP_KERNEL | __GFP_ZERO | GFP_DMA32);
if (!page) {
drm_free_memctl(PAGE_SIZE);
page = NOPAGE_OOM;
@ -259,8 +260,6 @@ struct page *drm_vm_ttm_nopage(struct vm_area_struct *vma,
}
++bm->cur_pages;
SetPageLocked(page);
clear_page(kmap(page));
kunmap(page);
}
get_page(page);

View File

@ -180,16 +180,9 @@ extern void drm_clear_vma(struct vm_area_struct *vma,
extern pgprot_t vm_get_page_prot(unsigned long vm_flags);
/*
* These are similar to the current kernel gatt pages allocator, only that we
* want a struct page pointer instead of a virtual address. This allows for pages
* that are not in the kernel linear map.
*/
#define drm_alloc_gatt_pages(order) ({ \
void *_virt = alloc_gatt_pages(order); \
((_virt) ? virt_to_page(_virt) : NULL);})
#define drm_free_gatt_pages(pages, order) free_gatt_pages(page_address(pages), order)
#ifndef GFP_DMA32
#define GFP_DMA32 0
#endif
#if defined(CONFIG_X86) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))

View File

@ -193,7 +193,7 @@ int drm_destroy_ttm(drm_ttm_t * ttm)
* End debugging.
*/
drm_free_gatt_pages(*cur_page, 0);
__free_page(*cur_page);
drm_free_memctl(PAGE_SIZE);
--bm->cur_pages;
}
@ -225,7 +225,7 @@ static int drm_ttm_populate(drm_ttm_t * ttm)
if (drm_alloc_memctl(PAGE_SIZE)) {
return -ENOMEM;
}
page = drm_alloc_gatt_pages(0);
page = alloc_page(GFP_KERNEL | __GFP_ZERO | GFP_DMA32);
if (!page) {
drm_free_memctl(PAGE_SIZE);
return -ENOMEM;
@ -235,8 +235,6 @@ static int drm_ttm_populate(drm_ttm_t * ttm)
#else
SetPageReserved(page);
#endif
clear_page(kmap(page));
kunmap(page);
ttm->pages[i] = page;
++bm->cur_pages;
}

View File

@ -208,7 +208,8 @@ struct page *drm_vm_ttm_fault(struct vm_area_struct *vma,
data->type = VM_FAULT_OOM;
goto out;
}
page = ttm->pages[page_offset] = drm_alloc_gatt_pages(0);
page = ttm->pages[page_offset] =
alloc_page(GFP_KERNEL | __GFP_ZERO | GFP_DMA32);
if (!page) {
drm_free_memctl(PAGE_SIZE);
data->type = VM_FAULT_OOM;
@ -220,8 +221,6 @@ struct page *drm_vm_ttm_fault(struct vm_area_struct *vma,
#else
SetPageReserved(page);
#endif
clear_page(kmap(page));
kunmap(page);
}
if (ttm->page_flags & DRM_TTM_PAGE_UNCACHED) {