diff options
author | Eric Anholt <[email protected]> | 2010-11-02 19:55:07 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-11-03 06:08:27 -0700 |
commit | bb1540835056cdea5db6f55b19c0c87358f14cd1 (patch) | |
tree | 0706831df699c89f82558d983651fdf4489dfe6c /src/mesa/drivers/dri/intel/intel_clear.c | |
parent | b19b8580602a6ba37e81dc8b64c4ed30c1518886 (diff) |
intel: Annotate debug printout checks with unlikely().
This provides the optimizer with hints about code hotness, which we're
quite certain about for debug printouts (or, rather, while we
developers often hit the checks for debug printouts, we don't care
about performance while doing so).
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_clear.c')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_clear.c | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index d7814635b72..fa451f0045e 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -58,6 +58,21 @@ static const char *buffer_names[] = { [BUFFER_COLOR7] = "color7", }; +static void +debug_mask(const char *name, GLbitfield mask) +{ + GLuint i; + + if (unlikely(INTEL_DEBUG & DEBUG_BLIT)) { + DBG("%s clear:", name); + for (i = 0; i < BUFFER_COUNT; i++) { + if (mask & (1 << i)) + DBG(" %s", buffer_names[i]); + } + DBG("\n"); + } +} + /** * Called by ctx->Driver.Clear. */ @@ -70,7 +85,6 @@ intelClear(struct gl_context *ctx, GLbitfield mask) GLbitfield blit_mask = 0; GLbitfield swrast_mask = 0; struct gl_framebuffer *fb = ctx->DrawBuffer; - GLuint i; if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT)) { intel->front_buffer_dirty = GL_TRUE; @@ -162,39 +176,17 @@ intelClear(struct gl_context *ctx, GLbitfield mask) } if (blit_mask) { - if (INTEL_DEBUG & DEBUG_BLIT) { - DBG("blit clear:"); - for (i = 0; i < BUFFER_COUNT; i++) { - if (blit_mask & (1 << i)) - DBG(" %s", buffer_names[i]); - } - DBG("\n"); - } + debug_mask("blit", blit_mask); intelClearWithBlit(ctx, blit_mask); } if (tri_mask) { - if (INTEL_DEBUG & DEBUG_BLIT) { - DBG("tri clear:"); - for (i = 0; i < BUFFER_COUNT; i++) { - if (tri_mask & (1 << i)) - DBG(" %s", buffer_names[i]); - } - DBG("\n"); - } - + debug_mask("tri", tri_mask); _mesa_meta_Clear(&intel->ctx, tri_mask); } if (swrast_mask) { - if (INTEL_DEBUG & DEBUG_BLIT) { - DBG("swrast clear:"); - for (i = 0; i < BUFFER_COUNT; i++) { - if (swrast_mask & (1 << i)) - DBG(" %s", buffer_names[i]); - } - DBG("\n"); - } + debug_mask("swrast", swrast_mask); _swrast_Clear(ctx, swrast_mask); } } |