Hardware acceleration

hello everybody,

I have a question:
Is there a way to get hardware acceleration (in windowed mode or not),
without being root?
(as it is told in the faq)
I am using linux with X server and a tnt2 video car (model 64, 32 Mb of
memory). The nvidia driver are installed, as when I launch x server
there is a “splash” screen with nvidia logo.

Also there is another thing I don’t understand. I wrote this programm:

screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32,
SDL_ANYFORMAT|SDL_HWSURFACE|SDL_FULLSCREEN);

info = (SDL_VideoInfo *)SDL_GetVideoInfo();
if (info->hw_available) {
printf(“hw_available\n”);
} else {
printf(“not hw_available\n”);
}

if (screen->flags && SDL_HWSURFACE) {
printf(“SDL_HWSURFACE\n”);
}

if (screen->flags && SDL_SWSURFACE) {
printf(“SDL_SWSURFACE\n”);
}

and here is the result:

not hw_available
SDL_HWSURFACE

hum. How hw cannot be available and be used ;o ?
Is this a known bug with SDL_GetVideoInfo() ?

thanks for answer.

The answer you probably don’t want to get, is the only one I can think
of. Use OpenGL. I may be wrong, but I think you can diddle with the
permissions on memory and setuid of certain files and allow DGA to work
as any user, but you have to remember that most people aren’t going to
do that. It’s a very pointy edge for any potential users to use your
project.

Really, if you want hardware acceleration “for sure” use an accelerated
API for the drawing, or glSDL as a driver.

It isn’t that hard really to create a simple Orthographic projection in
OpenGL and build a little set of classes up to act give or take like SDL
would act with SDL blits. Then you can use SDL for everything except
drawing.

As far as the graphics driver, you’ll have acceleration if you’ve done
both of:

  1. downloaded and run the NVIDIA-Linux-arch-x.y.z.run (It’s 1.0-4363
    right now)
  2. You’re using Driver “nvidia” in your XF86Config instead of the
    default “nv” driver.On Sun, 2003-06-08 at 10:25, yves baumes wrote:

hello everybody,

I have a question:
Is there a way to get hardware acceleration (in windowed mode or not),
without being root?
(as it is told in the faq)
I am using linux with X server and a tnt2 video car (model 64, 32 Mb of
memory). The nvidia driver are installed, as when I launch x server
there is a “splash” screen with nvidia logo.

Also there is another thing I don’t understand. I wrote this programm:

screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32,
SDL_ANYFORMAT|SDL_HWSURFACE|SDL_FULLSCREEN);

info = (SDL_VideoInfo *)SDL_GetVideoInfo();
if (info->hw_available) {
printf(“hw_available\n”);
} else {
printf(“not hw_available\n”);
}

if (screen->flags && SDL_HWSURFACE) {
printf(“SDL_HWSURFACE\n”);
}

if (screen->flags && SDL_SWSURFACE) {
printf(“SDL_SWSURFACE\n”);
}

and here is the result:

not hw_available
SDL_HWSURFACE

hum. How hw cannot be available and be used ;o ?
Is this a known bug with SDL_GetVideoInfo() ?

thanks for answer.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Jimmy <@Jimmy>
Jimmy’s World
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20030608/cbeaafc6/attachment.pgp

hello,

I may be off the point but it remains to me the trouble I fall into a few days
ago (I’m a newcomer with SDL) ; it was impossible to run any SDL program by
any user, but the root, from the console. Then “strace” the program showed a
refused acces to /dev/fb0. The group for fb0 had been set to “tty” by the
installation (slack.). I then added the user to the list of tty. It works but
isn’it the worse unsecure solution ?

Alain

hello everybody,

I have a question:
Is there a way to get hardware acceleration (in windowed mode or not),
without being root?
(as it is told in the faq)
I am using linux with X server and a tnt2 video car (model 64, 32 Mb of
memory). The nvidia driver are installed, as when I launch x server
there is a “splash” screen with nvidia logo.

…On Sunday 08 June 2003 14:25, yves baumes wrote:


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Alain MONVOISIN. 28,rue du Cardinal Lemoine. Paris.
<< L’insens? fait en son coeur des projets
sans s’assurer de ce qui peut les contrarier. >>
(Boudha), Le Dhammapada.

Hi,

Is this a known bug with SDL_GetVideoInfo() ?

No, it is a bug in your code, should be something like:

if (screen->flags & SDL_HWSURFACE) {
printf(“SDL_HWSURFACE\n”);
}
else {
printf(“SDL_SWSURFACE\n”);
}

See the ‘testvidinfo.c’ file that comes with the source distribution
for more details,

cheers,
John.> ----- Original Message -----

From: baumes@essi.fr (yves baumes)
To:
Sent: Sunday, June 08, 2003 3:25 PM
Subject: [SDL] hardware acceleration

hello everybody,

I have a question:
Is there a way to get hardware acceleration (in windowed mode or not),
without being root?
(as it is told in the faq)
I am using linux with X server and a tnt2 video car (model 64, 32 Mb of
memory). The nvidia driver are installed, as when I launch x server
there is a “splash” screen with nvidia logo.

Also there is another thing I don’t understand. I wrote this programm:

screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32,
SDL_ANYFORMAT|SDL_HWSURFACE|SDL_FULLSCREEN);

info = (SDL_VideoInfo *)SDL_GetVideoInfo();
if (info->hw_available) {
printf(“hw_available\n”);
} else {
printf(“not hw_available\n”);
}

if (screen->flags && SDL_HWSURFACE) {
printf(“SDL_HWSURFACE\n”);
}

if (screen->flags && SDL_SWSURFACE) {
printf(“SDL_SWSURFACE\n”);
}

and here is the result:

not hw_available
SDL_HWSURFACE

hum. How hw cannot be available and be used ;o ?
Is this a known bug with SDL_GetVideoInfo() ?

thanks for answer.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hello,

i recommend to change the logical OR (&&) to the bitwise OR (&)
in

if (screen->flags && SDL_HWSURFACE) {

and

if (screen->flags && SDL_SWSURFACE) {

SDL_HWSURFACE is defined non zero but SDL_SWSURFACE isn’t (see SDL_video.h).

Your screen->flags seem to be non zero, so you get the mysterious results.

BTW: If someone knows how to get the hardware acceleration using the
OpenGL-Driver instead of the Voodoo3-GLIDE (tdfx) directly would help me a
lot. My SDL-Application seems to be very slow since then (configuration
problems ?, i don’t know…)

bye,
Walter> hello everybody,

I have a question:
Is there a way to get hardware acceleration (in windowed mode or not),
without being root?
(as it is told in the faq)
I am using linux with X server and a tnt2 video car (model 64, 32 Mb of
memory). The nvidia driver are installed, as when I launch x server
there is a “splash” screen with nvidia logo.

Also there is another thing I don’t understand. I wrote this programm:

screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32,
SDL_ANYFORMAT|SDL_HWSURFACE|SDL_FULLSCREEN);

info = (SDL_VideoInfo *)SDL_GetVideoInfo();
if (info->hw_available) {
printf(“hw_available\n”);
} else {
printf(“not hw_available\n”);
}

if (screen->flags && SDL_HWSURFACE) {
printf(“SDL_HWSURFACE\n”);
}

if (screen->flags && SDL_SWSURFACE) {
printf(“SDL_SWSURFACE\n”);
}

and here is the result:

not hw_available
SDL_HWSURFACE

hum. How hw cannot be available and be used ;o ?
Is this a known bug with SDL_GetVideoInfo() ?

thanks for answer.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

hello,

I may be off the point but it remains to me the trouble I fall into a few days
ago (I’m a newcomer with SDL) ; it was impossible to run any SDL program by
any user, but the root, from the console. Then “strace” the program showed a
refused acces to /dev/fb0. The group for fb0 had been set to “tty” by the
installation (slack.). I then added the user to the list of tty. It works but
isn’it the worse unsecure solution ?

You are using a video target that specifically requires this. svgalib does,
and fbcon does. Other targets dont.On 08-Jun-2003, Alain MONVOISIN wrote:

On Sunday 08 June 2003 14:25, yves baumes wrote:

Alain

hello everybody,

I have a question:
Is there a way to get hardware acceleration (in windowed mode or not),
without being root?
(as it is told in the faq)
I am using linux with X server and a tnt2 video car (model 64, 32 Mb of
memory). The nvidia driver are installed, as when I launch x server
there is a “splash” screen with nvidia logo.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Alain MONVOISIN. 28,rue du Cardinal Lemoine. Paris.
<< L’insens? fait en son coeur des projets
sans s’assurer de ce qui peut les contrarier. >>
(Boudha), Le Dhammapada.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Patrick “Diablo-D3” McFarland || unknown at panax.com
"Computer games don’t affect kids; I mean if Pac-Man affected us as kids, we’d
all be running around in darkened rooms, munching magic pills and listening to
repetitive electronic music." – Kristian Wilson, Nintendo, Inc, 1989

Hi. I’m using the “nv” driver (that comes with Redhat 9.0), and I’m able to get hardware surfaces and acceleration.

Regards,

Carlos----- Original Message -----
From: Jimmy
To: SDL Mailing List
Sent: Sunday, June 08, 2003 1:54 PM
Subject: Re: [SDL] hardware acceleration

The answer you probably don’t want to get, is the only one I can think of. Use OpenGL. I may be wrong, but I think you can diddle with the permissions on memory and setuid of certain files and allow DGA to work as any user, but you have to remember that most people aren’t going to do that. It’s a very pointy edge for any potential users to use your project.

Really, if you want hardware acceleration “for sure” use an accelerated API for the drawing, or glSDL as a driver.

It isn’t that hard really to create a simple Orthographic projection in OpenGL and build a little set of classes up to act give or take like SDL would act with SDL blits. Then you can use SDL for everything except drawing.

As far as the graphics driver, you’ll have acceleration if you’ve done both of:

  1. downloaded and run the NVIDIA-Linux-arch-x.y.z.run (It’s 1.0-4363 right now)
  2. You’re using Driver “nvidia” in your XF86Config instead of the default “nv” driver.

On Sun, 2003-06-08 at 10:25, yves baumes wrote:
hello everybody,

I have a question:
Is there a way to get hardware acceleration (in windowed mode or not),
without being root?
(as it is told in the faq)
I am using linux with X server and a tnt2 video car (model 64, 32 Mb of
memory). The nvidia driver are installed, as when I launch x server
there is a “splash” screen with nvidia logo.

Also there is another thing I don’t understand. I wrote this programm:

screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32,
SDL_ANYFORMAT|SDL_HWSURFACE|SDL_FULLSCREEN);

info = (SDL_VideoInfo *)SDL_GetVideoInfo();
if (info->hw_available) {
printf(“hw_available\n”);
} else {
printf(“not hw_available\n”);
}

if (screen->flags && SDL_HWSURFACE) {
printf(“SDL_HWSURFACE\n”);
}

if (screen->flags && SDL_SWSURFACE) {
printf(“SDL_SWSURFACE\n”);
}

and here is the result:

not hw_available
SDL_HWSURFACE

hum. How hw cannot be available and be used ;o ?
Is this a known bug with SDL_GetVideoInfo() ?

thanks for answer.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl-- Jimmy Jimmy’s World

hello everybody,

I have a question:
Is there a way to get hardware acceleration (in windowed mode or not),
without being root?

You must either be root or the program must be “setuid” to root. The
following is a script I use to setuid the program. I just call it
"setuid". Note, you must be root to run it.

#!/bin/bash

if [[ root != whoami ]] ; then
echo you must be root to run this script
exit
fi
chown root.root $1
chmod a+sxrw $1
ls -l $1

(as it is told in the faq)
I am using linux with X server and a tnt2 video car (model 64, 32 Mb of
memory). The nvidia driver are installed, as when I launch x server
there is a “splash” screen with nvidia logo.

Also there is another thing I don’t understand. I wrote this programm:

screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32,
SDL_ANYFORMAT|SDL_HWSURFACE|SDL_FULLSCREEN);

info = (SDL_VideoInfo *)SDL_GetVideoInfo();
if (info->hw_available) {
printf(“hw_available\n”);
} else {
printf(“not hw_available\n”);
}

if (screen->flags && SDL_HWSURFACE) {

That should be “&” not “&&”. That is, the bitwise and, not the logical
and as you have it coded. The way this is code is written the
conditional will always be true because the pointer and the constant are
both non-zero.

printf("SDL_HWSURFACE\n");

}

if (screen->flags && SDL_SWSURFACE) {
printf(“SDL_SWSURFACE\n”);
}

and here is the result:

not hw_available
SDL_HWSURFACE

hum. How hw cannot be available and be used ;o ?

Impossible results are often the result of bugs in the code. :slight_smile:

BTW, you really want to use something like the DGA driver if you want
hardware surfaces with X and SDL. The NVidia drivers, at least the
current ones, give you hardware surfaces and hardware blits through the
DGA driver.

	Bob PendletonOn Sun, 2003-06-08 at 09:25, yves baumes wrote:

Is this a known bug with SDL_GetVideoInfo() ?

thanks for answer.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

±----------------------------------+

  • Bob Pendleton: independent writer +
  • and programmer. +
  • email: Bob at Pendleton.com +
    ±----------------------------------+


Thank you for that. Now are there several other targets for the frame-buffer ?
In fact I don’t fully understand what exactly are the targets (drivers ?).
I’d like to see some layered models somewhere.On Monday 09 June 2003 00:47, Patrick McFarland wrote:

On 08-Jun-2003, Alain MONVOISIN wrote:

On Sunday 08 June 2003 14:25, yves baumes wrote:

hello,

I may be off the point but it remains to me the trouble I fell into a few
days ago (I’m a newcomer with SDL) ; it was impossible to run any SDL
program by any user, but the root, from the console. Then “strace” the
program showed a refused acces to /dev/fb0. The group for fb0 had been
set to “tty” by the installation (slack.). I then added the user to the
list of tty. It works but isn’it the worse unsecure solution ?

You are using a video target that specifically requires this. svgalib does,
and fbcon does. Other targets dont.


Alain MONVOISIN. 28,rue du Cardinal Lemoine. Paris.
<< L’insens? fait en son coeur des projets
sans s’assurer de ce qui peut les contrarier. >>
(Boudha), Le Dhammapada.

It’s not advisable to give read permission to setuid binary file,
because this makes it easier to exploit possible buffer underrun
situations. If one can read the binary one can more easily find buffer
underrun bug from it.On Monday 09 June 2003 20:39, Bob Pendleton wrote:

On Sun, 2003-06-08 at 09:25, yves baumes wrote:

hello everybody,

I have a question:
Is there a way to get hardware acceleration (in windowed mode or
not), without being root?

You must either be root or the program must be “setuid” to root. The
following is a script I use to setuid the program. I just call it
"setuid". Note, you must be root to run it.

#!/bin/bash

if [[ root != whoami ]] ; then
echo you must be root to run this script
exit
fi
chown root.root $1
chmod a+sxrw $1
ls -l $1