aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2019-05-26 13:48:42 -0700
committerKenneth Graunke <[email protected]>2019-05-29 19:41:50 -0700
commitcea6671395864d8b4c5020193b2f84955de827e4 (patch)
treeedc0e3b2dd1293d707898fe84bfc746b3210afe6
parent042f8514e67315b74cccf3692d34e5b2d32a6c14 (diff)
iris: Fall back to fresh allocations of mapping for zero-memset fails.
It is unlikely that we would fail to map a cached BO in order to zero its contents. When we did, we would free the first BO in the cache and try again with the second. It's possible that this next BO already had a map setup, in which case we'd succeed. But if it didn't, we'd likely fail again in the same manner. There's not much point in optimizing this case (and frankly, if we're out of CPU-side VMA we should probably dump the cache entirely)...so instead, just fall back to allocating a fresh BO from the kernel which will already be zeroed so we don't have to try and map it. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
-rw-r--r--src/gallium/drivers/iris/iris_bufmgr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c
index e6c61a7a14c..659840c47aa 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.c
+++ b/src/gallium/drivers/iris/iris_bufmgr.c
@@ -443,11 +443,12 @@ retry:
if (zeroed) {
void *map = iris_bo_map(NULL, bo, MAP_WRITE | MAP_RAW);
- if (!map) {
+ if (map) {
+ memset(map, 0, bo_size);
+ } else {
+ alloc_from_cache = false;
bo_free(bo);
- goto retry;
}
- memset(map, 0, bo_size);
}
}
}