Bug 57357

Summary: [Bisect ILK]Piglit hiz_hiz-stencil-read-fbo-d0-s8 segfault
Product: Mesa Reporter: lu hua <huax.lu>
Component: Drivers/DRI/i965Assignee: Eric Anholt <eric>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: high CC: idr, xunx.fang
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description lu hua 2012-11-21 05:23:08 UTC
System Environment:
--------------------------
Arch:             x86_64
Platform:         Ironlake
Libdrm:	(master)libdrm-2.4.40-1-g7d42b49c0cf19dbb4531cd84efae51f95db2eea1
Mesa:	(master)1665af3066f3d58c42e9d5b13098f13615a7672c
Xserver:(master)xorg-server-1.13.0-143-g6a6c3afe71ac82a93d9fd0034dd5bbdcf0eae1ea
Xf86_video_intel:(master)2.20.13-9-g866ed4a26cbbb29ef3845b0aa56383c4d951c65a
Cairo:	(master)62b795fe52c73ad58101c101aa77449f4b61a576
Libva:	(staging)38c94cd922473095814ed9a9f99ad98fcc9c285d
Libva_intel_driver:		(staging)e30019e8b90e67fb7599c27b94c30ae644f2ff07
Kernel:	(drm-intel-nightly) 628302221814f3c00858b5fcbc11df8f0c6f60d2

Bug detailed description:
-------------------------
It happens on ironlake with mesa master branch. It doesn't happen on 9.0 branch.

Following cases also segfault, and have some bisect commit.
glean_fbo
hiz_hiz-depth-stencil-test-fbo-d0-s8
hiz_hiz-stencil-read-fbo-d0-s8
hiz_hiz-stencil-test-fbo-d0-s8
spec_ARB_depth_buffer_float_fbo-clear-formats_stencil
spec_ARB_depth_buffer_float_fbo-stencil-GL_DEPTH32F_STENCIL8-blit
spec_ARB_depth_buffer_float_fbo-stencil-GL_DEPTH32F_STENCIL8-clear
spec_ARB_depth_buffer_float_fbo-stencil-GL_DEPTH32F_STENCIL8-copypixels
spec_ARB_depth_buffer_float_fbo-stencil-GL_DEPTH32F_STENCIL8-drawpixels
spec_ARB_depth_buffer_float_fbo-stencil-GL_DEPTH32F_STENCIL8-readpixels
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX1-blit
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX1-clear
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX1-copypixels
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX1-drawpixels
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX1-readpixels
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX16-blit
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX16-clear
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX16-copypixels
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX16-drawpixels
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX16-readpixels
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX4-blit
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX4-clear
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX4-copypixels
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX4-drawpixels
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX4-readpixels
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX8-blit
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX8-clear
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX8-copypixels
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX8-drawpixels
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX8-readpixels
spec_EXT_packed_depth_stencil_depthstencil-render-miplevels_1024_s=z24_s8
spec_EXT_packed_depth_stencil_depthstencil-render-miplevels_146_s=z24_s8
spec_EXT_packed_depth_stencil_depthstencil-render-miplevels_292_s=z24_s8
spec_EXT_packed_depth_stencil_depthstencil-render-miplevels_585_s=z24_s8
spec_EXT_packed_depth_stencil_fbo-stencil-GL_DEPTH24_STENCIL8-blit
spec_EXT_packed_depth_stencil_fbo-stencil-GL_DEPTH24_STENCIL8-clear
spec_EXT_packed_depth_stencil_fbo-stencil-GL_DEPTH24_STENCIL8-copypixels
spec_EXT_packed_depth_stencil_fbo-stencil-GL_DEPTH24_STENCIL8-drawpixels
spec_EXT_packed_depth_stencil_fbo-stencil-GL_DEPTH24_STENCIL8-readpixels
fbblit(advanced.blitFb.bounds)
fbblit(advanced.blitFb.clamp.fixedToFixed)
fbblit(advanced.blitFb.clamp.floatToFixed)
fbblit(advanced.blitFb.filter.linear)
fbblit(advanced.blitFb.filter.nearest)
fbblit(advanced.blitFb.fragop.alphatest)
fbblit(advanced.blitFb.fragop.scissortest)
fbblit(advanced.blitFb.fragop.stenciltest)
fbblit(advanced.blitFb.mask.color)
fbblit(advanced.blitFb.mask.depth)
fbblit(advanced.blitFb.mask.stencil)
fbblit(advanced.blitFb.mirror.both)
fbblit(advanced.blitFb.mirror.horizontal)
fbblit(advanced.blitFb.mirror.negated)
fbblit(advanced.blitFb.mirror.vertical)
fbblit(advanced.blitFb.nonStretch)
fbblit(advanced.blitFb.stretch)
fbblit(advanced.copyPx.clamp.fixedToFixed)
fbblit(advanced.copyPx.clamp.floatToFixed)
fbblit(advanced.copyPx.nonstretch)
fbo(renderToRb.1FBOColorStencilBuffers)
fbo(renderToRb.1FBOIterateIntFormatsStencil)
fbo(renderToRb.1FBOIterateRbSizesStencil)
fbo(renderToRb.2FBOsColorAndStencilBuffers)
fbo(renderToRb.2FBOsStencilBuffer)
fbo-multisample(advanced.blit.defaulttomsaa.colorstencil)
fbo-multisample(advanced.blit.msaatodefault.colorstencil)
fbo-multisample(advanced.blit.msaatosingle.stencil)
fbo-multisample(advanced.blit.msaattomsaa.colorstencil)
fbo-multisample(advanced.blit.singletomsaa.colorstencil)
fbo-multisample(basic.blit.msaatosingle.colorstencil)
fbo-multisample(basic.drawpixels.msaatosingle.stencil)
fboarb(advanced.rtr.intFmt)
fboarb(advanced.rtr.stencil)
fboarb(basic.blit.colorandstencil)
fboarb(basic.msaa.colorstencil)
fboarb(basic.rbcolorstencil)

Bisect shows: 52ee1a7269b84b60558760655a4c722d827703d4 is the first bad commit
commit 52ee1a7269b84b60558760655a4c722d827703d4
Author:     Eric Anholt <eric@anholt.net>
AuthorDate: Sun Nov 4 12:47:02 2012 -0800
Commit:     Eric Anholt <eric@anholt.net>
CommitDate: Mon Nov 19 15:07:22 2012 -0800

    i965: Move all the depth/stencil/hiz offset logic into the workaround.

    Given that we have the mask information here (assuming the rebase is to
    the same tiling, which is safe), we can just save a set of miptrees and
    offsets and the global intra-tile offset in the context and cut out a
    bunch of logic.  This will also save emitting the next fix I need to do
    twice.

(gdb) bt
#0  emit_depthbuffer (brw=0x61df20) at brw_misc_state.c:631
#1  0x00007ffff5332fe2 in brw_upload_state (brw=0x61df20)
    at brw_state_upload.c:500
#2  0x00007ffff53013a7 in brw_try_draw_prims (max_index=<optimized out>,
    min_index=<optimized out>, ib=0x7fffffffde38, nr_prims=6466928,
    prim=0x7fffffffde20, arrays=<optimized out>, ctx=0x61df20)
    at brw_draw.c:498
#3  brw_draw_prims (ctx=0x61df20, prim=0x7fffffffde20, nr_prims=6466928,
    ib=0x7fffffffde38, index_bounds_valid=<optimized out>, min_index=0,
    max_index=3, tfb_vertcount=0x0) at brw_draw.c:585
#4  0x00007ffff4e7efc9 in vbo_draw_arrays (ctx=0x61df20, mode=6, start=0,
    count=<optimized out>, numInstances=1, baseInstance=<optimized out>)
    at ../../../src/mesa/vbo/vbo_exec_array.c:619
#5  0x00007ffff4f02f0f in _mesa_meta_glsl_Clear (ctx=0x61df20,
    buffers=<optimized out>) at ../../../src/mesa/drivers/common/meta.c:2049
#6  0x00007ffff52f4a93 in brw_clear (mask=0, ctx=0x61df20) at brw_clear.c:251
#7  brw_clear (ctx=0x61df20, mask=<optimized out>) at brw_clear.c:220
#8  0x00007ffff7d46802 in stub_glClear (mask=17664)
    at /GFX/Test/Piglit/piglit/tests/util/generated_dispatch.c:1696
#9  0x00007ffff7acaf81 in hiz_run_test_stencil_read_common ()
    at /GFX/Test/Piglit/piglit/tests/hiz/hiz-util.c:535
#10 0x00007ffff7acb17f in hiz_run_test_stencil_read_fbo (fbo_options=0x600f10)
    at /GFX/Test/Piglit/piglit/tests/hiz/hiz-util.c:579
#11 0x0000000000400992 in piglit_display ()
    at /GFX/Test/Piglit/piglit/tests/hiz/hiz-stencil-read-fbo-d0-s8.c:68
#12 0x00007ffff7d42174 in run_test (gl_fw=0x601010, argc=1,
    argv=0x7fffffffe1a8)
    at /GFX/Test/Piglit/piglit/tests/util/piglit-framework-gl/piglit_winsys_framework.c:63
#13 0x00007ffff7d3f13a in piglit_gl_test_run (argc=1, argv=0x7fffffffe1a8,
    config=0x7fffffffe090)
    at /GFX/Test/Piglit/piglit/tests/util/piglit-framework-gl.c:127
#14 0x000000000040095e in main (argc=2, argv=0x7fffffffe1a8)
    at /GFX/Test/Piglit/piglit/tests/hiz/hiz-stencil-read-fbo-d0-s8.c:50

Reproduce steps:
----------------------------
1. xinit
2. ./bin/hiz-stencil-read-fbo-d0-s8 -auto
Comment 1 Eric Anholt 2012-11-27 02:00:28 UTC

*** This bug has been marked as a duplicate of bug 57309 ***
Comment 2 lu hua 2012-12-19 06:36:12 UTC
Verified.
Fixed by c8ed9f6262a73849a64c55bcfaac2a50e42e0945.
commit c8ed9f6262a73849a64c55bcfaac2a50e42e0945
Author: Eric Anholt 
Date: Mon Nov 26 14:46:11 2012 -0800

i965/gen4-5: Fix segfaults with stencil-only depth/stencil setups.

Fixes a ton of piglit regressions since the depthstencil fixes for gen6+.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.