Keith Packard wrote:

>On Fri, 2007-12-21 at 14:01 +0100, Thomas Hellström wrote:
>
>  
>
>>This looks like a good thing, but is there a way we can avoid doing this 
>>in the ttm backend?
>>Some backends (Poulsbo, and I think Dave's work on Radeon) implement a 
>>null populate() function and use the ttm page array directly.
>>
>>Hence we could perhaps use the dummy page in the ttm page directly,
>>like the user bo/ttm objects. That way we would also save a lot of ttm 
>>backend code.
>>    
>>
>
>I need to leave the CPU-visible page table blank so that writes from the
>process will fault in a real page. I don't know how to do that without
>keeping the ttm page list empty for these replaced pages.
>  
>
This should be easy. We can have drm_ttm_get_page() come in two 
varieties, one which tests
for NULL only and one that tests for dummy_page or NULL and allocates a 
new page if needed. drm_ttm_get_page() is called from the nopfn() function.

>Also, if we leave objects mapped to both CPU and GTT (as we should be
>able to do), we'd have to invalidate the GTT mapping when the CPU
>faulted in a new page. This may be harder than I thought.
>  
>
Currently it would involve idling the buffer, unbinding and rebinding 
the ttm, which is indeed  quite inefficient. We'd need a rebind() ttm 
backend method that can take a subset of the ttm pages.

>However, a larger issue at this point is making TTM buffer objects
>pageable -- with unpageable objects, I cannot make the X server use them
>for pixmaps yet as firefox would destroy your machine even faster. I
>suspect fixing that will have a fairly widespread effect on pagemapping
>throughout the DRM, so it might be best to start there with an eye to
>allowing dummy page mapping in the GTT.
>
>  
>
Making ttm buffer object pageable shouldn't be that complicated.
However, Linux makes it a bit awkward.

My idea for this is to only page out objects that are in local memory. 
If there are no objects in local memory when an accounting limit is hit 
we will have to simply walk the LRU lists and put objects in local memory.

An object accounting "soft" accounting threshold is a desired accounting 
limit which a pager worker thread will try to maintain. The "hard" 
accounting threshold will never be exceeded.

In Linux, pageable pages must be associated with a user-space process 
virtual memory area (vma) , so we simply remove the ttm reference on the 
page and put it in a user-supplied vma, using a VMA space allocator 
(drm_mm.c) and vm_insert_page(), leaving some kind of reference in the 
ttm. Either with page granularity (avoids VMA fragmentation),
or buffer object granularity (Saves a little memory). Pages are read 
back using get_user_pages() with the correct VMA and VMA offset.

So the interesting questions arise: Should we have a single large VMA 
supplied by the drm master (X server) or should each client be required 
to present a VMA which is equal to or larger in size than all the buffer 
objects it intends to create?

Also, if the VMAs are created using mmap() there might an option to 
specify a separate "swap" file for the buffer objects. Something that we 
also perhaps would want to explore. Also we need to make sure we do the 
right thing across "fork"s.

/Thomas
















-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to