Mesa (master): i965: Use WARN_ONCE instead of open coding it.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Mar 30 07:15:17 UTC 2017


Module: Mesa
Branch: master
Commit: 5177231670f312c9f1f6dfc3304f3b09896057b7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5177231670f312c9f1f6dfc3304f3b09896057b7

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 28 20:31:45 2017 -0700

i965: Use WARN_ONCE instead of open coding it.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/mesa/drivers/dri/i965/brw_compute.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_compute.c b/src/mesa/drivers/dri/i965/brw_compute.c
index 16b5df7ca4..21da2ad17b 100644
--- a/src/mesa/drivers/dri/i965/brw_compute.c
+++ b/src/mesa/drivers/dri/i965/brw_compute.c
@@ -219,15 +219,10 @@ brw_dispatch_compute_common(struct gl_context *ctx)
          fail_next = true;
          goto retry;
       } else {
-         if (intel_batchbuffer_flush(brw) == -ENOSPC) {
-            static bool warned = false;
-
-            if (!warned) {
-               fprintf(stderr, "i965: Single compute shader dispatch "
-                       "exceeded available aperture space\n");
-               warned = true;
-            }
-         }
+         int ret = intel_batchbuffer_flush(brw);
+         WARN_ONCE(ret == -ENOSPC,
+                   "i965: Single compute shader dispatch "
+                   "exceeded available aperture space\n");
       }
    }
 




More information about the mesa-commit mailing list