i915: Fix driver for the miptree x/y offset changes.
authorEric Anholt <eric@anholt.net>
Tue, 27 Oct 2009 17:26:09 +0000 (10:26 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 27 Oct 2009 17:27:15 +0000 (10:27 -0700)
Bug #24734.

src/mesa/drivers/dri/i915/i830_texstate.c
src/mesa/drivers/dri/i915/i915_texstate.c

index 6f998fa6f773826eae70dcba0f9f476370cb72e4..20ff46b0b0cd1021a3c303b8181482829563beee 100644 (file)
@@ -160,11 +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);
+      /* 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);
index 32d4b30cf9a610ea02bb1e7f96790ab60c30f399..998a04f7949f05011c4616ea6e623a508116513d 100644 (file)
@@ -171,11 +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);
+      /* 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,