diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/r300/r300_cb.h | 22 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_cs.h | 39 |
2 files changed, 36 insertions, 25 deletions
diff --git a/src/gallium/drivers/r300/r300_cb.h b/src/gallium/drivers/r300/r300_cb.h index 934526323c6..9d3d4fc1b19 100644 --- a/src/gallium/drivers/r300/r300_cb.h +++ b/src/gallium/drivers/r300/r300_cb.h @@ -61,32 +61,38 @@ * that they neatly hide away, and don't have the cost of function setup, so * we're going to use them. */ +#ifdef DEBUG +#define CB_DEBUG(x) x +#else +#define CB_DEBUG(x) +#endif + /** * Command buffer setup. */ #define CB_LOCALS \ - int cs_count = 0; \ + CB_DEBUG(int cs_count = 0;) \ uint32_t *cs_ptr = NULL; \ - (void) cs_count; (void) cs_ptr; + CB_DEBUG((void) cs_count;) (void) cs_ptr; #define NEW_CB(ptr, size) do { \ assert(sizeof(*ptr) == sizeof(uint32_t)); \ cs_ptr = (ptr) = (uint32_t*)malloc((size) * sizeof(uint32_t)); \ - cs_count = size; \ + CB_DEBUG(cs_count = size;) \ } while (0) #define BEGIN_CB(ptr, size) do { \ assert(sizeof(*ptr) == sizeof(uint32_t)); \ cs_ptr = ptr; \ - cs_count = size; \ + CB_DEBUG(cs_count = size;) \ } while (0) #define END_CB do { \ - if (cs_count != 0) \ + CB_DEBUG(if (cs_count != 0) \ debug_printf("r300: Warning: cs_count off by %d at (%s, %s:%i)\n", \ - cs_count, __FUNCTION__, __FILE__, __LINE__); \ + cs_count, __FUNCTION__, __FILE__, __LINE__);) \ } while (0) @@ -97,13 +103,13 @@ #define OUT_CB(value) do { \ *cs_ptr = (value); \ cs_ptr++; \ - cs_count--; \ + CB_DEBUG(cs_count--;) \ } while (0) #define OUT_CB_TABLE(values, count) do { \ memcpy(cs_ptr, values, count * sizeof(uint32_t)); \ cs_ptr += count; \ - cs_count -= count; \ + CB_DEBUG(cs_count -= count;) \ } while (0) #define OUT_CB_32F(value) \ diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h index 1649766989d..91e5dee0b01 100644 --- a/src/gallium/drivers/r300/r300_cs.h +++ b/src/gallium/drivers/r300/r300_cs.h @@ -35,6 +35,11 @@ * that they neatly hide away, and don't have the cost of function setup,so * we're going to use them. */ +#ifdef DEBUG +#define CS_DEBUG(x) x +#else +#define CS_DEBUG(x) +#endif /** * Command submission setup. @@ -43,20 +48,20 @@ #define CS_LOCALS(context) \ struct r300_context* const cs_context_copy = (context); \ struct r300_winsys_screen *cs_winsys = cs_context_copy->rws; \ - int cs_count = 0; (void) cs_count; + CS_DEBUG(int cs_count = 0; (void) cs_count;) #define BEGIN_CS(size) do { \ assert(r300_check_cs(cs_context_copy, (size))); \ cs_winsys->begin_cs(cs_winsys, (size), \ __FILE__, __FUNCTION__, __LINE__); \ - cs_count = size; \ + CS_DEBUG(cs_count = size;) \ } while (0) #define END_CS do { \ - if (cs_count != 0) \ - debug_printf("r300: Warning: cs_count off by %d\n", cs_count); \ + CS_DEBUG(if (cs_count != 0) \ + debug_printf("r300: Warning: cs_count off by %d\n", cs_count);) \ cs_winsys->end_cs(cs_winsys, __FILE__, __FUNCTION__, __LINE__); \ - cs_count = 0; \ + CS_DEBUG(cs_count = 0;) \ } while (0) @@ -66,19 +71,19 @@ #define OUT_CS(value) do { \ cs_winsys->write_cs_dword(cs_winsys, (value)); \ - cs_count--; \ + CS_DEBUG(cs_count--;) \ } while (0) #define OUT_CS_32F(value) do { \ cs_winsys->write_cs_dword(cs_winsys, fui(value)); \ - cs_count--; \ + CS_DEBUG(cs_count--;) \ } while (0) #define OUT_CS_REG(register, value) do { \ assert(register); \ cs_winsys->write_cs_dword(cs_winsys, CP_PACKET0(register, 0)); \ cs_winsys->write_cs_dword(cs_winsys, value); \ - cs_count -= 2; \ + CS_DEBUG(cs_count -= 2;) \ } while (0) /* Note: This expects count to be the number of registers, @@ -86,23 +91,23 @@ #define OUT_CS_REG_SEQ(register, count) do { \ assert(register); \ cs_winsys->write_cs_dword(cs_winsys, CP_PACKET0((register), ((count) - 1))); \ - cs_count--; \ + CS_DEBUG(cs_count--;) \ } while (0) #define OUT_CS_TABLE(values, count) do { \ cs_winsys->write_cs_table(cs_winsys, values, count); \ - cs_count -= count; \ + CS_DEBUG(cs_count -= count;) \ } while (0) #define OUT_CS_ONE_REG(register, count) do { \ assert(register); \ cs_winsys->write_cs_dword(cs_winsys, CP_PACKET0((register), ((count) - 1)) | RADEON_ONE_REG_WR); \ - cs_count--; \ + CS_DEBUG(cs_count--;) \ } while (0) #define OUT_CS_PKT3(op, count) do { \ cs_winsys->write_cs_dword(cs_winsys, CP_PACKET3(op, count)); \ - cs_count--; \ + CS_DEBUG(cs_count--;) \ } while (0) @@ -114,20 +119,20 @@ assert(bo); \ cs_winsys->write_cs_dword(cs_winsys, offset); \ r300_buffer_write_reloc(cs_winsys, r300_buffer(bo), rd, wd, flags); \ - cs_count -= 3; \ + CS_DEBUG(cs_count -= 3;) \ } while (0) #define OUT_CS_TEX_RELOC(tex, offset, rd, wd, flags) do { \ assert(tex); \ cs_winsys->write_cs_dword(cs_winsys, offset); \ r300_texture_write_reloc(cs_winsys, tex, rd, wd, flags); \ - cs_count -= 3; \ + CS_DEBUG(cs_count -= 3;) \ } while (0) #define OUT_CS_BUF_RELOC_NO_OFFSET(bo, rd, wd, flags) do { \ assert(bo); \ r300_buffer_write_reloc(cs_winsys, r300_buffer(bo), rd, wd, flags); \ - cs_count -= 2; \ + CS_DEBUG(cs_count -= 2;) \ } while (0) #define OUT_CS_INDEX_RELOC(bo, offset, count, rd, wd, flags) do { \ @@ -135,7 +140,7 @@ cs_winsys->write_cs_dword(cs_winsys, offset); \ cs_winsys->write_cs_dword(cs_winsys, count); \ cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \ - cs_count -= 4; \ + CS_DEBUG(cs_count -= 4;) \ } while (0) @@ -145,7 +150,7 @@ /* It's recommended not to call begin_cs/end_cs before/after this macro. */ #define WRITE_CS_TABLE(values, count) do { \ - assert(cs_count == 0); \ + CS_DEBUG(assert(cs_count == 0);) \ cs_winsys->write_cs_table(cs_winsys, values, count); \ } while (0) |