summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-05-01 17:31:29 -0700
committerEric Anholt <eric@anholt.net>2008-05-01 17:31:29 -0700
commitddc80651d561ef3820e205255f34dc7c60dc2e7c (patch)
treeb929027098b98dc59d5a26aa5cbfd75508563b18 /linux-core
parent3f641b56c79d48f7e11aa3eb1dc678e09c8e01f7 (diff)
Fix offset passed to AGP to be pages instead of bytes.
Fix some utterly bonged loop while we were staring at it.
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_agpsupport.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c
index 15400386..d6594b87 100644
--- a/linux-core/drm_agpsupport.c
+++ b/linux-core/drm_agpsupport.c
@@ -497,9 +497,8 @@ drm_agp_bind_pages(struct drm_device *dev,
unsigned long num_pages,
uint32_t gtt_offset)
{
- struct page **cur_page, **last_page = pages + num_pages;
DRM_AGP_MEM *mem;
- int ret;
+ int ret, i;
DRM_DEBUG("drm_agp_populate_ttm\n");
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)
@@ -514,17 +513,14 @@ drm_agp_bind_pages(struct drm_device *dev,
return NULL;
}
- mem->page_count = 0;
- for (cur_page = pages; cur_page < last_page; ++cur_page) {
- struct page *page = *cur_page;
-
- mem->memory[mem->page_count++] =
- phys_to_gart(page_to_phys(page));
- }
+ for (i = 0; i < num_pages; i++)
+ mem->memory[i] = phys_to_gart(page_to_phys(pages[i]));
+ mem->page_count = num_pages;
mem->is_flushed = TRUE;
- ret = drm_agp_bind_memory(mem, gtt_offset);
+ ret = drm_agp_bind_memory(mem, gtt_offset / PAGE_SIZE);
if (ret != 0) {
+ DRM_ERROR("Failed to bind AGP memory: %d\n", ret);
agp_free_memory(mem);
return NULL;
}