summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2008-04-06 11:21:22 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2008-04-06 11:21:22 +0200
commite89710bef7691e4e9d0bc7d427542bfae6ce4258 (patch)
tree2ca7ffbf7ed1c19226c4d0246552a4597b25b9df /linux-core
parentc3888b97f60fbbc0b1382e5a16689eecaa2f79a5 (diff)
Place highmem pages last in the ttm page array.
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_objects.h2
-rw-r--r--linux-core/drm_ttm.c12
2 files changed, 11 insertions, 3 deletions
diff --git a/linux-core/drm_objects.h b/linux-core/drm_objects.h
index 9bd04fff..c32edacd 100644
--- a/linux-core/drm_objects.h
+++ b/linux-core/drm_objects.h
@@ -311,6 +311,8 @@ struct drm_ttm_backend {
struct drm_ttm {
struct page *dummy_read_page;
struct page **pages;
+ long first_himem_page;
+ long last_lomem_page;
uint32_t page_flags;
unsigned long num_pages;
atomic_t vma_count;
diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c
index da202a58..c306a2c0 100644
--- a/linux-core/drm_ttm.c
+++ b/linux-core/drm_ttm.c
@@ -263,12 +263,16 @@ struct page *drm_ttm_get_page(struct drm_ttm *ttm, int index)
struct page *p;
struct drm_buffer_manager *bm = &ttm->dev->bm;
- p = ttm->pages[index];
- if (!p) {
+ while(NULL == (p = ttm->pages[index])) {
p = drm_ttm_alloc_page();
if (!p)
return NULL;
- ttm->pages[index] = p;
+
+ if (PageHighMem(p))
+ ttm->pages[--ttm->first_himem_page] = p;
+ else
+ ttm->pages[++ttm->last_lomem_page] = p;
+
++bm->cur_pages;
}
return p;
@@ -376,6 +380,8 @@ struct drm_ttm *drm_ttm_create(struct drm_device *dev, unsigned long size,
ttm->destroy = 0;
ttm->num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
+ ttm->first_himem_page = ttm->num_pages;
+ ttm->last_lomem_page = -1;
ttm->page_flags = page_flags;