Question about SDL and DGA

Hi there,
I’m developing an animation program using SDL and xfree86 4.1 dga extension.
I have started with writing a little testprogram, which only moves and
scales a bitmap. It’s working fine, when I’m logged in as root, but how can
I get it running in as user with using dga?
The next problem I have is starting the X-Server within the program without
using a windows mager!

Thanks in advance

I’m developing an animation program using SDL and xfree86 4.1 dga extension.
I have started with writing a little testprogram, which only moves and
scales a bitmap. It’s working fine, when I’m logged in as root, but how can
I get it running in as user with using dga?

I don’t think you can; you need to be root to use DGA, i think. This is
not an SDL limitation so much as it is a limitation (or rather, security
restriction) of XFree86.

You can always try running your program setuid root, if you’re brave.

The next problem I have is starting the X-Server within the program without
using a windows mager!

Start…the X-server from inside the program?

You want to start X if it isn’t running?

–ryan.

I don’t think you can; you need to be root to use DGA, i think. This is
not an SDL limitation so much as it is a limitation (or rather, security
restriction) of XFree86.

You can always try running your program setuid root, if you’re brave.

I copied the programm to /usr/local/bin as root and now I can execute with
dga it as normal user.
Do you know why?

Start…the X-server from inside the program?

You want to start X if it isn’t running?

–ryan.

In my opinion kde needs to start X before starting itself, so it has to be
possible to do so in my program.
Helge

In my opinion kde needs to start X before starting itself, so it has to be
possible to do so in my program.

You can always do something like this, but this is completely
non-portable, and probably flakey besides…in short, it might work, but i
don’t recommend it:

(psuedocode follows)

putenv(“SDL_VIDEODRIVER=x11”);
if (SDL_Init(SDL_INIT_VIDEO) == -1)
{
if (!spawn_a_program("/usr/X11/bin/X"))
give_up(“Couldn’t start X server”);
else
{
if (SDL_Init(SDL_INIT_VIDEO) == -1)
{
kill_x_server();
give_up(“Started X server, but still couldn’t init SDL!”);
}
else
{
do_your_program();
kill_x_server();
}
}
}

Alternately, you can decide if you need dga that badly. Afterall, there
IS a reason that SDL has fbcon and svgalib backends.

–ryan.

I had to do something similar for an automated test system. I took gdm,
removed the gdm-stuff leaving the code to start X and begin a session. I
don’t have it with me now, since I did it at work. I can post the code online
on Monday though, since it’s GPL-derived.

The gist of it is:

  1. generate auth key
  2. start X server using auth, directing stdout and stderr to a log file
  3. start X app, directing stdout and stderr to a log file
  4. wait for stuff to die, then start again from #1

The auth stuff can be skipped, if you don’t care about security.

-RayOn Friday 21 September 2001 07:54, you wrote:

I don’t think you can; you need to be root to use DGA, i think. This is
not an SDL limitation so much as it is a limitation (or rather, security
restriction) of XFree86.

You can always try running your program setuid root, if you’re brave.

I copied the programm to /usr/local/bin as root and now I can execute with
dga it as normal user.
Do you know why?

Start…the X-server from inside the program?

You want to start X if it isn’t running?

–ryan.

In my opinion kde needs to start X before starting itself, so it has to be
possible to do so in my program.
Helge

Hi Ray,
[…]

I had to do something similar for an automated test system. I took gdm,
removed the gdm-stuff leaving the code to start X and begin a session. I
don’t have it with me now, since I did it at work. I can post the code
online
on Monday though, since it’s GPL-derived.

This would be fine and save a lot of work.
I need it to start an animation which must run the whole day.

Helge