Bug 20710

Summary: YoFrankie (blender open-source project) does not work on Intel GM965
Product: Mesa Reporter: Mateusz Kaduk <mateusz.kaduk>
Component: Drivers/DRI/i965Assignee: Ian Romanick <idr>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: medium CC: bgamari, brian.paul, mateusz.kaduk, sa
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 29044    
Attachments: Screenshot and error log (./yofrankie > log.txt 2>> log.txt)
Sysprof screenshot confirming fast_match() failure.
yo frankie first shader
yo frankie second shader

Description Mateusz Kaduk 2009-03-17 07:29:53 UTC
Created attachment 23965 [details]
Screenshot and error log (./yofrankie > log.txt 2>> log.txt)

Hi,

I tried http://www.yofrankie.org which is simple and nice open-source game made by artists in blender. Its using blender for animations and crystal space as engine.

I am using Xorg(master) UXA, master mesa, master xf86-intel and master libdri
also kernel is GEM enabled.

OpenGL renderer string: Mesa DRI Intel(R) 965GM GEM 20090114 
OpenGL version string: 2.1 Mesa 7.5-devel
OpenGL shading language version string: 1.20

[drm] Initialized drm 1.1.0 20060810
[drm] Initialized i915 1.6.0 20080730 on minor 0

After I pass menu and press start I wait 1-2min(slow) then every texture is white (no textures) and things are so slow that I cannot change the view or move mouse. Only esc (exit game) is possible.

I am attaching screenshot and error log from game.

For help thanks in advance
Mateusz
Comment 1 Mateusz Kaduk 2009-04-16 02:53:59 UTC
After turning off shader Options->Shaders game is slow but playable and no textures are missing and no freezes. So I blame shader compiler.
Comment 2 Mateusz Kaduk 2009-04-25 09:57:20 UTC
I did profile for this game.

1) Behavior
After 10min of black window I see health bar and black background and some tearing sound. CPU is used 70-80%

2) Profile ---> http://www.filefactory.com/file/agd1c93/n/yofrankie_sysprof_bz2
As you can see
mainly fast_match(...) followed by free_regbyte_ctx_stack uses 74% CPU cycles.

This points to
./src/mesa/shader/grammar/grammar.c:static void free_regbyte_ctx_stack (regbyte_ctx *top, regbyte_ctx *limit)
and
./src/mesa/shader/grammar/grammar.c:fast_match (dict *di, const byte *text, int *index, rule *ru, int *_PP, bytepool *_BP,

Also running GLSL disabled variant of game is slow but playable.

In conclusion GLSL fails and loops there.
Comment 3 Mateusz Kaduk 2009-05-07 07:52:46 UTC
Created attachment 25590 [details]
Sysprof screenshot confirming fast_match() failure.

I am adding this to confirm previous comment with mesa (git master) from 07.05.09 and to save some time.
Comment 4 martin 2009-07-04 03:53:18 UTC
The game YoFrankie! is not available as an Ubuntu .DEB for easy installation:
http://www.getdeb.net/download/4322/0

When I start it on 32-bit ubuntu jaunty with intel 965 the menu shows up fine but when I click PLAY it just hangs. If I break into gdb I see that the shader compiler basically never returns (the first 67 stack frames are identical to frame #68 and I do have libgl1-mesa-dri-dbg installed already so im not sure why it says "?? ()" for the function):

#68 0xb611ad4f in ?? () from /usr/lib/dri/i965_dri.so
#69 0xb611ae0f in ?? () from /usr/lib/dri/i965_dri.so
#70 0xb611b10c in ?? () from /usr/lib/dri/i965_dri.so
#71 0xb60d6445 in _slang_compile () from /usr/lib/dri/i965_dri.so
#72 0xb608c942 in ?? () from /usr/lib/dri/i965_dri.so
#73 0xb602143b in _mesa_CompileShaderARB () from /usr/lib/dri/i965_dri.so
#74 0x08235dca in GPU_shader_create ()
#75 0x08234b2c in GPU_generate_pass ()
#76 0x08232aa1 in GPU_material_from_blender ()
#77 0x0830d597 in BL_BlenderShader::BL_BlenderShader ()
#78 0x083009e7 in KX_BlenderMaterial::SetBlenderGLSLShader ()
#79 0x083031f2 in KX_BlenderMaterial::OnConstruction ()
#80 0x082ae00b in BL_ConvertMesh ()
#81 0x082aebd5 in ?? ()
#82 0x082b0006 in BL_ConvertBlenderObjects ()
#83 0x082a6153 in KX_BlenderSceneConverter::ConvertScene ()
#84 0x0813fd21 in GPG_Application::startEngine ()
#85 0x0813fe9c in GPG_Application::StartGameEngine ()
#86 0x0813dd48 in main ()

If I turn off "shaders" in options then the same starts just fine (although somewhat slow). I also suspect that intel G45 is affected as well because in bug 19029 comment #2 sven writes that "the game hangs as soon as I click play if shaders are
enabled".
Comment 5 Mateusz Kaduk 2009-07-20 02:21:13 UTC
(In reply to comment #4)
> When I start it on 32-bit ubuntu jaunty with intel 965 the menu shows up fine
> but when I click PLAY it just hangs. 

Same behaviour. Tested with mesa 7.5 and bug still present.
Running ./yofrankie-linux-x86_64.bin outputs on console many times
out of regs 116
out of regs 116
out of regs 116
out of regs 116
...

dmesg shows
too small stackpointer in 6686
too small stackpointer in 6686
too small stackpointer in 6686
...

My configuration is
00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c)
Xorg 1.6.1
mesa 7.5
xf86-video-intel 2.7.1
libdrm 2.4.11
linux 2.6.30 (kms enabled)

OpenGL renderer string: Mesa DRI Intel(R) 965GM GEM 20090712 2009Q2 RC3 
OpenGL version string: 2.1 Mesa 7.5
direct rendering: Yes
Comment 6 Sven Arvidsson 2009-07-24 16:46:39 UTC
*** Bug 19029 has been marked as a duplicate of this bug. ***
Comment 7 Mateusz Kaduk 2009-09-24 23:41:03 UTC
(In reply to comment #6)
> *** Bug 19029 has been marked as a duplicate of this bug. ***
> 

With mesa_7_6_branch "out of regs" errors are gone, but game with GLSL enabled still does not start, stops rendering and use 100% CPU. (loop ?)

Comment 8 Sven Arvidsson 2009-09-27 15:52:44 UTC
Created attachment 29910 [details]
yo frankie first shader

I'm attaching both of the two shaders the game use, in case anything immediately wrong stands out. 

(The shaders are written as python strings for the blender game engine, therefor the .py extension)
Comment 9 Sven Arvidsson 2009-09-27 15:53:17 UTC
Created attachment 29911 [details]
yo frankie second shader
Comment 10 Sven Arvidsson 2010-01-30 15:29:10 UTC
With Mesa 7.8 (git master as of  833acea8f6bcbed8b477eb1a1d897127afb0e73e) I can run Yo Frankie (with the software rasterizer) with shaders turned on, and everything looks okay.  I guess the new GLSL work in 7.8 have resolved this problem.

With the i965 driver, I'm getting a GPU hang (and reset), but I guess this is a separate  problem, and will file a new bug about this.
Comment 11 Eric Anholt 2010-10-14 12:44:33 UTC
As far as I can see, the YoFrankie problems are fixed as of:

commit a81d423d93f22a948f3aa4bf73dc6b1a3b70192f
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Oct 14 12:23:29 2010 -0700

    i965: Enable the new FS backend on pre-gen6 as well.
    
    It is now to the point where we have no regressing piglit tests.  It
    also fixes Yo Frankie! and Humus DynamicBranching, probably due to the
    piglit bias tests that work that didn't on the Mesa IR backend.
    
    As a downside, performance takes about a 5-10% performance hit at the
    moment (e.g. nexuiz 19.8fps -> 18.8fps), which I plan to resolve by
    reintroducing 16-wide fragment shaders where possible.  It is a win,
    though, for fragment shaders using flow control.

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.