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 1495 - SDL-2.0: Cannot create window
Summary: SDL-2.0: Cannot create window
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 Linux
: P2 blocker
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-12 15:03 UTC by Gerry Reno
Modified: 2015-04-08 02:54 UTC (History)
4 users (show)

See Also:


Attachments
glxinfo output (23.49 KB, text/plain)
2012-05-14 07:30 UTC, Gerry Reno
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gerry Reno 2012-05-12 15:03:23 UTC
On a linux machine with Mesa 7.11 installed I just did a fresh checkout of SDL-2.0 from HG.

Ran autogen.sh, configure, and make, sudo make install

I go into tests and do the same.

When I try to run the tests I'm getting this:

$ ./testgles
Couldn't create window:



So just for a quick check I fire up glx gears and it runs fine.


I go and check some of my other gles programs and they're getting the same error. 


Ran some tests:

Installed the mesa-demos and they all run ok.


So then I tried one of the SDL tests and specifically requested various renderers:


$ LD_PRELOAD=/usr/lib/libGLESv2.so ./testdraw2 --renderer software
156.54 frames per second
$ LD_PRELOAD=/usr/lib/libGLESv2.so ./testdraw2 --renderer opengl
Couldn't create renderer:
$ LD_PRELOAD=/usr/lib/libGLESv2.so ./testdraw2 --renderer opengles
Couldn't create renderer:
$ LD_PRELOAD=/usr/lib/libGLESv2.so ./testdraw2 --renderer opengles2
Couldn't create renderer:


So then I check glxinfo to make sure that the driver wasn't the software rasterizer:

$ glxinfo | grep -i renderer
OpenGL renderer string: Gallium 0.4 on NV36


SDL-2.0 cannot create an OpenGL renderer on Linux using Mesa.

.
Comment 1 Gerry Reno 2012-05-12 15:18:44 UTC
-bash-4.2# uname -s -r
Linux 3.3.2-6.fc16.i686.PAE

-bash-4.2# yum list installed '*mesa*'

Installed Packages
mesa-demos.i686                                                 7.10-5.20101028.fc16                                        @fedora 
mesa-dri-drivers.i686                                           7.11.2-3.fc16                                               @updates
mesa-dri-filesystem.i686                                        7.11.2-3.fc16                                               @updates
mesa-libEGL.i686                                                7.11.2-3.fc16                                               @updates
mesa-libEGL-devel.i686                                          7.11.2-3.fc16                                               @updates
mesa-libGL.i686                                                 7.11.2-3.fc16                                               @updates
mesa-libGL-devel.i686                                           7.11.2-3.fc16                                               @updates
mesa-libGLES.i686                                               7.11.2-3.fc16                                               @updates
mesa-libGLES-devel.i686                                         7.11.2-3.fc16                                               @updates
mesa-libGLU.i686                                                7.11.2-3.fc16                                               @updates
mesa-libGLU-devel.i686                                          7.11.2-3.fc16                                               @updates
-bash-4.2#
Comment 2 Gerry Reno 2012-05-14 07:29:14 UTC
Checking the Mesa installation:

# ls -l /usr/lib/libGL* /usr/lib/dri/
lrwxrwxrwx  1 root root     17 Apr 30 23:10 /usr/lib/libGLESv1_CM.so -> libGLESv1_CM.so.1
lrwxrwxrwx  1 root root     21 Apr 30 23:10 /usr/lib/libGLESv1_CM.so.1 -> libGLESv1_CM.so.1.1.0
-rwxr-xr-x  1 root root  42224 Feb 13 13:47 /usr/lib/libGLESv1_CM.so.1.1.0
lrwxrwxrwx  1 root root     14 Apr 30 23:10 /usr/lib/libGLESv2.so -> libGLESv2.so.2
lrwxrwxrwx  1 root root     18 Apr 30 23:10 /usr/lib/libGLESv2.so.2 -> libGLESv2.so.2.0.0
-rwxr-xr-x  1 root root  29936 Feb 13 13:47 /usr/lib/libGLESv2.so.2.0.0
lrwxrwxrwx. 1 root root     16 Mar 18 16:12 /usr/lib/libGLEW.so.1.6 -> libGLEW.so.1.6.0
-rwxr-xr-x  1 root root 353652 Jun 20  2011 /usr/lib/libGLEW.so.1.6.0
lrwxrwxrwx  1 root root     10 Mar 25 14:08 /usr/lib/libGL.so -> libGL.so.1
lrwxrwxrwx. 1 root root     12 Mar 18 16:12 /usr/lib/libGL.so.1 -> libGL.so.1.2
-rwxr-xr-x  1 root root 554568 Feb 13 13:47 /usr/lib/libGL.so.1.2
lrwxrwxrwx  1 root root     11 Mar 25 14:08 /usr/lib/libGLU.so -> libGLU.so.1
lrwxrwxrwx. 1 root root     20 Mar 18 16:12 /usr/lib/libGLU.so.1 -> libGLU.so.1.3.071100
-rwxr-xr-x  1 root root 480324 Feb 13 13:47 /usr/lib/libGLU.so.1.3.071100

/usr/lib/dri/:
total 34976
-rwxr-xr-x  1 root root   17748 Jan  4 16:36 dummy_drv_video.so
-rwxr-xr-x. 1 root root 3804896 Feb 13 13:47 i915_dri.so
-rwxr-xr-x. 1 root root 4083136 Feb 13 13:47 i965_dri.so
-rwxr-xr-x. 1 root root 4379488 Feb 13 13:47 nouveau_dri.so
-rwxr-xr-x. 1 root root 3538536 Feb 13 13:47 nouveau_vieux_dri.so
-rwxr-xr-x. 1 root root 3785664 Feb 13 13:47 r200_dri.so
-rwxr-xr-x. 1 root root 4173312 Feb 13 13:47 r300_dri.so
-rwxr-xr-x. 1 root root 4077116 Feb 13 13:47 r600_dri.so
-rwxr-xr-x. 1 root root 3754784 Feb 13 13:47 radeon_dri.so
-rwxr-xr-x. 1 root root 4184672 Feb 13 13:47 swrast_dri.so


Mesa was built with DRI/accelerated hardware support.

Attaching glxinfo output.

.
Comment 3 Gerry Reno 2012-05-14 07:30:40 UTC
Created attachment 858 [details]
glxinfo output
Comment 4 Gerry Reno 2012-05-14 12:34:04 UTC
$ glxinfo | grep vendor
server glx vendor string: SGI
client glx vendor string: Mesa Project and SGI
OpenGL vendor string: nouveau

Should the 'nouveau' driver be added in SDL_video.c?

$ hg diff src/video/SDL_video.c
---------------------------------------------------------------
diff -r 601b0e251822 src/video/SDL_video.c
--- a/src/video/SDL_video.c	Mon Apr 09 23:55:43 2012 -0400
+++ b/src/video/SDL_video.c	Mon May 14 15:24:33 2012 -0400
@@ -184,8 +184,11 @@
                 }
                 /* Add more vendors here at will... */
                 if (vendor &&
-                    (SDL_strstr(vendor, "ATI Technologies") ||
-                     SDL_strstr(vendor, "NVIDIA"))) {
+                    (
+                       SDL_strstr(vendor, "ATI Technologies")
+                    || SDL_strstr(vendor, "NVIDIA")
+                    || SDL_strstr(vendor, "nouveau")
+                    )) {
                     hasAcceleratedOpenGL = SDL_TRUE;
                 }
                 SDL_GL_DeleteContext(context);
---------------------------------------------------------------

It didn't make any difference.  Still cannot create an OpenGL window w/Mesa.

.
Comment 5 Gerry Reno 2012-05-15 08:32:00 UTC
I took a minute and tried to trace what is happening when we try to render using opengl under Mesa.

-----------------------------------------------------------------
==3752== Command: ./testdraw2 --renderer opengl
==3752== 
SDL_CreateWindow called
==3752== Syscall param ioctl(generic) points to uninitialised byte(s)
==3752==    at 0x4CEE7829: ioctl (in /lib/libc-2.14.90.so)
==3752==    by 0x42377A63: drmIoctl (in /usr/lib/libdrm.so.2.4.0)
==3752==    by 0x4237A44C: drmCommandWriteRead (in /usr/lib/libdrm.so.2.4.0)
==3752==    by 0x49B63C3: nouveau_device_get_param (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752==    by 0x49B64AE: nouveau_device_open_existing (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752==    by 0x455882C: ??? (in /usr/lib/dri/nouveau_dri.so)
==3752==    by 0x42380FF3: ??? (in /usr/lib/libdrm.so.2.4.0)
==3752==  Address 0xbeb507b8 is on thread 1's stack
==3752==  Uninitialised value was created by a stack allocation
==3752==    at 0x49B637D: nouveau_device_get_param (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752== 
==3752== Syscall param ioctl(generic) points to uninitialised byte(s)
==3752==    at 0x4CEE7829: ioctl (in /lib/libc-2.14.90.so)
==3752==    by 0x42377A63: drmIoctl (in /usr/lib/libdrm.so.2.4.0)
==3752==    by 0x4237A44C: drmCommandWriteRead (in /usr/lib/libdrm.so.2.4.0)
==3752==    by 0x49B8079: nouveau_bo_wrap (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752==    by 0x49B69A9: nouveau_channel_alloc (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752==    by 0x45D6F0D: ??? (in /usr/lib/dri/nouveau_dri.so)
==3752==    by 0x4565CF4: ??? (in /usr/lib/dri/nouveau_dri.so)
==3752==    by 0x45588DE: ??? (in /usr/lib/dri/nouveau_dri.so)
==3752==    by 0x42380FF3: ??? (in /usr/lib/libdrm.so.2.4.0)
==3752==  Address 0xbeb506cc is on thread 1's stack
==3752==  Uninitialised value was created by a stack allocation
==3752==    at 0x49B7FE0: nouveau_bo_wrap (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752== 
==3752== Syscall param ioctl(generic) points to uninitialised byte(s)
==3752==    at 0x4CEE7829: ioctl (in /lib/libc-2.14.90.so)
==3752==    by 0x42377A63: drmIoctl (in /usr/lib/libdrm.so.2.4.0)
==3752==    by 0x4237A44C: drmCommandWriteRead (in /usr/lib/libdrm.so.2.4.0)
==3752==    by 0x49B6CC9: nouveau_pushbuf_init (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752==    by 0x49B6A4C: nouveau_channel_alloc (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752==    by 0x45D6F0D: ??? (in /usr/lib/dri/nouveau_dri.so)
==3752==    by 0x4565CF4: ??? (in /usr/lib/dri/nouveau_dri.so)
==3752==    by 0x45588DE: ??? (in /usr/lib/dri/nouveau_dri.so)
==3752==    by 0x42380FF3: ??? (in /usr/lib/libdrm.so.2.4.0)
==3752==  Address 0xbeb506b4 is on thread 1's stack
==3752==  Uninitialised value was created by a stack allocation
==3752==    at 0x49B6C7F: nouveau_pushbuf_init (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752== 
==3752== Syscall param ioctl(generic) points to uninitialised byte(s)
==3752==    at 0x4CEE7829: ioctl (in /lib/libc-2.14.90.so)
==3752==    by 0x42377A63: drmIoctl (in /usr/lib/libdrm.so.2.4.0)
==3752==    by 0x4237A44C: drmCommandWriteRead (in /usr/lib/libdrm.so.2.4.0)
==3752==    by 0x49B7AAD: ??? (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752==    by 0x49B7EDE: nouveau_bo_new_tile (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752==    by 0x49B7F5B: nouveau_bo_new (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752==    by 0x49B6D1A: nouveau_pushbuf_init (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752==    by 0x49B6A4C: nouveau_channel_alloc (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752==    by 0x45D6F0D: ??? (in /usr/lib/dri/nouveau_dri.so)
==3752==    by 0x4565CF4: ??? (in /usr/lib/dri/nouveau_dri.so)
==3752==    by 0x45588DE: ??? (in /usr/lib/dri/nouveau_dri.so)
==3752==    by 0x42380FF3: ??? (in /usr/lib/libdrm.so.2.4.0)
==3752==  Address 0xbeb505c0 is on thread 1's stack
==3752==  Uninitialised value was created by a stack allocation
==3752==    at 0x49B79FF: ??? (in /usr/lib/libdrm_nouveau.so.1.0.0)
==3752== 
SDL_CreateWindow called
==3752== Syscall param writev(vector[...]) points to uninitialised byte(s)
==3752==    at 0x4CEE794E: writev (in /lib/libc-2.14.90.so)
==3752==    by 0x40D200D: X11_GL_GetVisual (SDL_x11opengl.c:427)
==3752==    by 0x40CB4C3: XCreateWindow (SDL_x11sym.h:37)
==3752==    by 0x40D4EFF: X11_CreateWindow (SDL_x11window.c:480)
==3752==    by 0x40C7255: SDL_CreateWindow (SDL_video.c:1204)
==3752==    by 0x804B7E5: CommonInit (common.c:730)
==3752==    by 0x80497F3: main (testdraw2.c:228)
==3752==  Address 0x4173bb3 is 35 bytes inside a block of size 16,384 alloc'd
==3752==    at 0x4006467: calloc (vg_replace_malloc.c:467)
==3752==    by 0x41C1B971: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==3752==    by 0x40CBDFB: XOpenDisplay (SDL_x11sym.h:77)
==3752==    by 0x40D3EFF: X11_CreateDevice (SDL_x11video.c:162)
==3752==    by 0x40C6FA6: SDL_VideoInit (SDL_video.c:457)
==3752==    by 0x804B531: CommonInit (common.c:583)
==3752==    by 0x4CE156B2: (below main) (in /lib/libc-2.14.90.so)
==3752==  Uninitialised value was created by a stack allocation
==3752==    at 0x41C27A1F: XStoreColors (in /usr/lib/libX11.so.6.3.0)
==3752== 
==3752== Syscall param writev(vector[...]) points to uninitialised byte(s)
==3752==    at 0x4CEE794E: writev (in /lib/libc-2.14.90.so)
==3752==  Address 0x4173bd7 is 71 bytes inside a block of size 16,384 alloc'd
==3752==    at 0x4006467: calloc (vg_replace_malloc.c:467)
==3752==    by 0x41C1B971: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==3752==    by 0x40CBDFB: XOpenDisplay (SDL_x11sym.h:77)
==3752==    by 0x40D3EFF: X11_CreateDevice (SDL_x11video.c:162)
==3752==    by 0x40C6FA6: SDL_VideoInit (SDL_video.c:457)
==3752==    by 0x804B531: CommonInit (common.c:583)
==3752==    by 0x4CE156B2: (below main) (in /lib/libc-2.14.90.so)
==3752==  Uninitialised value was created by a stack allocation
==3752==    at 0x41C27A1F: XStoreColors (in /usr/lib/libX11.so.6.3.0)
==3752== 
==3752== Syscall param writev(vector[...]) points to uninitialised byte(s)
==3752==    at 0x4CEE794E: writev (in /lib/libc-2.14.90.so)
==3752==    by 0x4222B9F: ???
==3752==  Address 0x4173bd7 is 71 bytes inside a block of size 16,384 alloc'd
==3752==    at 0x4006467: calloc (vg_replace_malloc.c:467)
==3752==    by 0x41C1B971: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==3752==    by 0x40CBDFB: XOpenDisplay (SDL_x11sym.h:77)
==3752==    by 0x40D3EFF: X11_CreateDevice (SDL_x11video.c:162)
==3752==    by 0x40C6FA6: SDL_VideoInit (SDL_video.c:457)
==3752==    by 0x804B531: CommonInit (common.c:583)
==3752==    by 0x4CE156B2: (below main) (in /lib/libc-2.14.90.so)
==3752==  Uninitialised value was created by a stack allocation
==3752==    at 0x41C27A1F: XStoreColors (in /usr/lib/libX11.so.6.3.0)
==3752== 
==3752== Syscall param writev(vector[...]) points to uninitialised byte(s)
==3752==    at 0x4CEE794E: writev (in /lib/libc-2.14.90.so)
==3752==    by 0x5: ???
==3752==  Address 0x4173bb3 is 35 bytes inside a block of size 16,384 alloc'd
==3752==    at 0x4006467: calloc (vg_replace_malloc.c:467)
==3752==    by 0x41C1B971: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==3752==    by 0x40CBDFB: XOpenDisplay (SDL_x11sym.h:77)
==3752==    by 0x40D3EFF: X11_CreateDevice (SDL_x11video.c:162)
==3752==    by 0x40C6FA6: SDL_VideoInit (SDL_video.c:457)
==3752==    by 0x804B531: CommonInit (common.c:583)
==3752==    by 0x4CE156B2: (below main) (in /lib/libc-2.14.90.so)
==3752==  Uninitialised value was created by a stack allocation
==3752==    at 0x41C27A1F: XStoreColors (in /usr/lib/libX11.so.6.3.0)
==3752== 
==3752== Syscall param writev(vector[...]) points to uninitialised byte(s)
==3752==    at 0x4CEE794E: writev (in /lib/libc-2.14.90.so)
==3752==    by 0x422739F: ???
==3752==  Address 0x4173bd7 is 71 bytes inside a block of size 16,384 alloc'd
==3752==    at 0x4006467: calloc (vg_replace_malloc.c:467)
==3752==    by 0x41C1B971: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==3752==    by 0x40CBDFB: XOpenDisplay (SDL_x11sym.h:77)
==3752==    by 0x40D3EFF: X11_CreateDevice (SDL_x11video.c:162)
==3752==    by 0x40C6FA6: SDL_VideoInit (SDL_video.c:457)
==3752==    by 0x804B531: CommonInit (common.c:583)
==3752==    by 0x4CE156B2: (below main) (in /lib/libc-2.14.90.so)
==3752==  Uninitialised value was created by a stack allocation
==3752==    at 0x41C27A1F: XStoreColors (in /usr/lib/libX11.so.6.3.0)
==3752== 
Couldn't create renderer: 
==3752== 
==3752== HEAP SUMMARY:
==3752==     in use at exit: 233,606 bytes in 831 blocks
==3752==   total heap usage: 6,147 allocs, 5,316 frees, 670,782 bytes allocated
==3752== 
==3752== LEAK SUMMARY:
==3752==    definitely lost: 420 bytes in 7 blocks
==3752==    indirectly lost: 101,255 bytes in 147 blocks
==3752==      possibly lost: 0 bytes in 0 blocks
==3752==    still reachable: 131,931 bytes in 677 blocks
==3752==         suppressed: 0 bytes in 0 blocks
==3752== Rerun with --leak-check=full to see details of leaked memory
==3752== 
==3752== For counts of detected and suppressed errors, rerun with: -v
==3752== ERROR SUMMARY: 16 errors from 9 contexts (suppressed: 0 from 0)
-----------------------------------------------------------------

And it looks like SDL keeps calling the same code over and over until it fails. 

.
Comment 6 Gerry Reno 2012-05-25 11:20:20 UTC
Looking at this some more...

It looks like it is complaining about uninitialized structures.

Looking through some of the code I can see where structures are allocated with calloc but that doesn't really initialize the structure.
Comment 7 Mauro Miolo 2012-06-27 07:17:21 UTC
(In reply to comment #6)
> Looking at this some more...
> 
> It looks like it is complaining about uninitialized structures.
> 
> Looking through some of the code I can see where structures are allocated with
> calloc but that doesn't really initialize the structure.

(In reply to comment #0)
> On a linux machine with Mesa 7.11 installed I just did a fresh checkout of
> SDL-2.0 from HG.
> 
> Ran autogen.sh, configure, and make, sudo make install
> 
> I go into tests and do the same.
> 
> When I try to run the tests I'm getting this:
> 
> $ ./testgles
> Couldn't create window:
> 
> 
> 
> So just for a quick check I fire up glx gears and it runs fine.
> 
> 
> I go and check some of my other gles programs and they're getting the same
> error. 
> 
> 
> Ran some tests:
> 
> Installed the mesa-demos and they all run ok.
> 
> 
> So then I tried one of the SDL tests and specifically requested various
> renderers:
> 
> 
> $ LD_PRELOAD=/usr/lib/libGLESv2.so ./testdraw2 --renderer software
> 156.54 frames per second
> $ LD_PRELOAD=/usr/lib/libGLESv2.so ./testdraw2 --renderer opengl
> Couldn't create renderer:
> $ LD_PRELOAD=/usr/lib/libGLESv2.so ./testdraw2 --renderer opengles
> Couldn't create renderer:
> $ LD_PRELOAD=/usr/lib/libGLESv2.so ./testdraw2 --renderer opengles2
> Couldn't create renderer:
> 
> 
> So then I check glxinfo to make sure that the driver wasn't the software
> rasterizer:
> 
> $ glxinfo | grep -i renderer
> OpenGL renderer string: Gallium 0.4 on NV36
> 
> 
> SDL-2.0 cannot create an OpenGL renderer on Linux using Mesa.
> 
> .

same problem here
Comment 8 Alex Barry 2014-07-06 15:49:56 UTC
Is this still a problem?  If so, can you post the ./configure output?
Comment 9 Ryan C. Gordon 2015-04-08 02:54:18 UTC
(In reply to Alex Barry from comment #8)
> Is this still a problem?  If so, can you post the ./configure output?

This was reported 15 months before we finalized 2.0.0, so I wouldn't be surprised if this was broken then and isn't now. We'd definitely have heard a lot more about it from all the Steam users.  :)

Closing this bug; feel free to reopen if this is still giving you trouble, though!

--ryan.