On Fri, 2009-10-30 at 13:32 +1000, Dave Airlie wrote: 
> 
> The other question is why we don't evict VRAM->GTT in a lot of cases,
> this would save us some cache transitions since a lot of objects
> that are evicted from VRAM will probably end up being pulled back in
> a few operations later, and evicting them to system memory involves
> 2 unnecessary cache transitions.

I think the patch below should allow VRAM->GTT eviction. I'm not sure
it's an overall improvement right now though, I think BOs might get
stuck in GTT after eviction there.


commit c9367db23470c5035bf52667a1daa4176d926024
Author: Michel Dänzer <daen...@vmware.com>
Date:   Wed Nov 4 08:41:25 2009 +0100

    drm/radeon: Tweak TTM eviction flags to include GTT for eviction from VRAM.
    
    Signed-off-by: Michel Dänzer <daen...@vmware.com>

diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c 
b/drivers/gpu/drm/radeon/radeon_ttm.c
index e116a15..0e76fcc 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -199,13 +199,12 @@ static int radeon_init_mem_type(struct ttm_bo_device 
*bdev, uint32_t type,
 
 static uint32_t radeon_evict_flags(struct ttm_buffer_object *bo)
 {
-       uint32_t cur_placement = bo->mem.placement & ~TTM_PL_MASK_MEMTYPE;
-
-       switch (bo->mem.mem_type) {
-       default:
-               return (cur_placement & ~TTM_PL_MASK_CACHING) |
-                       TTM_PL_FLAG_SYSTEM |
-                       TTM_PL_FLAG_CACHED;
+       if ((bo->mem.placement & TTM_PL_MASK_MEMTYPE) == TTM_PL_FLAG_VRAM) {
+               return (bo->mem.placement & ~TTM_PL_MASK_MEMTYPE) |
+                       TTM_PL_FLAG_TT | TTM_PL_FLAG_SYSTEM | 
TTM_PL_MASK_CACHING;
+       } else {
+               return (bo->mem.placement & ~TTM_PL_MASK_MEMTYPE) |
+                       TTM_PL_FLAG_SYSTEM | TTM_PL_MASK_CACHING;
        }
 }
 


-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to