Mesa (main): zink: wait in the flush thread when ETOOMANY batches are out

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 8 03:04:36 UTC 2021


Module: Mesa
Branch: main
Commit: df1e18fb5ff57b9e539b3091ce92721648282185
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=df1e18fb5ff57b9e539b3091ce92721648282185

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue Oct  5 15:24:07 2021 -0400

zink: wait in the flush thread when ETOOMANY batches are out

when dispatch is fast enough, some tests fire off cmdbufs so quickly that the normal
oom flushing and batch pruning in end_batch isn't sufficient to keep memory
usage down

to combat this, start throwing in stalls after submission to clean out a bunch of cmdbufs
while preventing further ones from being submitted

Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13247>

---

 src/gallium/drivers/zink/zink_batch.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c
index 335ad304a7e..34ce63fb3f1 100644
--- a/src/gallium/drivers/zink/zink_batch.c
+++ b/src/gallium/drivers/zink/zink_batch.c
@@ -333,11 +333,14 @@ static void
 post_submit(void *data, void *gdata, int thread_index)
 {
    struct zink_batch_state *bs = data;
+   struct zink_screen *screen = zink_screen(bs->ctx->base.screen);
 
    if (bs->is_device_lost) {
       if (bs->ctx->reset.reset)
          bs->ctx->reset.reset(bs->ctx->reset.data, PIPE_GUILTY_CONTEXT_RESET);
-      zink_screen(bs->ctx->base.screen)->device_lost = true;
+      screen->device_lost = true;
+   } else if (_mesa_hash_table_num_entries(&bs->ctx->batch_states) > 5000) {
+      zink_screen_batch_id_wait(screen, bs->fence.batch_id - 2500, PIPE_TIMEOUT_INFINITE);
    }
 }
 



More information about the mesa-commit mailing list