i965: fix depth test on sandybridge
authorZhenyu Wang <zhenyuw@linux.intel.com>
Tue, 31 Aug 2010 01:54:44 +0000 (09:54 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Tue, 31 Aug 2010 01:58:18 +0000 (09:58 +0800)
This includes several corrections for fixing depth test on sandybridge.
Fix wrong bits definition in depth stencil state. Fix wrong order of
state buffer offset in 3DSTATE_CC_STATE_POINTERS command. Correctly use
buffer width parameter in depth buffer setting.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
src/mesa/drivers/dri/i965/brw_misc_state.c
src/mesa/drivers/dri/i965/brw_structs.h
src/mesa/drivers/dri/i965/gen6_cc.c

index 565a9e3ee18bc8999725a386e1937aeb49c955c5..6eeaba777207d35fd4d96e28ba9537c1eca1ae2c 100644 (file)
@@ -295,7 +295,7 @@ static void emit_depthbuffer(struct brw_context *brw)
                I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
                0);
       OUT_BATCH((BRW_SURFACE_MIPMAPLAYOUT_BELOW << 1) |
-               ((region->pitch - 1) << 6) |
+               ((region->width - 1) << 6) |
                ((region->height - 1) << 19));
       OUT_BATCH(0);
 
index cdd2998627f9525c39f95bb6612ed5644edd4c58..2a118e01c5386e8869d98836166d2b2c171dc271 100644 (file)
@@ -750,7 +750,7 @@ struct gen6_depth_stencil_state
    } ds1;
 
    struct {
-      GLuint pad0:25;
+      GLuint pad0:26;
       GLuint depth_write_enable:1;
       GLuint depth_test_func:3;
       GLuint pad1:1;
index f7acad6912950aa9099db4899fd05e08db335f9a..26f1070a16407f778c46da5f56c14a28db4eee79 100644 (file)
@@ -267,9 +267,9 @@ static void upload_cc_state_pointers(struct brw_context *brw)
 
    BEGIN_BATCH(4);
    OUT_BATCH(CMD_3D_CC_STATE_POINTERS << 16 | (4 - 2));
-   OUT_RELOC(brw->cc.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
    OUT_RELOC(brw->cc.blend_state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
    OUT_RELOC(brw->cc.depth_stencil_state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
+   OUT_RELOC(brw->cc.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
    ADVANCE_BATCH();
 
    intel_batchbuffer_emit_mi_flush(intel->batch);