summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;