Mesa (master): gallium/util: reduce util_snprintf() calls in debug_flush_might_flush_cb()
Brian Paul
brianp at kemper.freedesktop.org
Wed Apr 26 17:40:28 UTC 2017
Module: Mesa
Branch: master
Commit: a36a1ea80acfd28a36d89b2bfa914ab48768048d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a36a1ea80acfd28a36d89b2bfa914ab48768048d
Author: Brian Paul <brianp at vmware.com>
Date: Mon Apr 24 12:58:22 2017 -0600
gallium/util: reduce util_snprintf() calls in debug_flush_might_flush_cb()
We only need to construct the debug message if the mapped_sync flag is set.
This should make the function faster since the flag is usually false.
Reviewed-by: Charmaine Lee <charmainel at vmware.com>
---
src/gallium/auxiliary/util/u_debug_flush.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_debug_flush.c b/src/gallium/auxiliary/util/u_debug_flush.c
index fe96e09aad..98a69b2de0 100644
--- a/src/gallium/auxiliary/util/u_debug_flush.c
+++ b/src/gallium/auxiliary/util/u_debug_flush.c
@@ -320,14 +320,15 @@ debug_flush_might_flush_cb(void *key, void *value, void *data)
struct debug_flush_item *item =
(struct debug_flush_item *) value;
struct debug_flush_buf *fbuf = item->fbuf;
- const char *reason = (const char *) data;
- char message[80];
-
- util_snprintf(message, sizeof(message),
- "%s referenced mapped buffer detected.", reason);
mtx_lock(&fbuf->mutex);
if (fbuf->mapped_sync) {
+ const char *reason = (const char *) data;
+ char message[80];
+
+ util_snprintf(message, sizeof(message),
+ "%s referenced mapped buffer detected.", reason);
+
debug_flush_alert(message, reason, 3, item->bt_depth, TRUE, TRUE, NULL);
debug_flush_alert(NULL, "Map", 0, fbuf->bt_depth, TRUE, FALSE,
fbuf->map_frame);
More information about the mesa-commit
mailing list