Merge branch 'master' into i915-unification
authorEric Anholt <eric@anholt.net>
Thu, 24 May 2007 20:59:50 +0000 (13:59 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 24 May 2007 23:46:54 +0000 (16:46 -0700)
Conflicts:

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

1  2 
src/mesa/drivers/dri/i915tex/i830_texstate.c
src/mesa/drivers/dri/i915tex/i915_texstate.c
src/mesa/drivers/dri/i915tex/i915_vtbl.c
src/mesa/drivers/dri/i915tex/intel_context.h
src/mesa/drivers/dri/i915tex/intel_screen.c
src/mesa/drivers/dri/i915tex/intel_tex_image.c

index b25ec199f8a499ff9e0ebbbebc1c34c840f93962,0d3f053226ff8c5748fd2bfa67eb9a91236ccb0a..7613b9d2a6f9bd8664d0f33129b12f1382597504
@@@ -136,12 -136,34 +136,34 @@@ i830_update_tex_unit(struct intel_conte
      */
     firstImage = tObj->Image[0][intelObj->firstLevel];
  
-    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);
+    if (intelObj->imageOverride) {
+       i830->state.tex_buffer[unit] = NULL;
+       i830->state.tex_offset[unit] = intelObj->textureOffset;
+       switch (intelObj->depthOverride) {
+       case 32:
+        format = MAPSURF_32BIT | MT_32BIT_ARGB8888;
+        break;
+       case 24:
+       default:
+        format = MAPSURF_32BIT | MT_32BIT_XRGB8888;
+        break;
+       case 16:
+        format = MAPSURF_16BIT | MT_16BIT_RGB565;
+        break;
+       }
+       pitch = intelObj->pitchOverride;
+    } else {
 -      i830->state.tex_buffer[unit] = driBOReference(intelObj->mt->region->
 -                                                  buffer);
++      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);
+       format = translate_texture_format(firstImage->TexFormat->MesaFormat);
+       pitch = intelObj->mt->pitch * intelObj->mt->cpp;
+    }
  
     state[I830_TEXREG_TM0LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
                                 (LOAD_TEXTURE_MAP0 << unit) | 4);
index 31d18759ee5d82ed76cf89e05b0309cf55746462,3d68187cf88a1d6c6a4587c034210ad19afa0919..09684e87b4eedf87ca1d89574c182fa31083c86b
@@@ -141,12 -141,34 +141,34 @@@ i915_update_tex_unit(struct intel_conte
      */
     firstImage = tObj->Image[0][intelObj->firstLevel];
  
-    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);
+    if (intelObj->imageOverride) {
+       i915->state.tex_buffer[unit] = NULL;
+       i915->state.tex_offset[unit] = intelObj->textureOffset;
+       switch (intelObj->depthOverride) {
+       case 32:
+        format = MAPSURF_32BIT | MT_32BIT_ARGB8888;
+        break;
+       case 24:
+       default:
+        format = MAPSURF_32BIT | MT_32BIT_XRGB8888;
+        break;
+       case 16:
+        format = MAPSURF_16BIT | MT_16BIT_RGB565;
+        break;
+       }
+       pitch = intelObj->pitchOverride;
+    } else {
 -      i915->state.tex_buffer[unit] = driBOReference(intelObj->mt->region->
 -                                                  buffer);
++      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);
+       format = translate_texture_format(firstImage->TexFormat->MesaFormat);
+       pitch = intelObj->mt->pitch * intelObj->mt->cpp;
+    }
  
     state[I915_TEXREG_MS3] =
        (((firstImage->Height - 1) << MS3_HEIGHT_SHIFT) |
index 50571b7e83b778aeb89235c1544164d64bfac0af,f80e8d6327f3dc071a8b04af47334f204d9a5599..2a3ccd01a054dfb7f50576af993f03bd3631706f
@@@ -376,13 -378,16 +376,15 @@@ i915_emit_state(struct intel_context *i
              if (state->tex_buffer[i]) {
                 OUT_RELOC(state->tex_buffer[i],
                           DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
 -                         DRM_BO_MASK_MEM | DRM_BO_FLAG_READ,
                           state->tex_offset[i]);
              }
-             else {
+             else if (state == &i915->meta) {
                 assert(i == 0);
-                assert(state == &i915->meta);
                 OUT_BATCH(0);
              }
+             else {
+                OUT_BATCH(state->tex_offset[i]);
+             }
  
              OUT_BATCH(state->Tex[i][I915_TEXREG_MS3]);
              OUT_BATCH(state->Tex[i][I915_TEXREG_MS4]);