Eric Anholt wrote:
> On Sun, 2008-04-06 at 02:21 -0700, Thomas Hellstrom wrote:
>
>> linux-core/drm_objects.h | 2 ++
>> linux-core/drm_ttm.c | 12 +++++++++---
>> 2 files changed, 11 insertions(+), 3 deletions(-)
>>
>> New commits:
>> commit e89710bef7691e4e9d0bc7d427542bfae6ce4258
>> Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
>> Date: Sun Apr 6 11:21:22 2008 +0200
>>
>> Place highmem pages last in the ttm page array.
>>
>
> Could you add a comment explaining what this is about?
>
This is to prepare for Dave's linux 2.6.26 set_memory_uc_array()
interface which accepts an array of virtual addresses, and hence no
highmem pages.
We have two ways to handle this
a) Allocate a new temporary array that holds the virtual addresses. This
will in many cases fall back to using slow vmalloc() and not desirable.
b) Temporarily (during the set_memory_uc_array() call only) typecast the
page array entries and replace the (struct page) pointers with unsigned
long virtual addresses for the lomem pages. This avoids the vmalloc()
but OTOH is a bit ugly.
The above commit is to pave the way for b) if we want to go that way.
/Thomas
>> diff --git a/linux-core/drm_objects.h b/linux-core/drm_objects.h
>> index 9bd04ff..c32edac 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 da202a5..c306a2c 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;
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>> Register now and save $200. Hurry, offer ends at 11:59 p.m.,
>> Monday, April 7! Use priority code J8TLD2.
>> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>> --
>> _______________________________________________
>> Dri-patches mailing list
>> [EMAIL PROTECTED]
>> https://lists.sourceforge.net/lists/listinfo/dri-patches
>>
>> ------------------------------------------------------------------------
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>> Register now and save $200. Hurry, offer ends at 11:59 p.m.,
>> Monday, April 7! Use priority code J8TLD2.
>> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>> ------------------------------------------------------------------------
>>
>> --
>> _______________________________________________
>> Dri-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/dri-devel
>>
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel