i965: Use WARN_ONCE instead of open coding it.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 29 Mar 2017 03:31:45 +0000 (20:31 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 30 Mar 2017 07:15:09 +0000 (00:15 -0700)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/brw_compute.c

index 16b5df7ca4e3cb8d8b0cdb55576a29c2f226d6f3..21da2ad17b5f64902ee17f45bbf729efbaaa13c3 100644 (file)
@@ -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");
       }
    }