We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1120 - segfault with ATI fglrx driver
Summary: segfault with ATI fglrx driver
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-13 00:20 UTC by Ozkan Sezer
Modified: 2011-02-13 01:32 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ozkan Sezer 2011-02-13 00:20:13 UTC
Run into this while testing SDL1.3 with hexen2 (uhexen2.sf.net). Running the opengl version of the game works (with *many* other problems such as gamma not working, mouse grab not working, fulscreen/windowed toggling problematic...), however it segfaults upon quit:

#0  0x04c29b64 in pthread_key_create () at pthread_key_create.c:29
#1  0x09809698 in ?? ()
#2  0x03e0000b in pthread_key_create () at pthread_key_create.c:29
#3  0x09927740 in ?? ()
#4  0x04c35845 in ?? () from /usr/lib/dri/fglrx_dri.so
#5  0x0974ce50 in ?? ()
#6  0x03e0000b in pthread_key_create () at pthread_key_create.c:29
#7  0x00000000 in ?? ()

This is on fedora9 (yeah, I know, old) with ATI fglrx driver 9.3 as shipped by rpmfusion.  This doesn't happen with SDL-1.2.
Comment 1 Ozkan Sezer 2011-02-13 00:24:16 UTC
Forgot to note that uhexen2 source is for SDL-1.2 and is using the compatibility functions of SDL1.3.
Comment 2 Sam Lantinga 2011-02-13 00:29:20 UTC
Does adding an early return at the beginning of SDL_GL_UnloadLibrary() fix it?
Comment 3 Ozkan Sezer 2011-02-13 00:45:35 UTC
I did this in SDL_video.c (hopefully I understood you correctly):

--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1976,6 +1976,7 @@
         SDL_UninitializedVideo();
         return;
     }
+/******/return;
     if (_this->gl_config.driver_loaded > 0) {
         if (--_this->gl_config.driver_loaded > 0) {
             return;

... but it didn't help.  BTW, it segs too if I try changing the resolution from within the game (which does unload and reload the ogl library among other things) so you are probably on the right track..
Comment 4 Sam Lantinga 2011-02-13 00:59:47 UTC
Can you reproduce this with test/testgl from the SDL source archive?  I installed the current fglrx driver on Ubuntu 10.04 a few days ago and haven't had any problems.

If you can't reproduce it, can you put up a link to everything I need to build and run so I can try getting your exact situation here?

Thanks!
Comment 5 Ozkan Sezer 2011-02-13 01:05:41 UTC
There you go:

$ gdb ./testgl
GNU gdb Fedora (6.8-24.fc9)
Copyright (C) 2008 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 "i386-redhat-linux-gnu"...
Breakpoint 1 at 0x804a7f4: file testgl.c, line 703.
(gdb) r
Starting program: /home/ozzie/Download/SDL-1.3/test/testgl 
[Thread debugging using libthread_db enabled]
[New Thread 0xb8099a10 (LWP 14629)]

Breakpoint 1, main (argc=1, argv=0xbf826a84) at testgl.c:703
703	{
Missing separate debuginfos, use: debuginfo-install gcc.i386 libX11.i386 libXau.i386 libXdmcp.i386 libXext.i386 libxcb.i386
(gdb) c
Continuing.
Screen BPP: 16

Vendor     : ATI Technologies Inc.
Renderer   : ATI Radeon HD 3600 Series
Version    : 2.1.8543 Release
Extensions : GL_AMDX_vertex_shader_tessellator GL_AMD_performance_monitor GL_ARB_color_buffer_float GL_ARB_depth_buffer_float GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_draw_instanced GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_instanced_arrays GL_ARB_map_buffer_range GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_shader_objects GL_ARB_shader_texture_lod GL_ARB_shading_language_100 GL_ARB_shadow GL_ARB_shadow_ambient GL_ARB_texture_border_clamp GL_ARB_texture_buffer_object GL_ARB_texture_compression GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_mirrored_repeat GL_ARB_texture_non_power_of_two GL_ARB_texture_rectangle GL_ARB_texture_rg GL_ARB_transpose_matrix GL_ARB_vertex_array_object GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_envmap_bumpmap GL_ATI_fragment_shader GL_ATI_meminfo GL_ATI_separate_stencil GL_ATI_texture_compression_3dc GL_ATI_texture_env_combine3 GL_ATI_texture_float GL_EXT_abgr GL_EXT_bgra GL_EXT_bindable_uniform GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_copy_texture GL_EXT_draw_buffers2 GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_packed_pixels GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_EXT_subtexture GL_EXT_texgen_reflection GL_EXT_texture3D GL_EXT_texture_array GL_EXT_texture_buffer_object GL_EXT_texture_compression_latc GL_EXT_texture_compression_rgtc GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_integer GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_texture_shared_exponent GL_EXT_texture_swizzle GL_EXT_transform_feedback GL_EXT_vertex_array GL_KTX_buffer_region GL_NV_blend_square GL_NV_conditional_render GL_NV_copy_depth_to_color GL_NV_texgen_reflection GL_SGIS_generate_mipmap GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_WIN_swap_hint WGL_EXT_swap_control

SDL_GL_RED_SIZE: requested 5, got 8
SDL_GL_GREEN_SIZE: requested 5, got 8
SDL_GL_BLUE_SIZE: requested 5, got 8
SDL_GL_DEPTH_SIZE: requested 16, got 24
SDL_GL_DOUBLEBUFFER: requested 1, got 1
app gained input focus
key 'Q' pressed
key 'Escape' pressed
1676.34 FPS

Program received signal SIGSEGV, Segmentation fault.
0x01e5fb64 in pthread_key_create () at pthread_key_create.c:29
29	{
Missing separate debuginfos, use: debuginfo-install libXScrnSaver.i386 libXi.i386 libXinerama.i386 libXrandr.i386 libXrender.i386 xorg-x11-drv-fglrx.i386
(gdb) bt
#0  0x01e5fb64 in pthread_key_create () at pthread_key_create.c:29
#1  0x0a27cd80 in ?? ()
#2  0x03e00008 in ?? ()
#3  0x0a02ead8 in ?? ()
#4  0x01e6b845 in ?? () from /usr/lib/dri/fglrx_dri.so
#5  0x0a03a378 in ?? ()
#6  0x03e00008 in ?? ()
#7  0x00000000 in ?? ()
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
SDL_VideoQuit () at src/video/SDL_video.c:1891
1891	        for (j = display->num_display_modes; j--;) {
(gdb) bt
#0  SDL_VideoQuit () at src/video/SDL_video.c:1891
#1  0x008f92b5 in SDL_QuitSubSystem (flags=65535) at src/SDL.c:192
#2  0x008f933e in SDL_Quit () at src/SDL.c:214
#3  0x008fbe2f in SDL_Parachute (sig=11) at src/SDL_fatal.c:42
#4  <signal handler called>
#5  0x01e5fb64 in pthread_key_create () at pthread_key_create.c:29
#6  0x0a27cd80 in ?? ()
#7  0x03e00008 in ?? ()
#8  0x0a02ead8 in ?? ()
#9  0x01e6b845 in ?? () from /usr/lib/dri/fglrx_dri.so
#10 0x0a03a378 in ?? ()
#11 0x03e00008 in ?? ()
#12 0x00000000 in ?? ()
(gdb) c
Continuing.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) q
Comment 6 Sam Lantinga 2011-02-13 01:07:55 UTC
Do you have the problem if you update the fglrx driver to the latest version?
Comment 7 Ozkan Sezer 2011-02-13 01:27:20 UTC
Hmm, cannot update driver at the moment.  However, I did try testgl on another machine with fedora10-x86_64 OS and ATI catalyst driver 9.10 installed and it didn't segfault which _might_ point to a problem in the older driver.  OTOH, seeing no problems at all when using SDL-1.2 makes me wonder...
Comment 8 Sam Lantinga 2011-02-13 01:32:17 UTC
I'm pretty sure this is a problem with the older driver, which SDL 1.3 is tickling because of it's newer feature support.

Please reopen this bug if you're able to reproduce it with updated drivers.

Thanks!