Bug 54057

Summary: r300g: opengl apps crash at run - possible build problem
Product: Mesa Reporter: Tomasz P. <son_of_the_osiris>
Component: Drivers/Gallium/r300Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED NOTABUG QA Contact:
Severity: critical    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: xorg.log

Description Tomasz P. 2012-08-25 16:39:59 UTC
Created attachment 66111 [details]
xorg.log

Hardware : radeon 9600 agp
using mesa-git xorg-server-git pixman-git xf86-video-ati-git
From few days I segfault when I run opengl app.
here is what valgrind says when run glxgears:

Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
==16783== Warning: set address range perms: large range [0x394c9040, 0x594c9040) (undefined)
==16783== Invalid write of size 8
==16783==    at 0x7D5DF2A: memory_pool_malloc (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D5824D: rc_alloc_instruction (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D6C1DF: ??? (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D6CD8B: rc_emulate_loops (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D56E9D: rc_run_compiler_passes (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D56F46: rc_run_compiler (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D675AF: r3xx_compile_fragment_program (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D5E6D9: ??? (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D5F7E6: r300_pick_fragment_shader (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D51AF7: r300_update_derived_state (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D489B9: ??? (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7F7EE9A: ??? (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==16783== 
==16783== 
==16783== Process terminating with default action of signal 11 (SIGSEGV)
==16783==  Access not within mapped region at address 0x0
==16783==    at 0x7D5DF2A: memory_pool_malloc (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D5824D: rc_alloc_instruction (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D6C1DF: ??? (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D6CD8B: rc_emulate_loops (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D56E9D: rc_run_compiler_passes (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D56F46: rc_run_compiler (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D675AF: r3xx_compile_fragment_program (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D5E6D9: ??? (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D5F7E6: r300_pick_fragment_shader (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D51AF7: r300_update_derived_state (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7D489B9: ??? (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==    by 0x7F7EE9A: ??? (in /usr/lib/xorg/modules/dri/r300_dri.so)
==16783==  If you believe this happened as a result of a stack
==16783==  overflow in your program's main thread (unlikely but
==16783==  possible), you can try to increase the size of the
==16783==  main thread stack using the --main-stacksize= flag.
==16783==  The main thread stack size used in this run was 8388608.
==16783== 
==16783== HEAP SUMMARY:
==16783==     in use at exit: 1,075,765,942 bytes in 2,709 blocks
==16783==   total heap usage: 16,262 allocs, 13,553 frees, 1,078,507,740 bytes allocated
==16783== 
==16783== LEAK SUMMARY:
==16783==    definitely lost: 1,136 bytes in 2 blocks
==16783==    indirectly lost: 144 bytes in 2 blocks
==16783==      possibly lost: 76,237 bytes in 1,069 blocks
==16783==    still reachable: 1,075,688,425 bytes in 1,636 blocks
==16783==         suppressed: 0 bytes in 0 blocks
==16783== Rerun with --leak-check=full to see details of leaked memory
==16783== 
==16783== For counts of detected and suppressed errors, rerun with: -v
==16783== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)
Memory protection fault

aslo I add my xorg.log
Comment 1 Tomasz P. 2012-08-25 17:11:36 UTC
opera with HW enabled crash:

TGSI asm error: Expected `}' [13 : 51] 

TGSI asm error: Syntax error [13 : 51] 

TGSI asm error: Expected `}' [13 : 51] 

TGSI asm error: Syntax error [13 : 51] 
opera [crash logging]: CRASH!!
Comment 2 Tomasz P. 2012-08-25 17:12:25 UTC
kwin logs:

TGSI asm error: Expected `}' [13 : 51] 

TGSI asm error: Syntax error [13 : 51] 

TGSI asm error: Expected `}' [13 : 51] 

TGSI asm error: Syntax error [13 : 51] 
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_QUERY_COUNTER_BITS)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_VERTEX_UNITS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PALETTE_MATRICES_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_COLOR_MATRIX_STACK_DEPTH)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_ENV_PARAMETERS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_INSTRUCTIONS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_TEMPORARIES_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_PARAMETERS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_ATTRIBS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_ENV_PARAMETERS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_INSTRUCTIONS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_TEMPORARIES_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_PARAMETERS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_ATTRIBS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB)
Mesa: User error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB)
Comment 3 Tomasz P. 2012-08-25 17:15:10 UTC
gwenview with opengl animation on, the log was very long but I spotted this:

TTGSI asm error: Expected `}' [13 : 51] 

TGSI asm error: Syntax error [13 : 51] 

TGSI asm error: Expected `}' [13 : 51] 

TGSI asm error: Syntax error [13 : 51] 
Mesa: User error: GL_INVALID_ENUM in glGetBooleanv(pname=GL_FRAMEBUFFER_SRGB_CAPABLE_EXT)

hope this help to resolve...
Comment 4 Andy Furniss 2012-08-27 14:20:43 UTC
(In reply to comment #0)
> Created attachment 66111 [details]
> xorg.log
> 
> Hardware : radeon 9600 agp
> using mesa-git xorg-server-git pixman-git xf86-video-ati-git
> From few days I segfault when I run opengl app.

I have a box with a 9600 agp in so tested, but I am pure 32bit and using llvm 3.0.

Current ddx and mesa git worked Ok with Xorg git from June.

I built current Xorg git Today and haven't managed to get dri to work at all yet.

I don't segfault because I get permission denied when trying to run anything.

bash-3.2$ LIBGL_DEBUG=verbose glxinfo >/dev/null
libGL: OpenDriver: trying /home/andy/Src/Xorg-git/modular/lib/dri/r300_dri.so
libGL error: failed to open drm device: Permission denied
libGL error: failed to load driver: r300
libGL: OpenDriver: trying /home/andy/Src/Xorg-git/modular/lib/dri/swrast_dri.so

My xorg log looks like AIGLX has loaded r300 OK, but I can't run anything indirect either -
bash-3.2$ LIBGL_ALWAYS_INDIRECT=1 LIBGL_DEBUG=verbose glxinfo >/dev/null
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Serial number of failed request:  17
  Current serial number in output stream:  18

I may be seeing something totally different from you (what do you get with those commands)?
Comment 5 Tomasz P. 2012-08-27 14:46:12 UTC
here what I have got:
[root@fdgfdgd ~]# LIBGL_DEBUG=verbose glxinfo >/dev/null
libGL: OpenDriver: trying /usr/lib/xorg/modules/dri/tls/r300_dri.so
libGL: OpenDriver: trying /usr/lib/xorg/modules/dri/r300_dri.so
r300: DRM version: 2.17.0, Name: ATI RV350, ID: 0x4150, GB: 1, Z: 1
r300: GART size: 125 MB, VRAM size: 128 MB
r300: AA compression RAM: YES, Z compression RAM: YES, HiZ RAM: NO
r300: DRM version: 2.17.0, Name: ATI RV350, ID: 0x4150, GB: 1, Z: 1
r300: GART size: 125 MB, VRAM size: 128 MB
r300: AA compression RAM: YES, Z compression RAM: YES, HiZ RAM: NO
[root@fdgfdgd ~]# LIBGL_ALWAYS_INDIRECT=1 LIBGL_DEBUG=verbose glxinfo >/dev/null
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Serial number of failed request:  15
  Current serial number in output stream:  18
[root@tomek-pc ~]#
Comment 6 Andy Furniss 2012-08-27 15:44:42 UTC
(In reply to comment #5)
> here what I have got:
> [root@fdgfdgd ~]# LIBGL_DEBUG=verbose glxinfo >/dev/null
> libGL: OpenDriver: trying /usr/lib/xorg/modules/dri/tls/r300_dri.so
> libGL: OpenDriver: trying /usr/lib/xorg/modules/dri/r300_dri.so
> r300: DRM version: 2.17.0, Name: ATI RV350, ID: 0x4150, GB: 1, Z: 1
> r300: GART size: 125 MB, VRAM size: 128 MB
> r300: AA compression RAM: YES, Z compression RAM: YES, HiZ RAM: NO
> r300: DRM version: 2.17.0, Name: ATI RV350, ID: 0x4150, GB: 1, Z: 1
> r300: GART size: 125 MB, VRAM size: 128 MB
> r300: AA compression RAM: YES, Z compression RAM: YES, HiZ RAM: NO

Running as root is cheating :-)

But I can get round my permission problem by doing it.

It seems to be working OK for me - no faults and valgrind is silent when running glxgears (claims 552 bytes lost on quit).

Maybe it is different llvm or 64 bit that is getting you, I also have more VRAM/GART - I am not a dev so don't have a clue really.


> [root@fdgfdgd ~]# LIBGL_ALWAYS_INDIRECT=1 LIBGL_DEBUG=verbose glxinfo
> >/dev/null
> X Error of failed request:  BadAlloc (insufficient resources for operation)
>   Major opcode of failed request:  153 (GLX)
>   Minor opcode of failed request:  3 (X_GLXCreateContext)
>   Serial number of failed request:  15
>   Current serial number in output stream:  18
> [root@tomek-pc ~]#

I don't know if this worked before on my r300 box as I don't normally test.

It works OK on my r600 box with Xorg from Feb + current ddx/mesa.
Comment 7 Tom Stellard 2012-08-28 01:05:04 UTC
I can confirm that glxgears quickly uses all the system memory even with a clean clone from git on my RC410 laptop.  The shaders it is trying to compile for glxgears look very strange and they have loops, which is not normal.  My desktop machine with an RV515 is fine.  I think that maybe there are some stale libraries on my laptop that Mesa is linking against.
Comment 8 Tom Stellard 2012-08-28 03:07:06 UTC
The problem was that I had MLAA enabled in .drirc.  Deleting my .drirc fixes the issue.

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.