1 /* 2 * Copyright (c) 2012-2013 Etnaviv Project 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the 12 * next paragraph) shall be included in all copies or substantial portions 13 * of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 * DEALINGS IN THE SOFTWARE. 22 */ 23 24 /* Common debug stuffl */ 25 #ifndef H_ETNA_DEBUG 26 #define H_ETNA_DEBUG 27 28 #include "util/u_debug.h" 29 30 #include <stdint.h> 31 #include <stdio.h> 32 #include <stdlib.h> 33 34 /* Logging */ 35 #define ETNA_DBG_MSGS 0x1 /* Warnings and non-fatal errors */ 36 #define ETNA_DBG_FRAME_MSGS 0x2 37 #define ETNA_DBG_RESOURCE_MSGS 0x4 38 #define ETNA_DBG_COMPILER_MSGS 0x8 39 #define ETNA_DBG_LINKER_MSGS 0x10 40 #define ETNA_DBG_DUMP_SHADERS 0x20 41 42 /* Bypasses */ 43 #define ETNA_DBG_NO_TS 0x1000 /* Disable TS */ 44 #define ETNA_DBG_NO_AUTODISABLE 0x2000 /* Disable autodisable */ 45 #define ETNA_DBG_NO_SUPERTILE 0x4000 /* Disable supertile */ 46 #define ETNA_DBG_NO_EARLY_Z 0x8000 /* Disable early z */ 47 #define ETNA_DBG_CFLUSH_ALL 0x10000 /* Flush before every state update + draw call */ 48 #define ETNA_DBG_MSAA_2X 0x20000 /* Force 2X MSAA for screen */ 49 #define ETNA_DBG_MSAA_4X 0x40000 /* Force 4X MSAA for screen */ 50 #define ETNA_DBG_FINISH_ALL 0x80000 /* Finish on every flush */ 51 #define ETNA_DBG_FLUSH_ALL 0x100000 /* Flush after every rendered primitive */ 52 #define ETNA_DBG_ZERO 0x200000 /* Zero all resources after allocation */ 53 #define ETNA_DBG_DRAW_STALL 0x400000 /* Stall FE/PE after every draw op */ 54 #define ETNA_DBG_SHADERDB 0x800000 /* dump program compile information */ 55 56 extern int etna_mesa_debug; /* set in etna_screen.c from ETNA_DEBUG */ 57 58 #define DBG_ENABLED(flag) unlikely(etna_mesa_debug & (flag)) 59 60 #define DBG_F(flag, fmt, ...) \ 61 do { \ 62 if (etna_mesa_debug & (flag)) \ 63 debug_printf("%s:%d: " fmt "\n", __FUNCTION__, __LINE__, \ 64 ##__VA_ARGS__); \ 65 } while (0) 66 67 #define DBG(fmt, ...) \ 68 do { \ 69 if (etna_mesa_debug & ETNA_DBG_MSGS) \ 70 debug_printf("%s:%d: " fmt "\n", __FUNCTION__, __LINE__, \ 71 ##__VA_ARGS__); \ 72 } while (0) 73 74 /* A serious bug, show this even in non-debug mode */ 75 #define BUG(fmt, ...) \ 76 do { \ 77 printf("%s:%d: " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); \ 78 } while (0) 79 80 #endif 81