diff options
author | Will Thompson <will@willthompson.co.uk> | 2012-04-20 16:07:11 +0100 |
---|---|---|
committer | Will Thompson <will@willthompson.co.uk> | 2012-04-25 15:08:27 +0100 |
commit | 20723828704a7aa171e99b07ac6e9eb97dd17af2 (patch) | |
tree | b06c27a477247c41bb925ba3f404a41199073f83 | |
parent | 585f30f4f75e5f06145087ec181e9c6db20682d1 (diff) |
Move debug macros out to a header.
-rw-r--r-- | src/Makefile.am | 5 | ||||
-rw-r--r-- | src/videocore-debug.h | 56 | ||||
-rw-r--r-- | src/videocore.c | 11 |
3 files changed, 63 insertions, 9 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 825997c..994caba 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,4 +29,7 @@ videocore_drv_la_LDFLAGS = -module -avoid-version videocore_drv_ladir = @moduledir@/drivers videocore_drv_la_SOURCES = \ - videocore.c + videocore.c \ + videocore-debug.h + +# vim: set et : diff --git a/src/videocore-debug.h b/src/videocore-debug.h new file mode 100644 index 0000000..d7ead4a --- /dev/null +++ b/src/videocore-debug.h @@ -0,0 +1,56 @@ +/* vim: set noet sw=8 sts=8 cino=:0,t0,(0 : + * + * Copyright © 2011 Texas Instruments Incorporated + * Copyright © 2012 Collabora Ltd. + * + * 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 fur- + * nished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice 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, FIT- + * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- + * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef VIDEOCORE_DEBUG_H +#define VIDEOCORE_DEBUG_H + +#include "xf86.h" + +extern Bool videoCoreDebug; + +#define TRACE_ENTER(str) \ + do { if (videoCoreDebug) ErrorF("videocore: " str " %d\n",pScrn->scrnIndex); } while (0) +#define TRACE_EXIT(str) \ + do { if (videoCoreDebug) ErrorF("videocore: " str " done\n"); } while (0) +#define TRACE(str) \ + do { if (videoCoreDebug) ErrorF("videocore trace: " str "\n"); } while (0) + +#define DEBUG_MSG(fmt, ...) \ + do { if (videoCoreDebug) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s:%d " fmt "\n",\ + __FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0) +#define INFO_MSG(fmt, ...) \ + do { xf86DrvMsg(pScrn->scrnIndex, X_INFO, fmt "\n",\ + ##__VA_ARGS__); } while (0) +#define CONFIG_MSG(fmt, ...) \ + do { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, fmt "\n",\ + ##__VA_ARGS__); } while (0) +#define WARNING_MSG(fmt, ...) \ + do { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "WARNING: " fmt "\n",\ + ##__VA_ARGS__); } while (0) +#define ERROR_MSG(fmt, ...) \ + do { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ERROR: " fmt "\n",\ + ##__VA_ARGS__); } while (0) +#define EARLY_ERROR_MSG(fmt, ...) \ + do { xf86Msg(X_ERROR, "ERROR: " fmt "\n",\ + ##__VA_ARGS__); } while (0) + +#endif /* VIDEOCORE_DEBUG_H */ diff --git a/src/videocore.c b/src/videocore.c index a3db21f..379c2e8 100644 --- a/src/videocore.c +++ b/src/videocore.c @@ -37,14 +37,9 @@ #include <pciaccess.h> #endif -static Bool debug = 0; +#include "videocore-debug.h" -#define TRACE_ENTER(str) \ - do { if (debug) ErrorF("fbdev: " str " %d\n",pScrn->scrnIndex); } while (0) -#define TRACE_EXIT(str) \ - do { if (debug) ErrorF("fbdev: " str " done\n"); } while (0) -#define TRACE(str) \ - do { if (debug) ErrorF("fbdev trace: " str "\n"); } while (0) +Bool videoCoreDebug = 0; /* -------------------------------------------------------------------- */ /* prototypes */ @@ -481,7 +476,7 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags) /* use shadow framebuffer by default */ fPtr->shadowFB = xf86ReturnOptValBool(fPtr->Options, OPTION_SHADOW_FB, TRUE); - debug = xf86ReturnOptValBool(fPtr->Options, OPTION_DEBUG, FALSE); + videoCoreDebug = xf86ReturnOptValBool(fPtr->Options, OPTION_DEBUG, FALSE); /* rotation */ fPtr->rotate = FBDEV_ROTATE_NONE; |