summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBruce Cherniak <[email protected]>2017-06-30 22:24:46 -0500
committerAndres Gomez <[email protected]>2017-07-08 15:47:59 +0300
commit5c91fcfad89f04b02eb538c4c6f23df369d6b742 (patch)
tree7ac9182160eabb65d94f02317772ef3a6a7cde3e /src
parentea3f94b5556a32da7196c04c34636a01266fc3c5 (diff)
swr: Limit memory held by defer deleted resources.
This patch limits the number of items on the fence work queue (the deferred deletion list) by submitting a sync fence when the queue size exceeds a threshold. This initiates deferred deletion of all resources on the list and decreases the total amount of memory held waiting for "deferred deletion". This resolves bug 101467 filed against swr for the piglit streaming-texture-leak test. For those running on smaller memory (16GB?) systems, this will prevent oom-killer. Thus far, we have not seen any real world applications that exhibit behavior like the streaming-texture-leak test; as any form of pipeline flush will trigger the defer queue and properly free any retained allocations. But, this addresses those as well. Cc: "17.1" <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> (cherry picked from commit 32c1a54bd01465e77a8e26b9cc8d2487b31509c5)
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/swr/swr_screen.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
index 9254e735085..b684e417abb 100644
--- a/src/gallium/drivers/swr/swr_screen.cpp
+++ b/src/gallium/drivers/swr/swr_screen.cpp
@@ -988,6 +988,12 @@ swr_resource_destroy(struct pipe_screen *p_screen, struct pipe_resource *pt)
swr_fence_work_free(screen->flush_fence, spr->swr.pBaseAddress, true);
swr_fence_work_free(screen->flush_fence,
spr->secondary.pBaseAddress, true);
+
+ /* If work queue grows too large, submit a fence to force queue to
+ * drain. This is mainly to decrease the amount of memory used by the
+ * piglit streaming-texture-leak test */
+ if (screen->pipe && swr_fence(screen->flush_fence)->work.count > 64)
+ swr_fence_submit(swr_context(screen->pipe), screen->flush_fence);
}
FREE(spr);