Mesa (main): zink: clear the fb clears array instead of freeing it on reset

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 22 13:05:35 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Jun 21 11:25:04 2021 -0400

zink: clear the fb clears array instead of freeing it on reset

this cuts cpu usage by ~2% in sourcemark due to not reallocating the array
on every draw

Reviewed-by: Hoe Hao Cheng <haochengho12907 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11499>

---

 src/gallium/drivers/zink/zink_clear.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_clear.c b/src/gallium/drivers/zink/zink_clear.c
index bf38e97d23f..21d5b342f4a 100644
--- a/src/gallium/drivers/zink/zink_clear.c
+++ b/src/gallium/drivers/zink/zink_clear.c
@@ -578,7 +578,7 @@ fb_clears_apply_internal(struct zink_context *ctx, struct pipe_resource *pres, i
 void
 zink_fb_clear_reset(struct zink_context *ctx, unsigned i)
 {
-   util_dynarray_fini(&ctx->fb_clears[i].clears);
+   util_dynarray_clear(&ctx->fb_clears[i].clears);
    if (i == PIPE_MAX_COLOR_BUFS) {
       ctx->clears_enabled &= ~PIPE_CLEAR_DEPTHSTENCIL;
       ctx->rp_clears_enabled &= ~PIPE_CLEAR_DEPTHSTENCIL;



More information about the mesa-commit mailing list