[Mesa-dev] [PATCH 14/15] radeonsi: flush when an IB uses more VRAM than available

Marek Olšák maraeo at gmail.com
Wed Aug 29 20:13:10 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_pipe.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 29d7e555a0c..b3d607b93e3 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -1551,20 +1551,26 @@ static inline bool util_prim_is_points_or_lines(unsigned prim)
  * \param gtt       GTT memory size not added to the buffer list yet
  */
 static inline bool
 radeon_cs_memory_below_limit(struct si_screen *screen,
 			     struct radeon_cmdbuf *cs,
 			     uint64_t vram, uint64_t gtt)
 {
 	vram += cs->used_vram;
 	gtt += cs->used_gart;
 
+	/* Flush more often on dGPUs, so that temporarily allocated buffers
+	 * are released/reused faster and there are fewer of them.
+	 */
+	if (!screen->info.has_local_buffers && screen->info.has_dedicated_vram)
+		return vram < screen->info.vram_size;
+
 	/* Anything that goes above the VRAM size should go to GTT. */
 	if (vram > screen->info.vram_size)
 		gtt += vram - screen->info.vram_size;
 
 	/* Now we just need to check if we have enough GTT. */
 	return gtt < screen->info.gart_size * 0.7;
 }
 
 /**
  * Add a buffer to the buffer list for the given command stream (CS).
-- 
2.17.1



More information about the mesa-dev mailing list