rationalize debugging flags

This commit is contained in:
Keith Whitwell 2006-09-22 16:05:09 +00:00
parent e070007d16
commit 9d695abcac
8 changed files with 86 additions and 129 deletions

View file

@ -41,6 +41,8 @@
#include "i830_context.h"
#include "i830_reg.h"
#define FILE_DEBUG_FLAG DEBUG_STATE
static void
i830StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref,
GLuint mask)
@ -50,9 +52,8 @@ i830StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref,
mask = mask & 0xff;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s : func: %s, ref : 0x%x, mask: 0x%x\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(func), ref, mask);
DBG("%s : func: %s, ref : 0x%x, mask: 0x%x\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(func), ref, mask);
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
@ -72,9 +73,8 @@ i830StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask)
{
struct i830_context *i830 = i830_context(ctx);
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s : mask 0x%x\n", __FUNCTION__, mask);
DBG("%s : mask 0x%x\n", __FUNCTION__, mask);
mask = mask & 0xff;
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
@ -90,10 +90,10 @@ i830StencilOpSeparate(GLcontext * ctx, GLenum face, GLenum fail, GLenum zfail,
struct i830_context *i830 = i830_context(ctx);
int fop, dfop, dpop;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s: fail : %s, zfail: %s, zpass : %s\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(fail),
_mesa_lookup_enum_by_nr(zfail), _mesa_lookup_enum_by_nr(zpass));
DBG("%s: fail : %s, zfail: %s, zpass : %s\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(fail),
_mesa_lookup_enum_by_nr(zfail),
_mesa_lookup_enum_by_nr(zpass));
fop = 0;
dfop = 0;
@ -257,9 +257,8 @@ i830BlendColor(GLcontext * ctx, const GLfloat color[4])
struct i830_context *i830 = i830_context(ctx);
GLubyte r, g, b, a;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
UNCLAMPED_FLOAT_TO_UBYTE(r, color[RCOMP]);
UNCLAMPED_FLOAT_TO_UBYTE(g, color[GCOMP]);
UNCLAMPED_FLOAT_TO_UBYTE(b, color[BCOMP]);
@ -385,10 +384,9 @@ i830_set_blend_state(GLcontext * ctx)
static void
i830BlendEquationSeparate(GLcontext * ctx, GLenum modeRGB, GLenum modeA)
{
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s -> %s, %s\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(modeRGB),
_mesa_lookup_enum_by_nr(modeA));
DBG("%s -> %s, %s\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(modeRGB),
_mesa_lookup_enum_by_nr(modeA));
(void) modeRGB;
(void) modeA;
@ -400,12 +398,11 @@ static void
i830BlendFuncSeparate(GLcontext * ctx, GLenum sfactorRGB,
GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA)
{
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s -> RGB(%s, %s) A(%s, %s)\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(sfactorRGB),
_mesa_lookup_enum_by_nr(dfactorRGB),
_mesa_lookup_enum_by_nr(sfactorA),
_mesa_lookup_enum_by_nr(dfactorA));
DBG("%s -> RGB(%s, %s) A(%s, %s)\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(sfactorRGB),
_mesa_lookup_enum_by_nr(dfactorRGB),
_mesa_lookup_enum_by_nr(sfactorA),
_mesa_lookup_enum_by_nr(dfactorA));
(void) sfactorRGB;
(void) dfactorRGB;
@ -422,9 +419,8 @@ i830DepthFunc(GLcontext * ctx, GLenum func)
struct i830_context *i830 = i830_context(ctx);
int test = intel_translate_compare_func(func);
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
i830->state.Ctx[I830_CTXREG_STATE3] &= ~DEPTH_TEST_FUNC_MASK;
i830->state.Ctx[I830_CTXREG_STATE3] |= (ENABLE_DEPTH_TEST_FUNC |
@ -436,9 +432,8 @@ i830DepthMask(GLcontext * ctx, GLboolean flag)
{
struct i830_context *i830 = i830_context(ctx);
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s flag (%d)\n", __FUNCTION__, flag);
DBG("%s flag (%d)\n", __FUNCTION__, flag);
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
i830->state.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_DIS_DEPTH_WRITE_MASK;
@ -525,9 +520,8 @@ i830Scissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
x2 = x + w - 1;
y2 = y1 + h - 1;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "[%s] x(%d) y(%d) w(%d) h(%d)\n", __FUNCTION__,
x, y, w, h);
DBG("[%s] x(%d) y(%d) w(%d) h(%d)\n", __FUNCTION__,
x, y, w, h);
x1 = CLAMP(x1, 0, ctx->DrawBuffer->Width - 1);
y1 = CLAMP(y1, 0, ctx->DrawBuffer->Height - 1);
@ -545,9 +539,8 @@ i830LogicOp(GLcontext * ctx, GLenum opcode)
struct i830_context *i830 = i830_context(ctx);
int tmp = intel_translate_logic_op(opcode);
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
i830->state.Ctx[I830_CTXREG_STATE4] &= ~LOGICOP_MASK;
i830->state.Ctx[I830_CTXREG_STATE4] |= LOGIC_OP_FUNC(tmp);
@ -561,9 +554,8 @@ i830CullFaceFrontFace(GLcontext * ctx, GLenum unused)
struct i830_context *i830 = i830_context(ctx);
GLuint mode;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
if (!ctx->Polygon.CullFlag) {
mode = CULLMODE_NONE;
}
@ -591,9 +583,8 @@ i830LineWidth(GLcontext * ctx, GLfloat widthf)
int width;
int state5;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
width = (int) (widthf * 2);
CLAMP_SELF(width, 1, 15);
@ -612,9 +603,8 @@ i830PointSize(GLcontext * ctx, GLfloat size)
struct i830_context *i830 = i830_context(ctx);
GLint point_size = (int) size;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
CLAMP_SELF(point_size, 1, 256);
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
i830->state.Ctx[I830_CTXREG_STATE5] &= ~FIXED_POINT_WIDTH_MASK;
@ -634,9 +624,7 @@ i830ColorMask(GLcontext * ctx,
struct i830_context *i830 = i830_context(ctx);
GLuint tmp = 0;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s r(%d) g(%d) b(%d) a(%d)\n", __FUNCTION__, r, g, b,
a);
DBG("%s r(%d) g(%d) b(%d) a(%d)\n", __FUNCTION__, r, g, b, a);
tmp = ((i830->state.Ctx[I830_CTXREG_ENABLES_2] & ~WRITEMASK_MASK) |
ENABLE_COLOR_MASK |
@ -668,9 +656,8 @@ update_specular(GLcontext * ctx)
static void
i830LightModelfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
{
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
update_specular(ctx);
}
@ -712,9 +699,8 @@ i830Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
{
struct i830_context *i830 = i830_context(ctx);
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
if (pname == GL_FOG_COLOR) {
GLuint color = (((GLubyte) (ctx->Fog.Color[0] * 255.0F) << 16) |
((GLubyte) (ctx->Fog.Color[1] * 255.0F) << 8) |

View file

@ -43,7 +43,7 @@
#include "i915_context.h"
#include "i915_reg.h"
#define FILE_DEBUG_FLAG DEBUG_STATE
static void
i915StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref,
@ -54,9 +54,8 @@ i915StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref,
mask = mask & 0xff;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s : func: %s, ref : 0x%x, mask: 0x%x\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(func), ref, mask);
DBG("%s : func: %s, ref : 0x%x, mask: 0x%x\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(func), ref, mask);
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
@ -77,9 +76,8 @@ i915StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s : mask 0x%x\n", __FUNCTION__, mask);
DBG("%s : mask 0x%x\n", __FUNCTION__, mask);
mask = mask & 0xff;
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
@ -99,10 +97,9 @@ i915StencilOpSeparate(GLcontext * ctx, GLenum face, GLenum fail, GLenum zfail,
int dpop = intel_translate_stencil_op(zpass);
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s: fail : %s, zfail: %s, zpass : %s\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(fail),
_mesa_lookup_enum_by_nr(zfail), _mesa_lookup_enum_by_nr(zpass));
DBG("%s: fail : %s, zfail: %s, zpass : %s\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(fail),
_mesa_lookup_enum_by_nr(zfail), _mesa_lookup_enum_by_nr(zpass));
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
@ -169,9 +166,8 @@ i915BlendColor(GLcontext * ctx, const GLfloat color[4])
struct i915_context *i915 = I915_CONTEXT(ctx);
GLubyte r, g, b, a;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
UNCLAMPED_FLOAT_TO_UBYTE(r, color[RCOMP]);
UNCLAMPED_FLOAT_TO_UBYTE(g, color[GCOMP]);
UNCLAMPED_FLOAT_TO_UBYTE(b, color[BCOMP]);
@ -281,9 +277,8 @@ i915DepthFunc(GLcontext * ctx, GLenum func)
struct i915_context *i915 = I915_CONTEXT(ctx);
int test = intel_translate_compare_func(func);
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
i915->state.Ctx[I915_CTXREG_LIS6] &= ~S6_DEPTH_TEST_FUNC_MASK;
i915->state.Ctx[I915_CTXREG_LIS6] |= test << S6_DEPTH_TEST_FUNC_SHIFT;
@ -294,9 +289,8 @@ i915DepthMask(GLcontext * ctx, GLboolean flag)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s flag (%d)\n", __FUNCTION__, flag);
DBG("%s flag (%d)\n", __FUNCTION__, flag);
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
if (flag && ctx->Depth.Test)
@ -381,9 +375,8 @@ i915Scissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
x2 = x + w - 1;
y2 = y1 + h - 1;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "[%s] x(%d) y(%d) w(%d) h(%d)\n", __FUNCTION__,
x, y, w, h);
DBG("[%s] x(%d) y(%d) w(%d) h(%d)\n", __FUNCTION__,
x, y, w, h);
x1 = CLAMP(x1, 0, ctx->DrawBuffer->Width - 1);
y1 = CLAMP(y1, 0, ctx->DrawBuffer->Height - 1);
@ -401,9 +394,8 @@ i915LogicOp(GLcontext * ctx, GLenum opcode)
struct i915_context *i915 = I915_CONTEXT(ctx);
int tmp = intel_translate_logic_op(opcode);
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
i915->state.Ctx[I915_CTXREG_STATE4] &= ~LOGICOP_MASK;
i915->state.Ctx[I915_CTXREG_STATE4] |= LOGIC_OP_FUNC(tmp);
@ -417,9 +409,8 @@ i915CullFaceFrontFace(GLcontext * ctx, GLenum unused)
struct i915_context *i915 = I915_CONTEXT(ctx);
GLuint mode;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s %d\n", __FUNCTION__,
ctx->DrawBuffer ? ctx->DrawBuffer->Name : 0);
DBG("%s %d\n", __FUNCTION__,
ctx->DrawBuffer ? ctx->DrawBuffer->Name : 0);
if (!ctx->Polygon.CullFlag) {
mode = S4_CULLMODE_NONE;
@ -450,9 +441,8 @@ i915LineWidth(GLcontext * ctx, GLfloat widthf)
int lis4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_LINE_WIDTH_MASK;
int width;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
width = (int) (widthf * 2);
CLAMP_SELF(width, 1, 0xf);
lis4 |= width << S4_LINE_WIDTH_SHIFT;
@ -470,9 +460,8 @@ i915PointSize(GLcontext * ctx, GLfloat size)
int lis4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_POINT_WIDTH_MASK;
GLint point_size = (int) size;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
CLAMP_SELF(point_size, 1, 255);
lis4 |= point_size << S4_POINT_WIDTH_SHIFT;
@ -494,9 +483,8 @@ i915ColorMask(GLcontext * ctx,
struct i915_context *i915 = I915_CONTEXT(ctx);
GLuint tmp = i915->state.Ctx[I915_CTXREG_LIS5] & ~S5_WRITEDISABLE_MASK;
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s r(%d) g(%d) b(%d) a(%d)\n", __FUNCTION__, r, g, b,
a);
DBG("%s r(%d) g(%d) b(%d) a(%d)\n", __FUNCTION__, r, g, b,
a);
if (!r)
tmp |= S5_WRITEDISABLE_RED;
@ -525,9 +513,8 @@ update_specular(GLcontext * ctx)
static void
i915LightModelfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
{
if (INTEL_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
DBG("%s\n", __FUNCTION__);
if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
update_specular(ctx);
}

View file

@ -348,8 +348,7 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask, GLboolean all,
GLbitfield skipBuffers = 0;
BATCH_LOCALS;
if (INTEL_DEBUG & DEBUG_DRI)
_mesa_printf("%s %x\n", __FUNCTION__, mask);
DBG("%s %x\n", __FUNCTION__, mask);
/*
* Compute values for clearing the buffers.

View file

@ -288,7 +288,7 @@ intelClearWithTris(struct intel_context *intel,
GLcontext *ctx = &intel->ctx;
drm_clip_rect_t clear;
if (INTEL_DEBUG & DEBUG_DRI)
if (INTEL_DEBUG & DEBUG_BLIT)
_mesa_printf("%s 0x%x\n", __FUNCTION__, mask);
LOCK_HARDWARE(intel);

View file

@ -219,20 +219,17 @@ static const struct tnl_pipeline_stage *intel_pipeline[] = {
static const struct dri_debug_control debug_control[] = {
{"fall", DEBUG_FALLBACKS},
{"tex", DEBUG_TEXTURE},
{"state", DEBUG_STATE},
{"ioctl", DEBUG_IOCTL},
{"blit", DEBUG_BLIT},
{"vert", DEBUG_VERTS},
{"state", DEBUG_STATE},
{"mip", DEBUG_MIPTREE},
{"fall", DEBUG_FALLBACKS},
{"verb", DEBUG_VERBOSE},
{"dri", DEBUG_DRI},
{"bat", DEBUG_BATCH},
{"san", DEBUG_SANITY},
{"sync", DEBUG_SYNC},
{"sleep", DEBUG_SLEEP},
{"pix", DEBUG_PIXEL},
{"buf", DEBUG_BUFMGR},
{"reg", DEBUG_REGION},
{"fbo", DEBUG_FBO},
{NULL, 0}
};

View file

@ -436,17 +436,14 @@ extern int INTEL_DEBUG;
#define DEBUG_STATE 0x2
#define DEBUG_IOCTL 0x4
#define DEBUG_BLIT 0x8
#define DEBUG_VERTS 0x10
#define DEBUG_MIPTREE 0x10
#define DEBUG_FALLBACKS 0x20
#define DEBUG_VERBOSE 0x40
#define DEBUG_DRI 0x80
#define DEBUG_BATCH 0x100
#define DEBUG_SANITY 0x200
#define DEBUG_SYNC 0x400
#define DEBUG_SLEEP 0x800
#define DEBUG_PIXEL 0x1000
#define DEBUG_BUFMGR 0x2000
#define DEBUG_FBO 0x4000
#define DEBUG_BATCH 0x80
#define DEBUG_PIXEL 0x100
#define DEBUG_BUFMGR 0x200
#define DEBUG_REGION 0x400
#define DEBUG_FBO 0x800
#define DBG(...) do { if (INTEL_DEBUG & FILE_DEBUG_FLAG) _mesa_printf(__VA_ARGS__); } while(0)

View file

@ -30,7 +30,7 @@
#include "intel_regions.h"
#include "enums.h"
#define FILE_DEBUG_FLAG DEBUG_TEXTURE
#define FILE_DEBUG_FLAG DEBUG_MIPTREE
static GLenum
target_to_target(GLenum target)
@ -112,6 +112,7 @@ intel_miptree_reference(struct intel_mipmap_tree **dst,
{
src->refcount++;
*dst = src;
DBG("%s %p refcount now %d\n", __FUNCTION__, src, src->refcount);
}
void
@ -121,10 +122,12 @@ intel_miptree_release(struct intel_context *intel,
if (!*mt)
return;
DBG("%s %d\n", __FUNCTION__, (*mt)->refcount - 1);
DBG("%s %p refcount will be %d\n", __FUNCTION__, *mt, (*mt)->refcount - 1);
if (--(*mt)->refcount <= 0) {
GLuint i;
DBG("%s deleting %p\n", __FUNCTION__, *mt);
intel_region_release(intel, &((*mt)->region));
for (i = 0; i < MAX_TEXTURE_LEVELS; i++)
@ -149,25 +152,15 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt,
struct gl_texture_image *image,
GLuint face, GLuint level)
{
DBG("%s %d %d/%d %d/%d\n", __FUNCTION__,
image->Border,
image->InternalFormat, mt->internal_format,
image->IsCompressed, mt->compressed);
/* Images with borders are never pulled into mipmap trees.
*/
if (image->Border)
if (image->Border)
return GL_FALSE;
if (image->InternalFormat != mt->internal_format ||
image->IsCompressed != mt->compressed)
return GL_FALSE;
DBG("%s: %d/%d %d/%d %d/%d\n", __FUNCTION__,
image->Width, mt->level[level].width,
image->Height, mt->level[level].height,
image->Depth, mt->level[level].depth);
/* Test image dimensions against the base level image adjusted for
* minification. This will also catch images not present in the
* tree, changed targets, etc.
@ -177,8 +170,6 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt,
image->Depth != mt->level[level].depth)
return GL_FALSE;
DBG("%s: success\n", __FUNCTION__);
return GL_TRUE;
}

View file

@ -46,7 +46,7 @@
#include "dri_bufmgr.h"
#include "intel_batchbuffer.h"
#define FILE_DEBUG_FLAG DEBUG_BUFMGR
#define FILE_DEBUG_FLAG DEBUG_REGION
void
intel_region_idle(struct intel_context *intel, struct intel_region *region)