summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-12-16 10:31:22 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-12-16 10:34:20 +0000
commit123754de41380b94922768d021987b1dea3b39c4 (patch)
tree5430d6168d58aafd0be36b1f3c2a24d0586fd365
parent99537089346ed7a1bc6b02349fad93845e865bb9 (diff)
sna: Make error debug tracing available at normal debug levels
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/Makefile.am1
-rw-r--r--src/sna/debug.h44
-rw-r--r--src/sna/fb/fb.h10
-rw-r--r--src/sna/kgem.h10
-rw-r--r--src/sna/sna.h10
5 files changed, 48 insertions, 27 deletions
diff --git a/src/sna/Makefile.am b/src/sna/Makefile.am
index a995b442..e09a8d49 100644
--- a/src/sna/Makefile.am
+++ b/src/sna/Makefile.am
@@ -41,6 +41,7 @@ libsna_la_SOURCES = \
atomic.h \
blt.c \
compiler.h \
+ debug.h \
kgem.c \
kgem.h \
rop.h \
diff --git a/src/sna/debug.h b/src/sna/debug.h
new file mode 100644
index 00000000..ebbf2292
--- /dev/null
+++ b/src/sna/debug.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ * Chris Wilson <chris@chris-wilson.co.uk>
+ *
+ */
+
+#ifndef _SNA_DEBUG_H_
+#define _SNA_DEBUG_H_
+
+#if HAS_DEBUG_FULL
+void LogF(const char *f, ...);
+#define DBG(x) LogF x
+#else
+#define DBG(x)
+#endif
+
+#if HAS_DEBUG_FULL || !defined(NDEBUG)
+#define ERR(x) ErrorF x
+#else
+#define ERR(x)
+#endif
+
+#endif /* _SNA_DEBUG_H_ */
diff --git a/src/sna/fb/fb.h b/src/sna/fb/fb.h
index 982b2c17..8bf9008a 100644
--- a/src/sna/fb/fb.h
+++ b/src/sna/fb/fb.h
@@ -38,18 +38,10 @@
#include <stdbool.h>
#include <pixman.h>
-#if HAS_DEBUG_FULL
-void LogF(const char *f, ...);
-#define DBG(x) LogF x
-#define ERR(x) ErrorF x
-#else
-#define DBG(x)
-#define ERR(x)
-#endif
-
#include "sfb.h"
#include "../../compat-api.h"
+#include "../debug.h"
#define WRITE(ptr, val) (*(ptr) = (val))
#define READ(ptr) (*(ptr))
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 3275b4f4..2267bacf 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -35,15 +35,7 @@
#include <i915_drm.h>
#include "compiler.h"
-
-#if HAS_DEBUG_FULL
-void LogF(const char *f, ...);
-#define DBG(x) LogF x
-#define ERR(x) ErrorF x
-#else
-#define DBG(x)
-#define ERR(x)
-#endif
+#include "debug.h"
struct kgem_bo {
struct kgem_request *rq;
diff --git a/src/sna/sna.h b/src/sna/sna.h
index db1fdc14..3e16f7e5 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -78,15 +78,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xassert.h"
#include "compiler.h"
-
-#if HAS_DEBUG_FULL
-void LogF(const char *f, ...);
-#define DBG(x) LogF x
-#define ERR(x) ErrorF x
-#else
-#define DBG(x)
-#define ERR(x)
-#endif
+#include "debug.h"
#define DEBUG_NO_BLT 0