From: Eric Anholt Date: Tue, 27 Oct 2009 17:26:09 +0000 (-0700) Subject: i915: Fix driver for the miptree x/y offset changes. X-Git-Tag: mesa-7.8~2757 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f9f5a78408dbd86b2f9c25ee8a15581b9122fcc;p=platform%2Fupstream%2Fmesa.git i915: Fix driver for the miptree x/y offset changes. Bug #24734. --- diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index f270a13..20ff46b 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -160,10 +160,18 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) pitch = intelObj->pitchOverride; } else { + GLuint dst_x, dst_y; + + intel_miptree_get_image_offset(intelObj->mt, intelObj->firstLevel, 0, 0, + &dst_x, &dst_y); + dri_bo_reference(intelObj->mt->region->buffer); i830->state.tex_buffer[unit] = intelObj->mt->region->buffer; - i830->state.tex_offset[unit] = - intel_miptree_image_offset(intelObj->mt, 0, intelObj->firstLevel, 0); + /* XXX: This calculation is probably broken for tiled images with + * a non-page-aligned offset. + */ + i830->state.tex_offset[unit] = (dst_x + dst_y * intelObj->mt->pitch) * + intelObj->mt->cpp; format = translate_texture_format(firstImage->TexFormat->MesaFormat, firstImage->InternalFormat); diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index b2f82f5..998a04f 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -171,10 +171,18 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) pitch = intelObj->pitchOverride; } else { + GLuint dst_x, dst_y; + + intel_miptree_get_image_offset(intelObj->mt, intelObj->firstLevel, 0, 0, + &dst_x, &dst_y); + dri_bo_reference(intelObj->mt->region->buffer); i915->state.tex_buffer[unit] = intelObj->mt->region->buffer; - i915->state.tex_offset[unit] = - intel_miptree_image_offset(intelObj->mt, 0, intelObj->firstLevel, 0); + /* XXX: This calculation is probably broken for tiled images with + * a non-page-aligned offset. + */ + i915->state.tex_offset[unit] = (dst_x + dst_y * intelObj->mt->pitch) * + intelObj->mt->cpp; format = translate_texture_format(firstImage->TexFormat->MesaFormat, firstImage->InternalFormat,