Bug 54183 - [Bisected ILK regression]many piglit/oglc/ogles2 cases Segmentation fault
Summary: [Bisected ILK regression]many piglit/oglc/ogles2 cases Segmentation fault
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: All Linux (All)
: high major
Assignee: Kenneth Graunke
QA Contact:
Depends on:
Reported: 2012-08-29 06:01 UTC by lu hua
Modified: 2012-09-06 01:45 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Description lu hua 2012-08-29 06:01:20 UTC
ystem Environment:
Arch:             x86_64
Platform:         Ironlake
Libdrm:	(master)libdrm-2.4.39-1-g7080bfdfd9b6c5f003daaef37ae9c329f2d46a6c
Mesa:	(master)971750e1cd76dabe22bf2ca83f07266837e3a2a6
Xf86_video_intel:(master)2.20.5-19-g96a921487ef00db03a12bec7b0821410d6b74c31 Libva:	(staging)43177da90529a7bd19a743634403af060e4b48a1
Kernel:	(drm-intel-next-queued) d7c3b937bdf45f0b844400b7bf6fd3ed50bac604

Bug detailed description:
Many Piglit/Oglc/Ogles2 cases Segmentation fault on Ironlake with mesa master branch. It doesn't happen on mesa 8.0 branch.

run :./bin/fbo-1d -auto
output: Segmentation fault (core dumped)

Bisect shows:9ef710575b914ddfc8e9a162d98ad554c1c217f7 is the first bad commit.
commit 9ef710575b914ddfc8e9a162d98ad554c1c217f7
Author:     Kenneth Graunke <kenneth@whitecape.org>
AuthorDate: Sun Aug 26 12:11:50 2012 -0700
Commit:     Kenneth Graunke <kenneth@whitecape.org>
CommitDate: Mon Aug 27 14:23:40 2012 -0700

    i965: Reenable the fragment shader precompile.

    Precompiling the shader at link time often allows us to avoid compiling
    it at the first use.  This moves the expensive compilation and
    optimization process to game or level load time, rather than at draw
    time, where we really can't avoid any cycles and don't want to risk
    stalling the GPU.
Comment 1 Rico Tzschichholz 2012-08-30 11:31:25 UTC
Reverting 9ef710575b914ddfc8e9a162d98ad554c1c217f7 "i965: Reenable the fragment shader precompile." fixes the problem again.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff526ceb3 in fs_visitor::calculate_urb_setup (this=this@entry=0x7ffffffbcc20) at brw_fs.cpp:982
982	brw_fs.cpp: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0  0x00007ffff526ceb3 in fs_visitor::calculate_urb_setup (this=this@entry=0x7ffffffbcc20) at brw_fs.cpp:982
#1  0x00007ffff526e620 in fs_visitor::run (this=this@entry=0x7ffffffbcc20) at brw_fs.cpp:1974
#2  0x00007ffff526e96a in brw_wm_fs_emit (brw=brw@entry=0x629310, c=c@entry=0x7ffff3332040, prog=prog@entry=0x836040)
    at brw_fs.cpp:2093
#3  0x00007ffff52502c5 in do_wm_prog (brw=0x629310, prog=0x836040, fp=0x85b880, key=<optimized out>) at brw_wm.c:305
#4  0x00007ffff526ed4c in brw_fs_precompile (ctx=0x629310, prog=0x3) at brw_fs.cpp:2207
#5  0x00007ffff5281ca8 in brw_shader_precompile (ctx=ctx@entry=0x629310, prog=prog@entry=0x836040) at brw_shader.cpp:70
#6  0x00007ffff5281fb3 in brw_link_shader (ctx=0x629310, shProg=0x836040) at brw_shader.cpp:215
#7  0x00007ffff4e54c22 in _mesa_glsl_link_shader (ctx=0x629310, prog=0x836040)
    at ../../../../../src/mesa/program/ir_to_mesa.cpp:3159
#8  0x00007ffff4e4a67d in create_new_program (key=0x7fffffffda40, ctx=<optimized out>)
    at ../../../../../src/mesa/main/ff_fragment_shader.cpp:1351
#9  _mesa_get_fixed_func_fragment_program (ctx=ctx@entry=0x629310) at ../../../../../src/mesa/main/ff_fragment_shader.cpp:1397
#10 0x00007ffff4d55a4a in update_program (ctx=0x629310) at ../../../../../src/mesa/main/state.c:153
#11 _mesa_update_state_locked (ctx=ctx@entry=0x629310) at ../../../../../src/mesa/main/state.c:557
#12 0x00007ffff4d55cc1 in _mesa_update_state (ctx=ctx@entry=0x629310) at ../../../../../src/mesa/main/state.c:588
#13 0x00007ffff4cd4128 in _mesa_Clear (mask=16640) at ../../../../../src/mesa/main/clear.c:180
#14 0x00000000004019de in ?? ()
#15 0x0000000000403176 in ?? ()
#16 0x00007ffff71a476d in __libc_start_main (main=0x402aa0, argc=1, ubp_av=0x7fffffffdf88, init=<optimized out>, 
    fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdf78) at libc-start.c:226
#17 0x00000000004017b9 in ?? ()
#18 0x00007fffffffdf78 in ?? ()
---Type <return> to continue, or q <return> to quit---
#19 0x000000000000001c in ?? ()
#20 0x0000000000000001 in ?? ()
#21 0x00007fffffffe2d0 in ?? ()
#22 0x0000000000000000 in ?? ()
Comment 2 Kenneth Graunke 2012-09-01 06:05:19 UTC
Fixed on master by:

commit 4d9abd96cc177cade79b64544096eb45bf8313a2
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Fri Aug 31 01:00:15 2012 -0700

    i965/fs: Don't use brw->fragment_program in calculate_urb_setup().
    Reading brw->fragment_program is nonsensical in compiler code: it
    contains the currently active program (if any), not the one currently
    being compiled.  Attempting to access it may either lead to crashes
    (null pointer dereference if no program is active) or wrong results.
    Fixes piglit regressions since 9ef710575b914ddfc8e9a162d98ad554c1c217f7
    on pre-Sandybridge hardware.  The actual bug was created in commit
    NOTE: This is a candidate for the 9.0 and 8.0 branches.
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54183
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Reviewed-by: Paul Berry <stereotype441@gmail.com>

I also went ahead and cherry-picked it to 9.0.  Closing this bug as fixed.
Comment 3 lu hua 2012-09-06 01:45:59 UTC
Verified. Fixed on mesa (commit 446d19c12a576e36c3da34ada01b708fcbc196c5).

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.