xf86-video-intel: src/sna/brw src/sna/Makefile.am src/sna/sna_driver.c src/sna/sna.h src/sna/sna_video.c src/sna/xassert.h

Chris Wilson ickle at kemper.freedesktop.org
Wed Sep 10 03:58:37 PDT 2014


 src/sna/Makefile.am  |    1 +
 src/sna/brw/brw_eu.c |    4 ++++
 src/sna/brw/brw_eu.h |    2 +-
 src/sna/sna.h        |    1 +
 src/sna/sna_driver.c |    1 -
 src/sna/sna_video.c  |    1 -
 src/sna/xassert.h    |   42 ++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 49 insertions(+), 3 deletions(-)

New commits:
commit 224af800f695b50ba5a65b5a2b9ca1e7a88d4e1a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Sep 10 11:48:40 2014 +0100

    sna: Emit assertions with FatalError
    
    The intention is to be able to capture the assertion in the Xorg.0.log
    (journald equivalent). At the moment, it is emitted to stderr which is
    difficult to capture and defeats the goal of only asking the reporter to
    upload one log file.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/Makefile.am b/src/sna/Makefile.am
index 7ec1c36..a995b44 100644
--- a/src/sna/Makefile.am
+++ b/src/sna/Makefile.am
@@ -106,6 +106,7 @@ libsna_la_SOURCES = \
 	gen8_render.h \
 	gen8_vertex.c \
 	gen8_vertex.h \
+	xassert.h \
 	$(NULL)
 
 if DRI2
diff --git a/src/sna/brw/brw_eu.c b/src/sna/brw/brw_eu.c
index 9bd8ba5..c5705f5 100644
--- a/src/sna/brw/brw_eu.c
+++ b/src/sna/brw/brw_eu.c
@@ -29,6 +29,10 @@
   *   Keith Whitwell <keith at tungstengraphics.com>
   */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "brw_eu.h"
 
 #include <string.h>
diff --git a/src/sna/brw/brw_eu.h b/src/sna/brw/brw_eu.h
index 0124ac2..e8210a1 100644
--- a/src/sna/brw/brw_eu.h
+++ b/src/sna/brw/brw_eu.h
@@ -29,13 +29,13 @@
  *   Keith Whitwell <keith at tungstengraphics.com>
  */
 
-
 #ifndef BRW_EU_H
 #define BRW_EU_H
 
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
+
 #include <assert.h>
 
 #define BRW_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<2) | ((c)<<4) | ((d)<<6))
diff --git a/src/sna/sna.h b/src/sna/sna.h
index bb0cbb2..ad74870 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -76,6 +76,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <signal.h>
 #include <setjmp.h>
 
+#include "xassert.h"
 #include "compiler.h"
 
 #if HAS_DEBUG_FULL
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 401737b..7eed214 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -37,7 +37,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "config.h"
 #endif
 
-#include <assert.h>
 #include <string.h>
 #include <stdio.h>
 #include <unistd.h>
diff --git a/src/sna/sna_video.c b/src/sna/sna_video.c
index 80760ae..ed0e7b3 100644
--- a/src/sna/sna_video.c
+++ b/src/sna/sna_video.c
@@ -48,7 +48,6 @@
 #include <inttypes.h>
 #include <math.h>
 #include <string.h>
-#include <assert.h>
 #include <errno.h>
 
 #include <sys/mman.h>
diff --git a/src/sna/xassert.h b/src/sna/xassert.h
new file mode 100644
index 0000000..7ab2591
--- /dev/null
+++ b/src/sna/xassert.h
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+#ifndef __XASSERT_H___
+#define __XASSERT_H__
+
+/* Rewrap the traditional assert so that we can capture the error message
+ * via Xorg.0.log
+ */
+
+#include <assert.h>
+
+#ifndef NDEBUG
+#include <os.h>
+#include "compiler.h"
+#undef assert
+#define assert(E) do { \
+	if (unlikely(!(E))) FatalError("%s:%d assertion '%s' failed\n", __func__, __LINE__, #E); \
+} while (0)
+#endif
+
+#endif /* __XASSERT_H__ */


More information about the xorg-commit mailing list