summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/radeon/radeon_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/radeon/radeon_common.c')
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common.c59
1 files changed, 26 insertions, 33 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c
index ee0cbf65ca..aaa5165bc8 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -91,7 +91,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* 1 most output
* 2 also print state alues
*/
-#define DEBUG_CMDBUF 0
+#define RADEON_CMDBUF 0
/* =============================================================
* Scissoring
@@ -521,7 +521,7 @@ void radeonCopyBuffer( __DRIdrawablePrivate *dPriv,
rfb = dPriv->driverPrivate;
- if ( RADEON_DEBUG & DEBUG_IOCTL ) {
+ if ( RADEON_DEBUG & RADEON_IOCTL ) {
fprintf( stderr, "\n%s( %p )\n\n", __FUNCTION__, (void *) rmesa->glCtx );
}
@@ -615,7 +615,7 @@ static GLboolean radeonPageFlip( __DRIdrawablePrivate *dPriv )
LOCK_HARDWARE(radeon);
- if ( RADEON_DEBUG & DEBUG_IOCTL ) {
+ if ( RADEON_DEBUG & RADEON_IOCTL ) {
fprintf(stderr, "%s: pfCurrentPage: %d %d\n", __FUNCTION__,
radeon->sarea->pfCurrentPage, radeon->sarea->pfState);
}
@@ -875,7 +875,7 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
*/
void radeonDrawBuffer( GLcontext *ctx, GLenum mode )
{
- if (RADEON_DEBUG & DEBUG_DRI)
+ if (RADEON_DEBUG & RADEON_DRI)
fprintf(stderr, "%s %s\n", __FUNCTION__,
_mesa_lookup_enum_by_nr( mode ));
@@ -981,7 +981,7 @@ static void radeon_print_state_atom_prekmm(radeonContextPtr radeon, struct radeo
fprintf(stderr, " emit %s %d/%d\n", state->name, dwords, state->cmd_size);
- if (DEBUG_CMDBUF > 1 && RADEON_DEBUG & DEBUG_VERBOSE) {
+ if (radeon_is_debug_enabled(RADEON_STATE, RADEON_TRACE)) {
if (dwords > state->cmd_size)
dwords = state->cmd_size;
@@ -1006,7 +1006,7 @@ static void radeon_print_state_atom(radeonContextPtr radeon, struct radeon_state
int i, j, reg, count;
int dwords;
uint32_t packet0;
- if (! (DEBUG_CMDBUF && RADEON_DEBUG & DEBUG_STATE) )
+ if (!radeon_is_debug_enabled(RADEON_STATE, RADEON_VERBOSE) )
return;
if (!radeon->radeonScreen->kernel_mm) {
@@ -1018,7 +1018,7 @@ static void radeon_print_state_atom(radeonContextPtr radeon, struct radeon_state
fprintf(stderr, " emit %s %d/%d\n", state->name, dwords, state->cmd_size);
- if (DEBUG_CMDBUF > 1 && RADEON_DEBUG & DEBUG_VERBOSE) {
+ if (radeon_is_debug_enabled(RADEON_STATE, RADEON_TRACE)) {
if (dwords > state->cmd_size)
dwords = state->cmd_size;
for (i = 0; i < dwords;) {
@@ -1046,17 +1046,15 @@ GLuint radeonCountStateEmitSize(radeonContextPtr radeon)
struct radeon_state_atom *atom;
GLuint dwords = 0;
/* check if we are going to emit full state */
- if (DEBUG_CMDBUF && RADEON_DEBUG & DEBUG_VERBOSE)
- fprintf(stderr, "%s\n", __func__);
if (radeon->cmdbuf.cs->cdw && !radeon->hw.all_dirty) {
if (!radeon->hw.is_dirty)
- return dwords;
+ goto out;
foreach(atom, &radeon->hw.atomlist) {
if (atom->dirty) {
const GLuint atom_size = atom->check(radeon->glCtx, atom);
dwords += atom_size;
- if (DEBUG_CMDBUF && atom_size) {
+ if (RADEON_CMDBUF && atom_size) {
radeon_print_state_atom(radeon, atom);
}
}
@@ -1065,12 +1063,14 @@ GLuint radeonCountStateEmitSize(radeonContextPtr radeon)
foreach(atom, &radeon->hw.atomlist) {
const GLuint atom_size = atom->check(radeon->glCtx, atom);
dwords += atom_size;
- if (DEBUG_CMDBUF && atom_size) {
+ if (RADEON_CMDBUF && atom_size) {
radeon_print_state_atom(radeon, atom);
}
}
}
+out:
+ radeon_print(RADEON_STATE, RADEON_NORMAL, "%s %u\n", __func__, dwords);
return dwords;
}
@@ -1092,10 +1092,7 @@ static INLINE void radeon_emit_atom(radeonContextPtr radeon, struct radeon_state
END_BATCH();
}
} else {
- if (DEBUG_CMDBUF && RADEON_DEBUG & DEBUG_STATE) {
- fprintf(stderr, " skip state %s\n",
- atom->name);
- }
+ radeon_print(RADEON_STATE, RADEON_VERBOSE, " skip state %s\n", atom->name);
}
atom->dirty = GL_FALSE;
@@ -1135,8 +1132,7 @@ static GLboolean radeon_revalidate_bos(GLcontext *ctx)
void radeonEmitState(radeonContextPtr radeon)
{
- if (RADEON_DEBUG & (DEBUG_STATE|DEBUG_PRIMS))
- fprintf(stderr, "%s\n", __FUNCTION__);
+ radeon_print(RADEON_STATE, RADEON_NORMAL, "%s\n", __FUNCTION__);
if (radeon->vtbl.pre_emit_state)
radeon->vtbl.pre_emit_state(radeon);
@@ -1146,13 +1142,13 @@ void radeonEmitState(radeonContextPtr radeon)
return;
if (!radeon->cmdbuf.cs->cdw) {
- if (RADEON_DEBUG & DEBUG_STATE)
+ if (RADEON_DEBUG & RADEON_STATE)
fprintf(stderr, "Begin reemit state\n");
radeonEmitAtoms(radeon, GL_TRUE);
} else {
- if (RADEON_DEBUG & DEBUG_STATE)
+ if (RADEON_DEBUG & RADEON_STATE)
fprintf(stderr, "Begin dirty state\n");
radeonEmitAtoms(radeon, GL_FALSE);
@@ -1166,7 +1162,7 @@ void radeonEmitState(radeonContextPtr radeon)
void radeonFlush(GLcontext *ctx)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
- if (RADEON_DEBUG & DEBUG_IOCTL)
+ if (RADEON_DEBUG & RADEON_IOCTL)
fprintf(stderr, "%s %d\n", __FUNCTION__, radeon->cmdbuf.cs->cdw);
/* okay if we have no cmds in the buffer &&
@@ -1258,7 +1254,7 @@ int rcommonFlushCmdBufLocked(radeonContextPtr rmesa, const char *caller)
}
rmesa->cmdbuf.flushing = 1;
- if (RADEON_DEBUG & DEBUG_IOCTL) {
+ if (RADEON_DEBUG & RADEON_IOCTL) {
fprintf(stderr, "%s from %s - %i cliprects\n",
__FUNCTION__, caller, rmesa->numClipRects);
}
@@ -1327,15 +1323,13 @@ void rcommonInitCmdBuf(radeonContextPtr rmesa)
if (size > 64 * 256)
size = 64 * 256;
- if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA)) {
- fprintf(stderr, "sizeof(drm_r300_cmd_header_t)=%zd\n",
- sizeof(drm_r300_cmd_header_t));
- fprintf(stderr, "sizeof(drm_radeon_cmd_buffer_t)=%zd\n",
- sizeof(drm_radeon_cmd_buffer_t));
- fprintf(stderr,
+ radeon_print(RADEON_CS, RADEON_VERBOSE,
+ "sizeof(drm_r300_cmd_header_t)=%zd\n", sizeof(drm_r300_cmd_header_t));
+ radeon_print(RADEON_CS, RADEON_VERBOSE,
+ "sizeof(drm_radeon_cmd_buffer_t)=%zd\n", sizeof(drm_radeon_cmd_buffer_t));
+ radeon_print(RADEON_CS, RADEON_VERBOSE,
"Allocating %d bytes command buffer (max state is %d bytes)\n",
size * 4, rmesa->hw.max_state_size * 4);
- }
if (rmesa->radeonScreen->kernel_mm) {
int fd = rmesa->radeonScreen->driScreen->fd;
@@ -1388,14 +1382,13 @@ void rcommonBeginBatch(radeonContextPtr rmesa, int n,
int line)
{
if (!rmesa->cmdbuf.cs->cdw && dostate) {
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "Reemit state after flush (from %s)\n", function);
+ radeon_print(RADEON_STATE, RADEON_NORMAL,
+ "Reemit state after flush (from %s)\n", function);
radeonEmitState(rmesa);
}
radeon_cs_begin(rmesa->cmdbuf.cs, n, file, function, line);
- if (DEBUG_CMDBUF && RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "BEGIN_BATCH(%d) at %d, from %s:%i\n",
+ radeon_print(RADEON_CS, RADEON_VERBOSE, "BEGIN_BATCH(%d) at %d, from %s:%i\n",
n, rmesa->cmdbuf.cs->cdw, function, line);
}