From 762ed4db4707f3605918c18ae9a7beb29ca7418f Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 17 Apr 2010 23:28:43 +0100 Subject: [PATCH] i915g: Clean and add some debug printing Disabled by default --- .../drivers/i915/i915_resource_texture.c | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c index d9bb63b5f9b..9b1d1451faf 100644 --- a/src/gallium/drivers/i915/i915_resource_texture.c +++ b/src/gallium/drivers/i915/i915_resource_texture.c @@ -44,6 +44,8 @@ #include "i915_winsys.h" +#define DEBUG_TEXTURES 0 + /* * Helper function and arrays */ @@ -115,10 +117,11 @@ i915_texture_set_image_offset(struct i915_texture *tex, tex->image_offset[level][img] = y * tex->stride + x * util_format_get_blocksize(tex->b.b.format); - /* - printf("%s level %d img %d pos %d,%d image_offset %x\n", - __FUNCTION__, level, img, x, y, tex->image_offset[level][img]); - */ +#if DEBUG_TEXTURES + debug_printf("%s: %p level %u, img %u (%u, %u) %p\n", __FUNCTION__, + tex, level, img, x, y, + (void*)(uintptr_t)tex->image_offset[level][img]); +#endif } @@ -152,9 +155,11 @@ i9x5_scanout_layout(struct i915_texture *tex) return FALSE; } +#if DEBUG_TEXTURE debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, pt->width0, pt->height0, util_format_get_blocksize(pt->format), tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy); +#endif return TRUE; } @@ -181,9 +186,11 @@ i9x5_display_target_layout(struct i915_texture *tex) tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8); tex->hw_tiled = I915_TILE_X; +#if DEBUG_TEXTURE debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, pt->width0, pt->height0, util_format_get_blocksize(pt->format), tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy); +#endif return TRUE; } @@ -622,10 +629,6 @@ i915_texture_destroy(struct pipe_screen *screen, struct i915_winsys *iws = i915_screen(screen)->iws; uint i; - /* - DBG("%s deleting %p\n", __FUNCTION__, (void *) tex); - */ - iws->buffer_destroy(iws, tex->buffer); for (i = 0; i < Elements(tex->image_offset); i++) @@ -773,6 +776,13 @@ i915_texture_create(struct pipe_screen *screen, ws->buffer_unmap(ws, tex->buffer); #endif +#if DEBUG_TEXTURES + debug_printf("%s: %p size %u, stride %u, blocks (%u, %u)\n", __func__, + tex, (unsigned int)tex_size, tex->stride, + tex->stride / util_format_get_blocksize(tex->b.b.format), + tex->total_nblocksy); +#endif + return &tex->b.b; fail: -- 2.30.2