From f67bb30314cfb6067230290f21328427124a9900 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 25 Jan 2006 17:16:46 +0000 Subject: [PATCH] Fix confusion over pitch. demos/texobj renders correctly. --- src/mesa/drivers/dri/i915/i915_tex_layout.c | 18 +++++++++--------- src/mesa/drivers/dri/i915/i915_texstate.c | 2 +- src/mesa/drivers/dri/i915/intel_batchbuffer.h | 2 +- src/mesa/drivers/dri/i915/intel_ioctl.c | 5 +++-- src/mesa/drivers/dri/i915/intel_mipmap_tree.c | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c index 3c95af1f788..bf0d551bf5f 100644 --- a/src/mesa/drivers/dri/i915/i915_tex_layout.c +++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c @@ -62,7 +62,7 @@ GLboolean i915_miptree_layout( struct intel_mipmap_tree *mt ) GLuint face; /* double pitch for cube layouts */ - mt->pitch = (dim * mt->cpp * 2 + 3) & ~3; + mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp; mt->total_height = dim * 4; for ( face = 0 ; face < 6 ; face++) { @@ -95,7 +95,7 @@ GLboolean i915_miptree_layout( struct intel_mipmap_tree *mt ) * minimum of 8 mipmaps, some of which might ultimately not be * used: */ - mt->pitch = (mt->width0 * mt->cpp + 3) & ~3; + mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp; mt->total_height = 0; /* XXX: fixme! hardware expects/requires 9 levels at minimum. @@ -128,7 +128,7 @@ GLboolean i915_miptree_layout( struct intel_mipmap_tree *mt ) GLuint width = mt->width0; GLuint height = mt->height0; - mt->pitch = (mt->width0 * mt->cpp + 3) & ~3; + mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp; mt->total_height = 0; for ( i = mt->first_level ; i <= mt->last_level ; i++ ) { @@ -169,9 +169,9 @@ GLboolean i945_miptree_layout( struct intel_mipmap_tree *mt ) * or the final row of 4x4, 2x2 and 1x1 faces below this. */ if (dim > 32) - mt->pitch = (dim * mt->cpp * 2 + 3) & ~3; + mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp; else - mt->pitch = 14 * 8 * mt->cpp; + mt->pitch = 14 * 8; mt->total_height = dim * 4 + 4; @@ -245,10 +245,10 @@ GLboolean i945_miptree_layout( struct intel_mipmap_tree *mt ) GLuint depth_pack_pitch; GLuint depth_packing = 0; - mt->pitch = (mt->width0 * mt->cpp + 3) & ~3; + mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp; mt->total_height = 0; - depth_pack_pitch = mt->pitch; + depth_pack_pitch = mt->pitch * mt->cpp; for ( i = mt->first_level ; i <= mt->last_level ; i++ ) { @@ -287,7 +287,7 @@ GLboolean i945_miptree_layout( struct intel_mipmap_tree *mt ) GLuint width = mt->width0; GLuint height = mt->height0; - mt->pitch = (mt->width0 * mt->cpp + 3) & ~3; + mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp; mt->total_height = 0; for ( i = mt->first_level ; i <= mt->last_level ; i++ ) { @@ -301,7 +301,7 @@ GLboolean i945_miptree_layout( struct intel_mipmap_tree *mt ) /* LPT change: step right after second mipmap. */ if (i == 1) - x += mt->pitch / (2 * mt->cpp); + x += mt->pitch / 2; else { GLuint img_height; diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 289eeb92e10..0eed85c201d 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -130,7 +130,7 @@ static GLboolean i915_update_tex_unit( GLcontext *ctx, MS3_USE_FENCE_REGS); state[I915_TEXREG_MS4] = - ((((intelObj->mt->pitch / 4) - 1) << MS4_PITCH_SHIFT) | + (((((intelObj->mt->pitch * intelObj->mt->cpp) / 4) - 1) << MS4_PITCH_SHIFT) | MS4_CUBE_FACE_ENA_MASK | ((((intelObj->lastLevel - intelObj->firstLevel) * 4)) << MS4_MAX_LOD_SHIFT) | ((firstImage->Depth - 1) << MS4_VOLUME_DEPTH_SHIFT)); diff --git a/src/mesa/drivers/dri/i915/intel_batchbuffer.h b/src/mesa/drivers/dri/i915/intel_batchbuffer.h index b62c77f5bf7..0d6aae93ae2 100644 --- a/src/mesa/drivers/dri/i915/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/i915/intel_batchbuffer.h @@ -34,7 +34,7 @@ #define BATCH_LOCALS GLubyte *batch_ptr; -#define VERBOSE 1 +#define VERBOSE 0 #define BEGIN_BATCH(n) \ diff --git a/src/mesa/drivers/dri/i915/intel_ioctl.c b/src/mesa/drivers/dri/i915/intel_ioctl.c index a0300e3d22c..797dc6fd9f3 100644 --- a/src/mesa/drivers/dri/i915/intel_ioctl.c +++ b/src/mesa/drivers/dri/i915/intel_ioctl.c @@ -98,8 +98,9 @@ void intel_dump_batchbuffer( long offset, int i; fprintf(stderr, "\n\n\nSTART BATCH (%d dwords):\n", count); for (i = 0; i < count/4; i += 4) - fprintf(stderr, "\t0x%x: 0x%08x 0x%08x 0x%08x 0x%08x\n", - (unsigned int)offset + i*4, ptr[i], ptr[i+1], ptr[i+2], ptr[i+3]); + fprintf(stderr, "\t0x%08x 0x%08x 0x%08x 0x%08x\n", +/* (unsigned int)offset + i*4, */ + ptr[i], ptr[i+1], ptr[i+2], ptr[i+3]); fprintf(stderr, "END BATCH\n\n\n"); } diff --git a/src/mesa/drivers/dri/i915/intel_mipmap_tree.c b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c index 4b067fd023d..0c77691108d 100644 --- a/src/mesa/drivers/dri/i915/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c @@ -183,7 +183,7 @@ GLubyte *intel_miptree_image_map(struct intel_context *intel, GLuint level, GLuint *stride) { - _mesa_printf("%s\n", __FUNCTION__); + _mesa_printf("%s \n", __FUNCTION__); if (stride) *stride = mt->pitch * mt->cpp;