SDL Initialization has Failed - Stopping many Games from Loading

I have a large number of games installed via the repositories on Ubuntu 8.10
how ever many of them throw an error similar to this upon trying to load
them:

Error : SDL initialization failed
Reason : No available video device

I have a NVidia 9500M GS Graphics card and I am running the 180.xx drivers.
Any one have ideas ideas how I can correct this error? As I said the exact
error message varies depending on the game, but they all say they cannot
find an available video device.

I found this thread:
http://www.linuxquestions.org/questions/debian-26/could-not-initialize-sdl-video-subsystem-572275/

Which looks like a similar issue, but I do not see a solution posted there
:frowning:

Help please,
~Jeff–
View this message in context: http://www.nabble.com/SDL-Initialization-has-Failed---Stopping-many-Games-from-Loading-tp22418541p22418541.html
Sent from the SDL mailing list archive at Nabble.com.

Have you set SDL_VIDEODRIVER to some specific value?
Make this to output the value (if it is set):

echo $ SDL_VIDEODRIVER

Have you tried this before starting:

export SDL_VIDEODRIVER=x11

That sets the video mode to X11 which should always work in a X11
environment.

There are some more options:

http://www.libsdl.org/cgi/docwiki.cgi/SDL_envvars

Please say if you had some value before or not (the echo command) and
if it worked with X11.

Question to other developers: How does SDL select the video driver if
it is not set? Is it predefined (for each system) and if that fails,
it just breaks? Or does it try multiple ones and uses the one which
worked?

If the latter is not the case, I probably would like to set some
fallback for our game for Linux if it doesn’t work.Am 09.03.2009 um 20:55 schrieb Jeff91:

I have a large number of games installed via the repositories on
Ubuntu 8.10
how ever many of them throw an error similar to this upon trying to
load
them:

Error : SDL initialization failed
Reason : No available video device

I have a NVidia 9500M GS Graphics card and I am running the 180.xx
drivers.
Any one have ideas ideas how I can correct this error? As I said the
exact
error message varies depending on the game, but they all say they
cannot
find an available video device.

I found this thread:
http://www.linuxquestions.org/questions/debian-26/could-not-initialize-sdl-video-subsystem-572275/

Which looks like a similar issue, but I do not see a solution posted
there
:frowning:

Help please,
~Jeff

View this message in context: http://www.nabble.com/SDL-Initialization-has-Failed---Stopping-many-Games-from-Loading-tp22418541p22418541.html
Sent from the SDL mailing list archive at Nabble.com.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Question to other developers: How does SDL select the video driver if
it is not set? Is it predefined (for each system) and if that fails,
it just breaks? Or does it try multiple ones and uses the one which
worked?

If not set, it tries several targets in a reasonable order to find the
best option. You should NOT set the environment variable unless you need
to force it for some reason.

Frequently, on Linux, “No available video device” means SDL was
miscompiled (without X11 support), or SDL can’t talk to your X server
for some reason.

–ryan.

If you could download the SDL source code and try to build and run the
tests therein, that would probably go far in pursuit of narrowing down
the possible problems.On Mon, Mar 9, 2009 at 3:55 PM, Jeff91 <blue_starsoar at yahoo.com> wrote:

Error : SDL initialization failed
Reason : No available video device


http://codebad.com/

Question to other developers: How does SDL select the video driver
if it is not set? Is it predefined (for each system) and if that
fails, it just breaks? Or does it try multiple ones and uses the
one which worked?

If not set, it tries several targets in a reasonable order to find
the best option. You should NOT set the environment variable unless
you need to force it for some reason.

Frequently, on Linux, “No available video device” means SDL was
miscompiled (without X11 support), or SDL can’t talk to your X
server for some reason.

–ryan.

Ah thanks for the information. Then I don’t have to care about this.

(Except for Windows, where SDL doesn’t prefer DirectX for some reason
(it prefers WinDIB over DirectX if I recall correctly) but we have
much better performance with the DirectX backend; thus we try first
with forced DirectX backend (if env is unset) and if that fails, we
unset the env and try it again.)Am 25.03.2009 um 15:32 schrieb Ryan C. Gordon:

Hello !

(Except for Windows, where SDL doesn’t prefer DirectX for some reason
(it prefers WinDIB over DirectX if I recall correctly) but we have much
better performance with the DirectX backend; thus we try first with
forced DirectX backend (if env is unset) and if that fails, we unset the
env and try it again.)

SDL 1.2 uses DirectX 5 and there were some problems
with it on Windows Vista, so GDI was set as the new default.

CU

SDL 1.2 uses DirectX 5 and there were some problems
with it on Windows Vista, so GDI was set as the new default.

Also, I think that in DirectX 8, “proper” DirectDraw (which SDL was
using) was dropped, and the older interfaces give you a Direct3D
wrapper, which will work very well (and fast) if you have a 3D
accelerated card, but if you did not, a bunch of things that the 2D
hardware made fast became really slow, to the point where doing in
software with the GDI was much faster (but slower than the actual 2D
accelerated support that DirectDraw gave you). Thankfully, DirectX 8
is usually on new enough computers that doing it in software seems
okay, and SDL games are often “used to” software rendering, often
being used on Linux, where it’s all software, all the time.On Wed, Mar 25, 2009 at 2:15 PM, Torsten Giebl wrote:


http://pphaneuf.livejournal.com/

SDL 1.2 uses DirectX 5 and there were some problems
with it on Windows Vista, so GDI was set as the new default.

Also, I think that in DirectX 8, “proper” DirectDraw (which SDL was
using) was dropped, and the older interfaces give you a Direct3D
wrapper, which will work very well (and fast) if you have a 3D
accelerated card, but if you did not, a bunch of things that the 2D
hardware made fast became really slow, to the point where doing in
software with the GDI was much faster (but slower than the actual 2D
accelerated support that DirectDraw gave you). Thankfully, DirectX 8
is usually on new enough computers that doing it in software seems
okay,

Is the assumption ok that a user which has DirectX8 installed probably
has hardware which can do this fast?

What other problems are there with the DirectX backend on Windows
Vista? (Just failing wouldn’t be a problem as we have the fallback
then to just use the SDL default.)

I wonder if we perhaps should change the behaviour in our game.
Whereby up to now we got a lot of reports that our game is running
faster since we have it. But it could be that I am not up-to-date
anymore (I only get this reports indirectly from our Windows developer).

and SDL games are often “used to” software rendering, often
being used on Linux, where it’s all software, all the time.

Is that also true for OpenGL & SDL_HWSURFACE?Am 25.03.2009 um 20:05 schrieb Pierre Phaneuf:

On Wed, Mar 25, 2009 at 2:15 PM, Torsten Giebl wrote:

Is the assumption ok that a user which has DirectX8 installed probably has
hardware which can do this fast?

That sounds reasonable. The problem is that if you’ve got someone with
Win95 on an ancient machine where DirectDraw would be a better choice,
we still default to GDI first, and that is less nice. I guess a
"maybedirectx" driver could be put in front of the GDI one, which
would try to figure out if DirectX is a good or a bad idea (query for
DirectX 8, if you get it, then skip DirectX, for example). That said,
this is becoming less and less relevant, I think…

What other problems are there with the DirectX backend on Windows Vista?
(Just failing wouldn’t be a problem as we have the fallback then to just use
the SDL default.)

I’m not entirely aware of the details there, as I don’t use it myself,
it’s just been reported. I saw the DirectDraw slowdowns on DirectX 8
and up, though, pretty visible (test programs that used to have 50 fps
and up down to below 10 fps, but they also sucked on Linux, so…).

I wonder if we perhaps should change the behaviour in our game. Whereby up
to now we got a lot of reports that our game is running faster since we have
it. But it could be that I am not up-to-date anymore (I only get this
reports indirectly from our Windows developer).

You could still have a bit of Windows-specific code to use SDL_setenv
to set the video driver to DirectX in your game before initializing
SDL, checking on some conditions that work for your users. No
modification to SDL required, just more hacking. :wink:

and SDL games are often “used to” software rendering, often
being used on Linux, where it’s all software, all the time.

Is that also true for OpenGL & SDL_HWSURFACE?

OpenGL is its own deal, separate from SDL (the latter only gives you a
portable access to the platform OpenGL), so if OpenGL is hardware
accelerated, then it will be for a program using OpenGL through the
SDL binding (but any SDL calls that aren’t using OpenGL won’t be
accelerated). That’s one of the reasons that the OpenGL rendering in
SDL 1.3 is so nice, SDL will use OpenGL itself if available, so we
finally have access to hardware acceleration on Linux! If your OpenGL
isn’t hardware accelerated, though, software is still the word. I
curse the lack of (useful) access to the 2D accelerators on Linux all
the time, there’s very little you can do even using Xlib directly
(solid fills, non-colorkeyed, non-alpha blits, that’s more or less
it)…

SDL_HWSURFACE is just a “nice request”, if it’s not available, you
still get a surface that won’t be on hardware, and/or won’t be
accelerated.

The general situation on Linux is that either your game should be
simple enough to be doable in software (which is still fairly nice on
a modern machine, but on an old geezer, it gets unimpressive real
quick), or you can do 2D effects with OpenGL, basically requiring 3D
hardware acceleration, but guaranteeing solid performance everywhere
(even a crappy Intel GMA can do a whole bunch of 2D effects without
sweat).On Wed, Mar 25, 2009 at 3:49 PM, Albert Zeyer <albert.zeyer at rwth-aachen.de> wrote:


http://pphaneuf.livejournal.com/

I forget exactly, but Tux Paint in fullscreen mode on some Windows systems
had some crazy issues when using the (at the time) default DirectX driver
via SDL.

digging up details

So the issues we had listed in the “Known Issues” for Tux Paint 0.9.15
(from November 2005), and whcih were resolved by using ‘windib’ driver
in SDL, included:

  • Running Tux Paint causes Windows to reboot or display a "blue screen"
    error message.
  • Fullscreen mode causes monitor synchronization problems.
  • TabletPC stylus does not work properly in fullscreen mode.
  • Mouse does not move properly in fullscreen mode, or is offset.

Pretty nasty, and the work-around involved asking users to screw around
with their environment variables. :^P

http://tuxpaint.org/docs/windib/On Wed, Mar 25, 2009 at 08:49:07PM +0100, Albert Zeyer wrote:

What other problems are there with the DirectX backend on Windows
Vista? (Just failing wouldn’t be a problem as we have the fallback
then to just use the SDL default.)


-bill!
“Tux Paint” - free children’s drawing software for Windows / Mac OS X / Linux!
Download it today! http://www.tuxpaint.org/

What other problems are there with the DirectX backend on Windows
Vista? (Just failing wouldn’t be a problem as we have the fallback
then to just use the SDL default.)

I forget exactly, but Tux Paint in fullscreen mode on some Windows
systems
had some crazy issues when using the (at the time) default DirectX
driver
via SDL.

digging up details

So the issues we had listed in the “Known Issues” for Tux Paint 0.9.15
(from November 2005), and whcih were resolved by using ‘windib’ driver
in SDL, included:

  • Running Tux Paint causes Windows to reboot or display a "blue
    screen"
    error message.

Uh, that’s not nice. But I don’t think that this is TuxPaint’s (or
SDL’s) fault. That seems more like a driver problem. Probably these
users have similar crashes also with other 3D applications. Whereby it
could be more stable with WinDIB of course.

  • Fullscreen mode causes monitor synchronization problems.
  • TabletPC stylus does not work properly in fullscreen mode.
  • Mouse does not move properly in fullscreen mode, or is offset.

Hm, we didn’t had such reports yet. (But our game is also mostly
controlled by keyboard; only in the menu is controlled by mouse.)

Btw., November 2005, these problems were on Windows XP then?

I am still not sure if we should change our current behaviour. :slight_smile:
Probably a lot of people will complain about less FPS.

I am really looking forward to a stable SDL 1.3, then we can finally
really use OpenGL without much changes and can use this as the
prefered videodriver. We already thought often about implementing all
this by ourself but nobody found the time/encourage to implement this,
so it’s nice to have this already in SDL.Am 25.03.2009 um 21:41 schrieb Bill Kendrick:

On Wed, Mar 25, 2009 at 08:49:07PM +0100, Albert Zeyer wrote:

Uh, that’s not nice. But I don’t think that this is TuxPaint’s (or
SDL’s) fault. That seems more like a driver problem. Probably these
users have similar crashes also with other 3D applications. Whereby it
could be more stable with WinDIB of course.

It’s definitely a driver issue, but TuxPaint gets the blame. :slight_smile:

DirectDraw was becoming a liability on Windows, so we switched to WinDib
as the default. This all becomes irrelevant with SDL 1.3, which is
likely drawing with Direct3D behind the scenes, even for 2D stuff.

–ryan.

Millions of users can’t be wrong! >:^)

-bill!On Thu, Mar 26, 2009 at 04:06:51AM -0400, Ryan C. Gordon wrote:

It’s definitely a driver issue, but TuxPaint gets the blame. :slight_smile: