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

Author: Mike Blumenkrantz <[email protected]>
Date:   Tue Jan  4 12:47:15 2022 -0500

zink: add a better threshold for clamping query pool resets on suspend

these pools should be dumped even if they aren't used

Reviewed-by: Hoe Hao Cheng <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14397>

---

 src/gallium/drivers/zink/zink_query.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_query.c 
b/src/gallium/drivers/zink/zink_query.c
index 636fbc2689d..231648d1fd7 100644
--- a/src/gallium/drivers/zink/zink_query.c
+++ b/src/gallium/drivers/zink/zink_query.c
@@ -849,7 +849,13 @@ zink_suspend_queries(struct zink_context *ctx, struct 
zink_batch *batch)
       }
       if (query->needs_update)
          update_qbo(ctx, query);
-      if (query->last_start && query->curr_query > NUM_QUERIES / 2)
+      /* do an implicit copy+reset if:
+       * - query is being read from and >50% of pool is used
+       * - >90% of pool is used
+       *
+       * this avoids overflow
+       */
+      if ((query->last_start && query->curr_query > NUM_QUERIES / 2) || 
(query->curr_query > NUM_QUERIES * 0.9))
          reset_pool(ctx, batch, query);
    }
 }

Reply via email to