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 2709

Summary: SDL_GL_CreateContext crashes/hangs when trying to create a context the gfx card doesn't support.
Product: SDL Reporter: adam.e.skoglund
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: critical    
Priority: P2 CC: icculus
Version: 2.0.3   
Hardware: x86_64   
OS: Linux   

Description adam.e.skoglund 2014-08-29 15:22:03 UTC
SDL_GL_CreateContext crashes/hangs if I call:
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 4);
before the SDL_GL_CreateContext call.

My driver (on this machine) only supports 4.3.  I have no way of knowing the max version so I tried to create 4.4, should return null on error. Try 4.3 etc.
No luck. Crash instead.

Stacktrace:
0    __lll_lock_wait        135    0x7ffff707af2c   
1    _L_lock_909    /lib/x86_64-linux-gnu/libpthread.so.0        0x7ffff7076657   
2    __GI___pthread_mutex_lock        79    0x7ffff7076480   
3    ??    /usr/lib/x86_64-linux-gnu/libX11.so.6        0x7ffff5518973   
4    ??    /usr/lib/fglrx/libGL.so.1        0x7ffff6585e96   
5    ??    /usr/lib/fglrx/dri/fglrx_dri.so        0x7fffef9f1ede   
6    ??    /usr/lib/fglrx/libGL.so.1        0x7ffff6559b02   
7    glXDestroyContext    /usr/lib/fglrx/libGL.so.1        0x7ffff6559d0c   
8    X11_GL_CreateContext    SDL_x11opengl.c    667    0x1107d9b   
9    SDL_GL_CreateContext_REAL    SDL_video.c    2893    0x107b11c   
10    bitsquid::gl::new_context    gl_platform_linux.cpp    217    0xcb684c   


                    } else {
                        context =
                            glXCreateContextAttribs(display,
                                                    framebuffer_config[0],
                                                    share_context, True, attribs);
this line ------>                        _this->gl_data->glXDestroyContext(display,
                                                          temp_context);
                    }
                }

AMD 5770 card. Ubuntu 14.04  64 bit.
Comment 1 Ryan C. Gordon 2015-02-19 06:15:08 UTC
This is a known bug in AMD's OpenGL drivers. We've just made some fixes to SDL that might mitigate this, but it's definitely AMD's bug.

--ryan.