diff --git a/src/sna/Makefile.am b/src/sna/Makefile.am index 7ec1c362..a995b442 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 9bd8ba5d..c5705f56 100644 --- a/src/sna/brw/brw_eu.c +++ b/src/sna/brw/brw_eu.c @@ -29,6 +29,10 @@ * Keith Whitwell */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "brw_eu.h" #include diff --git a/src/sna/brw/brw_eu.h b/src/sna/brw/brw_eu.h index 0124ac21..e8210a12 100644 --- a/src/sna/brw/brw_eu.h +++ b/src/sna/brw/brw_eu.h @@ -29,13 +29,13 @@ * Keith Whitwell */ - #ifndef BRW_EU_H #define BRW_EU_H #include #include #include + #include #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 bb0cbb28..ad74870a 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 #include +#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 401737b3..7eed2143 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 #include #include #include diff --git a/src/sna/sna_video.c b/src/sna/sna_video.c index 80760ae7..ed0e7b31 100644 --- a/src/sna/sna_video.c +++ b/src/sna/sna_video.c @@ -48,7 +48,6 @@ #include #include #include -#include #include #include diff --git a/src/sna/xassert.h b/src/sna/xassert.h new file mode 100644 index 00000000..7ab2591d --- /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 + +#ifndef NDEBUG +#include +#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__ */