File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,30 @@ static void radeon_evict_flags(struct ttm_buffer_object *bo,
198198 case TTM_PL_VRAM :
199199 if (rbo -> rdev -> ring [RADEON_RING_TYPE_GFX_INDEX ].ready == false)
200200 radeon_ttm_placement_from_domain (rbo , RADEON_GEM_DOMAIN_CPU );
201- else
201+ else if (rbo -> rdev -> mc .visible_vram_size < rbo -> rdev -> mc .real_vram_size &&
202+ bo -> mem .start < (rbo -> rdev -> mc .visible_vram_size >> PAGE_SHIFT )) {
203+ unsigned fpfn = rbo -> rdev -> mc .visible_vram_size >> PAGE_SHIFT ;
204+ int i ;
205+
206+ /* Try evicting to the CPU inaccessible part of VRAM
207+ * first, but only set GTT as busy placement, so this
208+ * BO will be evicted to GTT rather than causing other
209+ * BOs to be evicted from VRAM
210+ */
211+ radeon_ttm_placement_from_domain (rbo , RADEON_GEM_DOMAIN_VRAM |
212+ RADEON_GEM_DOMAIN_GTT );
213+ rbo -> placement .num_busy_placement = 0 ;
214+ for (i = 0 ; i < rbo -> placement .num_placement ; i ++ ) {
215+ if (rbo -> placements [i ].flags & TTM_PL_FLAG_VRAM ) {
216+ if (rbo -> placements [0 ].fpfn < fpfn )
217+ rbo -> placements [0 ].fpfn = fpfn ;
218+ } else {
219+ rbo -> placement .busy_placement =
220+ & rbo -> placements [i ];
221+ rbo -> placement .num_busy_placement = 1 ;
222+ }
223+ }
224+ } else
202225 radeon_ttm_placement_from_domain (rbo , RADEON_GEM_DOMAIN_GTT );
203226 break ;
204227 case TTM_PL_TT :
You can’t perform that action at this time.
0 commit comments