Bug 4954

Summary: Crash running glmark2-es2 on i.MX6
Product: [Build System, Metadata & Runtime] BSPs Reporter: Diego <diego.ml>
Component: bsps-meta-fsl-armAssignee: Daiane <angolini>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: b07273, otavio
Version: 1.5   
Target Milestone: 1.5   
Hardware: Other   
OS: arm   
Whiteboard:
OS type for building Yocto: --- Type of Regression: New (Never tested)
Verified: Documentation change: No (bug/feature does not impact docs)

Description Diego 2013-07-30 10:58:39 UTC
glmark2-es2 crashes after running the jellyfish benchmark in a fsl-image-gui-sdk image for machine nitrogen6x. I think this issue is present on all Vivante GPU based boards.

How to reproduce:
- build a fsl-image-gui-sdk
- bitbake glmark2
- install libpng12 and glmark2 on the image
- run the test with "glmark2-es2 --fullscreen"
- get the crash after the jellyfish benchmark


Output and backtrace:

# export DISPLAY=:0
# gdb glmark2-es2
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-poky-linux-gnueabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/glmark2-es2...Reading symbols from /usr/bin/.debug/glmark2-es2...done.
done.
(gdb) run --fullscreen
Starting program: /usr/bin/glmark2-es2 --fullscreen
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
=======================================================
    glmark2 2012.12
=======================================================
    OpenGL Information
    GL_VENDOR:     Vivante Corporation
    GL_RENDERER:   GC2000 core
    GL_VERSION:    OpenGL ES 2.0
=======================================================
[build] use-vbo=false: FPS: 219 FrameTime: 4.566 ms
[build] use-vbo=true: FPS: 271 FrameTime: 3.690 ms
[texture] texture-filter=nearest: FPS: 163 FrameTime: 6.135 ms
[texture] texture-filter=linear: FPS: 148 FrameTime: 6.757 ms
[texture] texture-filter=mipmap: FPS: 173 FrameTime: 5.780 ms
[shading] shading=gouraud: FPS: 163 FrameTime: 6.135 ms
[shading] shading=blinn-phong-inf: FPS: 156 FrameTime: 6.410 ms
[shading] shading=phong: FPS: 124 FrameTime: 8.065 ms
[bump] bump-render=high-poly: FPS: 140 FrameTime: 7.143 ms
[bump] bump-render=normals: FPS: 168 FrameTime: 5.952 ms
[bump] bump-render=height: FPS: 150 FrameTime: 6.667 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 64 FrameTime: 15.625 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 27 FrameTime: 37.037 ms
[pulsar] light=false:quads=5:texture=false: FPS: 17 FrameTime: 58.824 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 5 FrameTime: 200.000 ms
[desktop] effect=shadow:windows=4: FPS: 27 FrameTime: 37.037 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 58 FrameTime: 17.241 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 49 FrameTime: 20.408 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 85 FrameTime: 11.765 ms
[ideas] speed=duration: FPS: 73 FrameTime: 13.699 ms
[jellyfish] <default>: FPS: 74 FrameTime: 13.514 ms
Error: Failed to link program created from files None and None:  
Alignment trap: glmark2-es2 (1986) PC=0x2afb5400 Instr=0xe8931001 Address=0x71a8ddeb FSR 0x001

Program received signal SIGSEGV, Segmentation fault.
_CompactHeap (Heap=<optimized out>) at gc_hal_user_heap.c:264
264     gc_hal_user_heap.c: No such file or directory.
(gdb) bt
#0  _CompactHeap (Heap=<optimized out>) at gc_hal_user_heap.c:264
#1  gcoHEAP_Allocate (Heap=0x10f028, Bytes=Bytes@entry=64, Memory=0x7effdd8c, 
    Memory@entry=0x7effdd84) at gc_hal_user_heap.c:771
#2  0x2b0485ac in gcoOS_Allocate (Os=Os@entry=0x0, Bytes=Bytes@entry=64, 
    Memory=Memory@entry=0x7effdd84) at gc_hal_user_os.c:1436
#3  0x340265bc in sloCOMPILER_Allocate (Compiler=0x33128f40, 
    Bytes=Bytes@entry=56, Memory=0x7effddbc, Memory@entry=0x7effddb4)
    at gc_glsl_compiler.c:1290
#4  0x3405b6cc in ppoTOKEN_Construct (PP=PP@entry=0x33128e20, 
    File=0x3406ab60 "gc_glsl_input_stream.c", Line=Line@entry=647, 
    MoreInfo=0x3406acd8 "ppoPREPROCESSOR_CBIS_GetToken : Creat sematic value.", Created=0x7effde00, Created@entry=0x7effddf8) at gc_glsl_token.c:114
#5  0x3405653c in ppoBYTE_INPUT_STREAM_GetToken (PP=0x33128e20, Is=0x33128e54, 
    Token=0x7effe228, WhiteSpace=0) at gc_glsl_input_stream.c:640
#6  0x34058630 in ppoPREPROCESSOR_TextLine (PP=PP@entry=0x33128e20)
    at gc_glsl_syntax.c:1449
#7  0x34059e00 in ppoPREPROCESSOR_GroupPart (PP=PP@entry=0x33128e20)
    at gc_glsl_syntax.c:473
#8  0x3405a184 in ppoPREPROCESSOR_Group (PP=PP@entry=0x33128e20)
    at gc_glsl_syntax.c:298
#9  0x3405ace4 in ppoPREPROCESSOR_PreprocessingFile (PP=PP@entry=0x33128e20)
    at gc_glsl_syntax.c:111
#10 0x34055350 in ppoPREPROCESSOR_Parse (PP=0x33128e20, PP@entry=0x2000, 
---Type <return> to continue, or q <return> to quit---
    Buffer=Buffer@entry=0x119784 "", Max=Max@entry=8190, 
    WriteInNumber=0x7effe2ec, WriteInNumber@entry=0x119784)
    at gc_glsl_preprocessor.c:1130
#11 0x34053d90 in sloPREPROCESSOR_Parse (Preprocessor=0x2000, MaxSize=8190, 
    MaxSize@entry=8192, Buffer=Buffer@entry=0x119784 "", ActualSize=0x119784, 
    ActualSize@entry=0x7effe2e4) at gc_glsl_api.c:135
#12 0x34026d84 in slInput (MaxSize=8192, Buffer=0x119784 "")
    at gc_glsl_compiler.c:1573
#13 0x34047188 in yy_get_next_buffer () at gc_glsl_scanner.c:1337
#14 0x34047a70 in sloCOMPILER_Scan (Compiler=0x34065f18 <yy_ec>, 
    Compiler@entry=0x33128f40, Token=0x33128f40, Token@entry=0x7effe3f0)
    at gc_glsl_scanner.c:1172
#15 0x34042bb4 in yylex (pyylval=pyylval@entry=0x7effe3f0, 
    Compiler=Compiler@entry=0x33128f40) at gc_glsl_parser_misc.c:39
#16 0x34052924 in yyparse (Compiler=Compiler@entry=0x33128f40)
    at gc_glsl_parser.c:1793
#17 0x34042d88 in sloCOMPILER_Parse (Compiler=Compiler@entry=0x33128f40, 
    StringCount=StringCount@entry=1, Strings=0x7efff28c, 
    Strings@entry=0x7efff584) at gc_glsl_parser_misc.c:171
#18 0x340279f0 in sloCOMPILER_Compile (Compiler=0x33128f40, 
    OptimizationOptions=OptimizationOptions@entry=65535, 
    DumpOptions=DumpOptions@entry=0, StringCount=StringCount@entry=1, 
    Strings=0x7efff28c, Strings@entry=0x7efff284, Binary=0x33129b84, 
---Type <return> to continue, or q <return> to quit---
    Binary@entry=0x10d8fc <std::string::_Rep::_S_empty_rep_storage+12>, 
    Log=0x33129b80, Log@entry=0x2ac53bac <_glshCompileShader+60>)
    at gc_glsl_compiler.c:754
#19 0x34025d74 in gcCompileShader (Hal=0x0, ShaderType=2, SourceSize=1184, 
    Source=0x2ad66f54 <typeinfo for std::ctype<char>> "`n\326*|\026\325*", 
    Binary=0x33129b84, Log=0x33129b80) at gc_glsl_entry.c:278
#20 0x2ac53bac in _glshCompileShader (Context=Context@entry=0x338bf0e8, 
    ShaderType=<optimized out>, SourceSize=1184, Source=<optimized out>, 
    Binary=Binary@entry=0x33129b84, Log=Log@entry=0x33129b80)
    at gc_glsh_compiler.c:397
#21 0x2ac622e4 in glshCompileShader (Context=0x338bf0e8, Shader=0x33129b60)
    at gc_glsh_shader.c:510
#22 0x000ecb0c in Shader::compile (this=0x7efff514, this@entry=0x7efff50c)
    at ../src/libmatrix/program.cc:71
#23 0x000ee1dc in Program::addShader (this=this@entry=0x77c9c8, 
    type=type@entry=35632, source=...) at ../src/libmatrix/program.cc:183
#24 0x000dd1f8 in Scene::load_shaders_from_strings (program=..., 
    vtx_shader=..., frg_shader=..., vtx_shader_filename=..., 
    frg_shader_filename=...) at ../src/scene.cpp:268
#25 0x000c766c in BlurRenderer::blur_program (
    create_new=create_new@entry=true, radius=radius@entry=4, 
    sigma=sigma@entry=2.70000005, 
    dir=dir@entry=BlurRenderer::BlurDirectionVertical, step=..., 
---Type <return> to continue, or q <return> to quit---
    tilt_shift=tilt_shift@entry=0.5)
    at ../src/scene-terrain/blur-renderer.cpp:61
#26 0x000c8078 in BlurRenderer::BlurRenderer (this=0x778d38, size=..., 
    radius=4, sigma=2.70000005, dir=BlurRenderer::BlurDirectionVertical, 
    step=..., tilt_shift=0.5) at ../src/scene-terrain/blur-renderer.cpp:33
#27 0x000d4e4c in SceneTerrainPrivate::init_renderers (
    this=this@entry=0x147088) at ../src/scene-terrain.cpp:118
#28 0x000d2210 in SceneTerrainPrivate (use_tilt_shift=true, use_bloom=232, 
    repeat_overlay=<synthetic pointer>, canvas=..., this=0x147088)
    at ../src/scene-terrain.cpp:51
#29 SceneTerrain::setup (this=0x12d410) at ../src/scene-terrain.cpp:277
#30 0x00011e98 in Benchmark::setup_scene (this=0x13d008)
    at ../src/benchmark.cpp:111
#31 0x00016084 in MainLoop::step (this=this@entry=0x13c410)
    at ../src/main-loop.cpp:86
#32 0x00017db0 in do_benchmark (canvas=...) at ../src/main.cpp:139
#33 0x0000d884 in main (argc=<optimized out>, argv=<optimized out>)
    at ../src/main.cpp:223
(gdb)
Comment 1 Otavio Salvador 2013-07-30 12:04:36 UTC
Diego,

is this always reproducible?
Comment 2 Diego 2013-07-30 12:34:58 UTC
(In reply to comment #1)
> is this always reproducible?

Yes, I can always reproduce it in Yocto on my Nitrogen6x, even on BSP 3.0.35-4.0.0.

By the way I don't have this crash on FSL Ubuntu BSP 3.0.35-1.1.0 and 3.0.35-4.0.0 installing the prebuilt glmark2.
Comment 3 Diego 2013-07-30 12:42:19 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > is this always reproducible?
> 
> Yes, I can always reproduce it in Yocto on my Nitrogen6x, even on BSP
> 3.0.35-4.0.0.
> 
> By the way I don't have this crash on FSL Ubuntu BSP 3.0.35-1.1.0 and
> 3.0.35-4.0.0 installing the prebuilt glmark2.

Sorry. Just though about it: prebuilt glmark2 on FSL Ubuntu is a previous version, 2012.03.
IIRC glmark2 2012.03 has less subbenchmarks than 2012.08, so it's could just be a matter of missing the benchmark that crashes the driver.
Comment 4 B07273 2013-08-09 09:36:32 UTC
Before this bug is fixed, please try this walkaround:
Modify shader file terrain-noise.frag:
@@ -29,7 +29,7 @@ vec4 taylorInvSqrt(vec4 r)

 float snoise(vec3 v)
{
-    const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);
+    const vec3 C = vec3(1.0 / 6.0, 1.0 / 3.0, 1.0);
     const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);

     // First corner
Comment 5 Diego 2013-08-16 11:20:03 UTC
(In reply to comment #4)
> Before this bug is fixed, please try this walkaround:
> Modify shader file terrain-noise.frag:
> @@ -29,7 +29,7 @@ vec4 taylorInvSqrt(vec4 r)
> 
>  float snoise(vec3 v)
> {
> -    const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);
> +    const vec3 C = vec3(1.0 / 6.0, 1.0 / 3.0, 1.0);
>      const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
> 
>      // First corner

Hi,

this modifications avoids the crash, thank you for the workaround. Now waiting for a proper fix.

Diego
Comment 6 Otavio Salvador 2013-08-23 23:23:33 UTC
An workaround is being for in 3.5.7-1.0.0-alpha.2 drivers but it does not fix the problem.
Comment 7 Otavio Salvador 2013-09-04 19:45:28 UTC
Resolved in 3.5.7-1.0.0-alpha.2 GPU release.