Bug 32240

Summary: Second Life crashes on starting ( Linux 32bit ) [ resolved ]
Product: Mesa Reporter: Piero Finizio <andabata12>
Component: glsl-compilerAssignee: Ian Romanick <idr>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: shawn.starr
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Backtrace for assertion failure.
Valgrind log

Description Piero Finizio 2010-12-08 12:19:16 UTC
The crash came  with this declaration

ir_dereference_variable @ 0x138248b0 specifies undeclared variable `gl_LightModel' @ 0x133d8148


I had this problem  from Mesa Git  request of talloc to compile  and from commit of " glsl: add missing ambient field to gl_LightModel" by Luca Barbieri.
In practice from ca 20-25 August 2010 i have to compile from mesa git  and subsequently to substitute r300g_dri.so  with a 8/16/2010 radeong_dri.so luckily saved from an old compilation; 

thus  i have finally the whole bunch of graphic settings on SL with a Ati X1700 (rv530).

In this last period  i have not crashes for gl_light ( i noticed the correction in commit mesa: Clean up header file inclusion in light.h.) but if i try to use the compiled r300_dri.so i get crash with:

2010-12-08T19:39:56Z INFO: loadShaderFile: Loading file: shaders/class2/environment/terrainF.glsl (Want class 2)

do-not-directly-run-secondlife-bin: ir.h:851: ir_call::ir_call(ir_function_signature*, exec_list*): Assertion `callee->return_type != __null' failed.
inworld.

The same happens  with stock Mesa for Fedora 13 and 14 and with different releases of SL viewer.

If i don't  set "basic shaders" in Second Life viewer configuration, i can log inworld.

So I  came back to kernel 2.6.35.9-64.fc14.i686 and with last X server and ati  driver, last libdrm from kojii and transplanted old radeong_dri.so in /usr/local/lib/dri i have a relatively good experience on Sl, but the same it is a pity because i feel that Mesa-Gallium could compete  with proprietary drivers on Second Life.
Comment 1 Aidan Thornton 2011-01-09 07:19:38 UTC
Created attachment 41803 [details]
Backtrace for assertion failure.
Comment 2 Aidan Thornton 2011-01-09 07:44:57 UTC
Yeah, same problem here with Second Life and r600c/r600g from Mesa git master. The backtrace is... interesting, because it's triggered by ir_call::clone, which presumably means this->callee->return_type must've somehow changed on us. Given the assertion in ir_call::set_callee, replacing this->callee shouldn't be able to cause this. There doesn't appear to be any code that modifies return_type for an existing ir_function_signature full stop. So I can't see how this backtrace should be possible. Also note:

(gdb) up
#4  ir_call::clone (this=0x7fffe7d9c560, mem_ctx=<value optimized out>, 
(gdb) print this->type
$1 = (const glsl_type *) 0x7fffeab4b600
(gdb) print this->callee->return_type
$2 = (const glsl_type *) 0x0
(gdb) print *this->type
$3 = {gl_type = 5126, base_type = GLSL_TYPE_FLOAT, sampler_dimensionality = 0, sampler_shadow = 0, sampler_array = 0, 
  sampler_type = 0, vector_elements = 1, matrix_columns = 1, name = 0x2b13b80 "float", length = 0, fields = {array = 0x0, 
    parameters = 0x0, structure = 0x0},
(gdb) print *this->callee
$5 = {<ir_instruction> = {<exec_node> = {next = 0x7fffd40ca2f0, prev = 0x7fffe7d83490}, _vptr.ir_instruction = 0x7fffe7b91ec0, 
    ir_type = 69, type = 0x7fffe7b91ed0}, return_type = 0x0, parameters = {head = 0x1, tail = 0x7fffe7d86ca0, 
    tail_pred = 0x0}, is_defined = 1, is_builtin = 0, body = {head = 0x0, tail = 0x21, tail_pred = 0x7fffd40ca340}, 
  _function = 0x7fffe7b91f10}
(gdb) print this->callee->_function
$6 = (ir_function *) 0x7fffe7b91f10
(gdb) print *this->callee->_function
$7 = {<ir_instruction> = {<exec_node> = {next = 0x21, prev = 0x7fffe7d9c060}, _vptr.ir_instruction = 0x0, 
    ir_type = 3825205384, type = 0x20}, name = 0xb4 <Address 0xb4 out of bounds>, signatures = {head = 0x7fffd40ca420, 
    tail = 0x7fffe7b91ff0, tail_pred = 0x0}}

Memory corruption somewhere due to a use-after-free or similar, perhaps? Sadly, the Second Life viewer can't really be run under valgrind...
Comment 3 Shawn Starr 2011-01-09 12:05:00 UTC
This isn't just 32bit, but 64bit also, adjust bug title.
Comment 4 Aidan Thornton 2011-01-15 09:18:17 UTC
Created attachment 42080 [details]
Valgrind log

Valgrind log showing the crash is caused by a use-after-free bug.
Comment 5 Piero Finizio 2011-02-01 05:10:06 UTC
With last sources from Git repository, on RV530 and Fedora 14 32 bit, it doesn't
crash but simply hangs, trying to load shaders.

2011-02-01T12:32:43Z INFO: setShaders: 
~~~~~~~~~~~~~~~~~~
 Loading Shaders:
~~~~~~~~~~~~~~~~~~
2011-02-01T12:32:43Z INFO: loadShaderFile: Loading file: shaders/class1/windlight/atmosphericsVarsV.glsl (Want class 1)

Progress or ulterior regression? ;)
Comment 6 Shawn Starr 2011-02-03 20:06:43 UTC
For me it crashes here:


2011-02-04T04:05:17Z DEBUG: createShader: SHADER FILE: environment/terrainV.glsl mShaderLevel=2
2011-02-04T04:05:17Z DEBUG: loadShaderFile: Loading shader file: environment/terrainF.glsl class 2                                                                         
2011-02-04T04:05:17Z DEBUG: loadShaderFile: Looking in /home/spstarr/Downloads/Snowglobe-x86_64-1.4.0.0/app_settings/shaders/class2/environment/terrainF.glsl              
2011-02-04T04:05:17Z INFO: loadShaderFile: Loading file: shaders/class2/environment/terrainF.glsl (Want class 2)                                                           
GLSL source for shader 25:
/**
 * @file terrainF.glsl
 *
 * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
 * $License$
 */

uniform sampler2D detail_0;
uniform sampler2D detail_1;
uniform sampler2D detail_2;
uniform sampler2D detail_3;
uniform sampler2D alpha_ramp;

vec3 atmosLighting(vec3 light);

vec3 scaleSoftClip(vec3 color);

void main()
{
        /// Note: This should duplicate the blending functionality currently used for the terrain rendering.

        /// TODO Confirm tex coords and bind them appropriately in vert shader.
        vec4 color0 = texture2D(detail_0, gl_TexCoord[0].xy);
        vec4 color1 = texture2D(detail_1, gl_TexCoord[0].xy);
        vec4 color2 = texture2D(detail_2, gl_TexCoord[0].xy);
        vec4 color3 = texture2D(detail_3, gl_TexCoord[0].xy);

        float alpha1 = texture2D(alpha_ramp, gl_TexCoord[0].zw).a;
        float alpha2 = texture2D(alpha_ramp,gl_TexCoord[1].xy).a;
        float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a;
        vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );

        /// Add WL Components
        outColor.rgb = atmosLighting(outColor.rgb * gl_Color.rgb);

        gl_FragColor = vec4(scaleSoftClip(outColor.rgb), 1.0);
}


GLSL IR for shader 25:
(
(declare (uniform ) sampler2D alpha_ramp@0xb87e630)
(declare (uniform ) sampler2D detail_3@0xb87e400)
(declare (uniform ) sampler2D detail_2@0xb87e1d0)
(declare (uniform ) sampler2D detail_1@0xb87dfc0)
(declare (uniform ) sampler2D detail_0@0x9bfed20)
(declare (in ) vec4 gl_FragCoord@0x993d2d0)
(declare (in ) bool gl_FrontFacing@0x993d460)
(declare (out ) vec4 gl_FragColor@0xc1b4c30)
(declare (out ) float gl_FragDepth@0xc1b4e00)
(declare (in ) vec4 gl_Color@0xc1b5030)
(declare (in ) vec4 gl_SecondaryColor@0xc1b5260)
(declare (in ) float gl_FogFragCoord@0xc1b5490)
(declare (uniform ) mat4 gl_ModelViewMatrix@0xc1b56c0)
(declare (uniform ) mat4 gl_ProjectionMatrix@0xab11780)
(declare (uniform ) mat4 gl_ModelViewProjectionMatrix@0xab119b0)
(declare (uniform ) mat3 gl_NormalMatrix@0xab11b80)
(declare (uniform ) mat4 gl_ModelViewMatrixInverse@0xab11db0)
(declare (uniform ) mat4 gl_ProjectionMatrixInverse@0xab12000)
(declare (uniform ) mat4 gl_ModelViewProjectionMatrixInverse@0xb2f8450)
(declare (uniform ) mat4 gl_ModelViewMatrixTranspose@0xb2f8670)
(declare (uniform ) mat4 gl_ProjectionMatrixTranspose@0xb2f88c0)
(declare (uniform ) mat4 gl_ModelViewProjectionMatrixTranspose@0xb2f8b10)
(declare (uniform ) mat4 gl_ModelViewMatrixInverseTranspose@0xb2f8d60)
(declare (uniform ) mat4 gl_ProjectionMatrixInverseTranspose@0xb2f8fb0)
(declare (uniform ) mat4 gl_ModelViewProjectionMatrixInverseTranspose@0xa7d6830)
(declare (uniform ) float gl_NormalScale@0xa7d6a60)
(declare (uniform ) gl_LightModelParameters gl_LightModel@0xa7d6c90)
(declare () int gl_MaxLights@0xa7d6ec0)
(declare () int gl_MaxClipPlanes@0xa7d71d0)
(declare () int gl_MaxTextureUnits@0x9c022b0)
(declare () int gl_MaxTextureCoords@0x9c025c0)
(declare () int gl_MaxVertexAttribs@0x9c028d0)
(declare () int gl_MaxVertexUniformComponents@0x9c02be0)
(declare () int gl_MaxVaryingFloats@0xb5d7c30)
(declare () int gl_MaxVertexTextureImageUnits@0xb5d7f40)
(declare () int gl_MaxCombinedTextureImageUnits@0xb5d8270)
(declare () int gl_MaxTextureImageUnits@0xb5d85a0)
(declare () int gl_MaxFragmentUniformComponents@0xb5d88b0)
(declare (uniform ) (array mat4 8) gl_TextureMatrix@0xcbdacf0)
(declare (uniform ) (array mat4 8) gl_TextureMatrixInverse@0xcbdaf20)
(declare (uniform ) (array mat4 8) gl_TextureMatrixTranspose@0xcbdb150)
(declare (uniform ) (array mat4 8) gl_TextureMatrixInverseTranspose@0xcbdb3a0)
(declare (uniform ) gl_DepthRangeParameters gl_DepthRange@0xcbdb5f0)
(declare (uniform ) (array vec4 6) gl_ClipPlane@0xcbdb820)
(declare (uniform ) gl_PointParameters gl_Point@0xcbdba50)
(declare (uniform ) gl_MaterialParameters gl_FrontMaterial@0xcb73360)
(declare (uniform ) gl_MaterialParameters gl_BackMaterial@0xcb73590)
(declare (uniform ) (array gl_LightSourceParameters 8) gl_LightSource@0xcb737c0)
(declare (uniform ) gl_LightModelProducts gl_FrontLightModelProduct@0xcb739f0)
(declare (uniform ) gl_LightModelProducts gl_BackLightModelProduct@0xcb73c40)
(declare (uniform ) (array gl_LightProducts 8) gl_FrontLightProduct@0xcb73e90)
(declare (uniform ) (array gl_LightProducts 8) gl_BackLightProduct@0x9a5eeb0)
(declare (uniform ) (array vec4 8) gl_TextureEnvColor@0x9a5f0e0)
(declare (uniform ) (array vec4 8) gl_EyePlaneS@0x9a5f310)
(declare (uniform ) (array vec4 8) gl_EyePlaneT@0x9a5f540)
(declare (uniform ) (array vec4 8) gl_EyePlaneR@0x9a5f770)
(declare (uniform ) (array vec4 8) gl_EyePlaneQ@0x9a5f9a0)
(declare (uniform ) (array vec4 8) gl_ObjectPlaneS@0x9a5fbd0)
(declare (uniform ) (array vec4 8) gl_ObjectPlaneT@0x9a5fe00)
(declare (uniform ) (array vec4 8) gl_ObjectPlaneR@0x9bfdf70)
(declare (uniform ) (array vec4 8) gl_ObjectPlaneQ@0x9bfe1a0)
(declare (uniform ) gl_FogParameters gl_Fog@0x9bfe3d0)
(declare (in ) (array vec4 0) gl_TexCoord@0x9bfe590)
(declare () int gl_MaxDrawBuffers@0x9bfe7c0)
(declare (out ) (array vec4 8) gl_FragData@0x9bfead0)
(function atmosLighting
  (signature vec3
    (parameters
      (declare (in ) vec3 light@0xb87e860)
    )
    (
    ))

)

(function scaleSoftClip
  (signature vec3
    (parameters
      (declare (in ) vec3 color@0xb87ec00)
    )
    (
    ))

)

(function texture2D
  (signature vec4
    (parameters
      (declare (in ) sampler2D sampler@0xb559220)
      (declare (in ) vec2 P@0xb5592d0)
    )
    (
    ))

)

(function mix
  (signature vec4
    (parameters
      (declare (in ) vec4 arg0@0x9ade560)
      (declare (in ) vec4 arg1@0x9ade610)
      (declare (in ) float arg2@0x9ade6c0)
    )
    (
    ))

)

(function main
  (signature void
    (parameters
    )
    (
      (declare () vec4 outColor@0xd684820)
      (declare () float alphaFinal@0xd6839b0)
      (declare () float alpha2@0x96edba0)
      (declare () float alpha1@0x99721b0)
      (declare () vec4 color3@0x680da80)
      (declare () vec4 color2@0x97ed6c0)
      (declare () vec4 color1@0x97ec950)
      (declare () vec4 color0@0xb558ad0)
      (declare (temporary ) vec4 texture2D_retval@0xb559490)
      (assign (constant bool (1)) (xyzw) (var_ref texture2D_retval@0xb559490)  (call texture2D ((var_ref detail_0@0x9bfed20) (swiz xy (array_ref (var_ref gl_TexCoord@0x9bfe590) (constant int (0)) ) )))
) 
      (assign (constant bool (1)) (xyzw) (var_ref color0@0xb558ad0)  (var_ref texture2D_retval@0xb559490) ) 
      (declare (temporary ) vec4 texture2D_retval@0x97ecec0)
      (assign (constant bool (1)) (xyzw) (var_ref texture2D_retval@0x97ecec0)  (call texture2D ((var_ref detail_1@0xb87dfc0) (swiz xy (array_ref (var_ref gl_TexCoord@0x9bfe590) (constant int (0)) ) )))
) 
      (assign (constant bool (1)) (xyzw) (var_ref color1@0x97ec950)  (var_ref texture2D_retval@0x97ecec0) ) 
      (declare (temporary ) vec4 texture2D_retval@0x680d280)
      (assign (constant bool (1)) (xyzw) (var_ref texture2D_retval@0x680d280)  (call texture2D ((var_ref detail_2@0xb87e1d0) (swiz xy (array_ref (var_ref gl_TexCoord@0x9bfe590) (constant int (0)) ) )))
) 
      (assign (constant bool (1)) (xyzw) (var_ref color2@0x97ed6c0)  (var_ref texture2D_retval@0x680d280) ) 
      (declare (temporary ) vec4 texture2D_retval@0x99719b0)
      (assign (constant bool (1)) (xyzw) (var_ref texture2D_retval@0x99719b0)  (call texture2D ((var_ref detail_3@0xb87e400) (swiz xy (array_ref (var_ref gl_TexCoord@0x9bfe590) (constant int (0)) ) )))
) 
      (assign (constant bool (1)) (xyzw) (var_ref color3@0x680da80)  (var_ref texture2D_retval@0x99719b0) ) 
      (declare (temporary ) vec4 texture2D_retval@0x9972720)
      (assign (constant bool (1)) (xyzw) (var_ref texture2D_retval@0x9972720)  (call texture2D ((var_ref alpha_ramp@0xb87e630) (swiz zw (array_ref (var_ref gl_TexCoord@0x9bfe590) (constant int (0)) ) )))
) 
      (assign (constant bool (1)) (x) (var_ref alpha1@0x99721b0)  (swiz w (var_ref texture2D_retval@0x9972720) )) 
      (declare (temporary ) vec4 texture2D_retval@0x96ee110)
      (assign (constant bool (1)) (xyzw) (var_ref texture2D_retval@0x96ee110)  (call texture2D ((var_ref alpha_ramp@0xb87e630) (swiz xy (array_ref (var_ref gl_TexCoord@0x9bfe590) (constant int (1)) ) )))
) 
      (assign (constant bool (1)) (x) (var_ref alpha2@0x96edba0)  (swiz w (var_ref texture2D_retval@0x96ee110) )) 
      (declare (temporary ) vec4 texture2D_retval@0xd683f90)
      (assign (constant bool (1)) (xyzw) (var_ref texture2D_retval@0xd683f90)  (call texture2D ((var_ref alpha_ramp@0xb87e630) (swiz zw (array_ref (var_ref gl_TexCoord@0x9bfe590) (constant int (1)) ) )))
) 
      (assign (constant bool (1)) (x) (var_ref alphaFinal@0xd6839b0)  (swiz w (var_ref texture2D_retval@0xd683f90) )) 
      (declare (temporary ) vec4 mix_retval@0x9ade880)
      (assign (constant bool (1)) (xyzw) (var_ref mix_retval@0x9ade880)  (call mix ((var_ref color3@0x680da80) (var_ref color2@0x97ed6c0) (var_ref alpha2@0x96edba0) ))
) 
      (declare (temporary ) vec4 mix_retval@0x9adee20)
      (assign (constant bool (1)) (xyzw) (var_ref mix_retval@0x9adee20)  (call mix ((var_ref color1@0x97ec950) (var_ref color0@0xb558ad0) (var_ref alpha1@0x99721b0) ))
) 
      (declare (temporary ) vec4 mix_retval@0xd1d03c0)
      (assign (constant bool (1)) (xyzw) (var_ref mix_retval@0xd1d03c0)  (call mix ((var_ref mix_retval@0x9ade880) (var_ref mix_retval@0x9adee20) (var_ref alphaFinal@0xd6839b0) ))
) 
      (assign (constant bool (1)) (xyzw) (var_ref outColor@0xd684820)  (var_ref mix_retval@0xd1d03c0) ) 
      (declare (temporary ) vec3 atmosLighting_retval@0xd1d10e0)
      (assign (constant bool (1)) (xyz) (var_ref atmosLighting_retval@0xd1d10e0)  (call atmosLighting ((expression vec3 * (swiz xyz (var_ref mix_retval@0xd1d03c0) )(swiz xyz (var_ref gl_Color@0xc1b5030) )) ))
) 
      (assign (constant bool (1)) (xyz) (var_ref outColor@0xd684820)  (var_ref atmosLighting_retval@0xd1d10e0) ) 
      (declare (temporary ) vec3 scaleSoftClip_retval@0xcf4b320)
      (assign (constant bool (1)) (xyz) (var_ref scaleSoftClip_retval@0xcf4b320)  (call scaleSoftClip ((swiz xyz (var_ref outColor@0xd684820) )))
) 
      (declare (temporary ) vec4 vec_ctor@0xcf4b6e0)
      (assign (constant bool (1)) (w) (var_ref vec_ctor@0xcf4b6e0)  (constant float (1.000000)) ) 
      (assign (constant bool (1)) (xyz) (var_ref vec_ctor@0xcf4b6e0)  (var_ref scaleSoftClip_retval@0xcf4b320) ) 
      (assign (constant bool (1)) (xyzw) (var_ref gl_FragColor@0xc1b4c30)  (var_ref vec_ctor@0xcf4b6e0) ) 
    ))

)


)

2011-02-04T04:05:17Z DEBUG: createShader: SHADER FILE: environment/terrainF.glsl mShaderLevel=2
2011-02-04T04:05:17Z INFO: do_basic_glibc_backtrace: Opening stack trace file /home/spstarr/.secondlife/logs/stack_trace.log                                               
2011-02-04T04:05:17Z INFO: handleViewerCrash: Handle viewer crash entry.
2011-02-04T04:05:17Z INFO: print:  ************* PRINT OUT LL CALL STACKS *************
Comment 7 Shawn Starr 2011-02-03 20:07:40 UTC
I am using 2.6.38-rc3 kernel from rawhide, latest mesa in rawhide.
Comment 8 Piero Finizio 2011-03-09 03:04:37 UTC
...and it finally works.:)

FPS are near to the proprietary drivers performance  and well satured colours too.
Dear developers thanks for your efforts.

  
Software:
OS: 32bit,Fedora release 14 (Laughlin), Kernel: 2.6.38-0.rc7.git4.1.fc15.i686 (i686), Desktop: KDE 4.5.5, Display Server: X Server 1.9.4, Display Driver: radeon 6.14.99, OpenGL: 2.1 Mesa 7.11-devel Gallium 0.4, Compiler: GCC 4.5.1.
Comment 9 Piero Finizio 2011-03-09 05:43:28 UTC
Errata Corrige: "well *saturated* colours".

Graphics: AMD Mobility Radeon X1700 (RV530), r300 driver, sources from Mesa git repository  09/03/2011 h.10.30 (EU)

I have changed the title waiting the  confirmation from 64bit users to close the bug.
Comment 10 Shawn Starr 2011-03-22 10:03:11 UTC
(In reply to comment #9)
> Errata Corrige: "well *saturated* colours".
> 
> Graphics: AMD Mobility Radeon X1700 (RV530), r300 driver, sources from Mesa git
> repository  09/03/2011 h.10.30 (EU)
> 
> I have changed the title waiting the  confirmation from 64bit users to close
> the bug.

I will test this this evening and confirm on 64bit
Comment 11 Ian Romanick 2011-04-08 20:31:03 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > Errata Corrige: "well *saturated* colours".
> > 
> > Graphics: AMD Mobility Radeon X1700 (RV530), r300 driver, sources from Mesa git
> > repository  09/03/2011 h.10.30 (EU)
> > 
> > I have changed the title waiting the  confirmation from 64bit users to close
> > the bug.
> 
> I will test this this evening and confirm on 64bit

Any updates?  It's been a couple weeks.
Comment 12 Piero Finizio 2011-04-14 01:21:58 UTC
I filed this bug for Linux 32bit and it has been resolved  more than 2 weeks ago.
I was waiting  the report from users with Linux 64bit to close it, but this confirmation lacks rapidity.
We cannot mantain opened the thread for undefined time so i modified the heading and  closed it.

  All Gods were immortal.
                -- Stanislaw J. Lem, "Unkempt Thoughts"

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.