New Hardware Acceleration/Double buffering

I am new to the idea of using Hardware Buffers. I am using Linux (FC2)
with a Transmeta 1gig cpu. The Video is ATI Radeon 9001 Mobile with 64m
of memory.

I have a simple program that displays some png graphics and moves them
around. It works fine withe Video Mode settings set to SDL_SWSURFACE
and SDL_FULLSCREEN. Using the DGA driver I can get a frame rate of
about 54 frames per second. I got this by doing

fps=frames*1000/(end_time-start_time) where frames is a counter that
increments while the animation is going.

The Radeon driver seems to have a lot of overhead and slows things
down.

I wanted to push the speed more so I tried to use the setting
SDL_HWSURFACE with SDL_DOUBLEBUF and SDL_FULLSCREEN. I believe that you
have to lock the surface every time you want to use it so nothing else
’steals’ it from the program. I did this and unlocked it. SDL
initialized and the information I got back said that HW was there (using
SDL_GetVideo). The only thing is that nothing is displayed on the
screen.

I am not sure what I need to do different when dealing with SW and HW
surfaces.

If anyone has a simple example, or direct me to a solution that would be
great.

Thanks,
Walt

you only need to lock a surface when you are accessing the surface->pixels
array directly. Don’t lock it otherwise or you may cause a performance hit.
Also, if you are locking it to do some pixel access, try to lock it only once
and do all the work before unlocking and flipping the buffer.

-LIM-

Walter Crowley wrote:> I am new to the idea of using Hardware Buffers. I am using Linux (FC2)

with a Transmeta 1gig cpu. The Video is ATI Radeon 9001 Mobile with 64m
of memory.

I have a simple program that displays some png graphics and moves them
around. It works fine withe Video Mode settings set to SDL_SWSURFACE
and SDL_FULLSCREEN. Using the DGA driver I can get a frame rate of
about 54 frames per second. I got this by doing

fps=frames*1000/(end_time-start_time) where frames is a counter that
increments while the animation is going.

The Radeon driver seems to have a lot of overhead and slows things
down.

I wanted to push the speed more so I tried to use the setting
SDL_HWSURFACE with SDL_DOUBLEBUF and SDL_FULLSCREEN. I believe that you
have to lock the surface every time you want to use it so nothing else
’steals’ it from the program. I did this and unlocked it. SDL
initialized and the information I got back said that HW was there (using
SDL_GetVideo). The only thing is that nothing is displayed on the
screen.

I am not sure what I need to do different when dealing with SW and HW
surfaces.

If anyone has a simple example, or direct me to a solution that would be
great.

Thanks,
Walt


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

Thank You. That was the clue I needed. I looked again at the doc and
realized that you cannot Blit to a locked surface. I changed that up
and it worked. Now I am getting fast speeds (125-1000fps), and this is
way too fast for the monitor. Do you or anyone else know an efficient
way to lock the rate in at a specific speed, say 50fps?

Thanks again,
WaltOn Wed, 2004-10-13 at 16:04, Jonathan Atkins wrote:

you only need to lock a surface when you are accessing the surface->pixels
array directly. Don’t lock it otherwise or you may cause a performance hit.
Also, if you are locking it to do some pixel access, try to lock it only once
and do all the work before unlocking and flipping the buffer.

-LIM-

Walter Crowley wrote:

I am new to the idea of using Hardware Buffers. I am using Linux (FC2)
with a Transmeta 1gig cpu. The Video is ATI Radeon 9001 Mobile with 64m
of memory.

I have a simple program that displays some png graphics and moves them
around. It works fine withe Video Mode settings set to SDL_SWSURFACE
and SDL_FULLSCREEN. Using the DGA driver I can get a frame rate of
about 54 frames per second. I got this by doing

fps=frames*1000/(end_time-start_time) where frames is a counter that
increments while the animation is going.

The Radeon driver seems to have a lot of overhead and slows things
down.

I wanted to push the speed more so I tried to use the setting
SDL_HWSURFACE with SDL_DOUBLEBUF and SDL_FULLSCREEN. I believe that you
have to lock the surface every time you want to use it so nothing else
’steals’ it from the program. I did this and unlocked it. SDL
initialized and the information I got back said that HW was there (using
SDL_GetVideo). The only thing is that nothing is displayed on the
screen.

I am not sure what I need to do different when dealing with SW and HW
surfaces.

If anyone has a simple example, or direct me to a solution that would be
great.

Thanks,
Walt


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


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

you can turn on vsync, that limits the framerate to the verticle refresh
rate of your monitor, which in turn makes the images look alot nicer because
it gets rid of tearing.

there are other ways too im sure someone else will speak up about (:> ----- Original Message -----

From: waltc@fleetwoodgaming.com (Walter Crowley)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Wednesday, October 13, 2004 3:52 PM
Subject: Re: [SDL] New Hardware Acceleration/Double buffering

Thank You. That was the clue I needed. I looked again at the doc and
realized that you cannot Blit to a locked surface. I changed that up
and it worked. Now I am getting fast speeds (125-1000fps), and this is
way too fast for the monitor. Do you or anyone else know an efficient
way to lock the rate in at a specific speed, say 50fps?

Thanks again,
Walt

On Wed, 2004-10-13 at 16:04, Jonathan Atkins wrote:

you only need to lock a surface when you are accessing the
surface->pixels

array directly. Don’t lock it otherwise or you may cause a performance
hit.

Also, if you are locking it to do some pixel access, try to lock it only
once

and do all the work before unlocking and flipping the buffer.

-LIM-

Walter Crowley wrote:

I am new to the idea of using Hardware Buffers. I am using Linux
(FC2)

with a Transmeta 1gig cpu. The Video is ATI Radeon 9001 Mobile with
64m

of memory.

I have a simple program that displays some png graphics and moves them
around. It works fine withe Video Mode settings set to SDL_SWSURFACE
and SDL_FULLSCREEN. Using the DGA driver I can get a frame rate of
about 54 frames per second. I got this by doing

fps=frames*1000/(end_time-start_time) where frames is a counter that
increments while the animation is going.

The Radeon driver seems to have a lot of overhead and slows things
down.

I wanted to push the speed more so I tried to use the setting
SDL_HWSURFACE with SDL_DOUBLEBUF and SDL_FULLSCREEN. I believe that
you

have to lock the surface every time you want to use it so nothing else
’steals’ it from the program. I did this and unlocked it. SDL
initialized and the information I got back said that HW was there
(using

SDL_GetVideo). The only thing is that nothing is displayed on the
screen.

I am not sure what I need to do different when dealing with SW and HW
surfaces.

If anyone has a simple example, or direct me to a solution that would
be

great.

Thanks,
Walt


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


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


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

Just out of curiosity,

How does one turn on vsync?

Paul Lowe
pauls_lists at tetravista.netOn Wednesday 13 October 2004 04:06 pm, Alan Wolfe wrote:

you can turn on vsync, that limits the framerate to the
verticle refresh rate of your monitor, which in turn
makes the images look alot nicer because it gets rid of
tearing.

there are other ways too im sure someone else will speak
up about (:

----- Original Message -----
From: “Walter Crowley”
To: “A list for developers using the SDL library.
(includes SDL-announce)”
Sent: Wednesday, October 13, 2004 3:52 PM
Subject: Re: [SDL] New Hardware Acceleration/Double
buffering

Thank You. That was the clue I needed. I looked again
at the doc and realized that you cannot Blit to a
locked surface. I changed that up and it worked. Now
I am getting fast speeds (125-1000fps), and this is way
too fast for the monitor. Do you or anyone else know
an efficient way to lock the rate in at a specific
speed, say 50fps?

Thanks again,
Walt

On Wed, 2004-10-13 at 16:04, Jonathan Atkins wrote:

you only need to lock a surface when you are
accessing the

surface->pixels

array directly. Don’t lock it otherwise or you may
cause a performance

hit.

Also, if you are locking it to do some pixel access,
try to lock it only

once

and do all the work before unlocking and flipping the
buffer.

-LIM-

Walter Crowley wrote:

I am new to the idea of using Hardware Buffers. I
am using Linux

(FC2)

with a Transmeta 1gig cpu. The Video is ATI Radeon
9001 Mobile with

64m

of memory.

I have a simple program that displays some png
graphics and moves them around. It works fine
withe Video Mode settings set to SDL_SWSURFACE and
SDL_FULLSCREEN. Using the DGA driver I can get a
frame rate of about 54 frames per second. I got
this by doing

fps=frames*1000/(end_time-start_time) where frames
is a counter that increments while the animation is
going.

The Radeon driver seems to have a lot of overhead
and slows things down.

I wanted to push the speed more so I tried to use
the setting SDL_HWSURFACE with SDL_DOUBLEBUF and
SDL_FULLSCREEN. I believe that

you

have to lock the surface every time you want to use
it so nothing else ‘steals’ it from the program. I
did this and unlocked it. SDL initialized and the
information I got back said that HW was there

(using

SDL_GetVideo). The only thing is that nothing is
displayed on the screen.

I am not sure what I need to do different when
dealing with SW and HW surfaces.

If anyone has a simple example, or direct me to a
solution that would

be

great.

Thanks,
Walt


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


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


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


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

im not sure on your setup, im on windows and it’s on by default w/ sdl> ----- Original Message -----

From: pauls_lists@tetravista.net (Paul Lowe)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Thursday, October 14, 2004 12:43 AM
Subject: Re: [SDL] New Hardware Acceleration/Double buffering

Just out of curiosity,

How does one turn on vsync?

Paul Lowe
pauls_lists at tetravista.net

On Wednesday 13 October 2004 04:06 pm, Alan Wolfe wrote:

you can turn on vsync, that limits the framerate to the
verticle refresh rate of your monitor, which in turn
makes the images look alot nicer because it gets rid of
tearing.

there are other ways too im sure someone else will speak
up about (:

----- Original Message -----
From: “Walter Crowley”
To: “A list for developers using the SDL library.
(includes SDL-announce)”
Sent: Wednesday, October 13, 2004 3:52 PM
Subject: Re: [SDL] New Hardware Acceleration/Double
buffering

Thank You. That was the clue I needed. I looked again
at the doc and realized that you cannot Blit to a
locked surface. I changed that up and it worked. Now
I am getting fast speeds (125-1000fps), and this is way
too fast for the monitor. Do you or anyone else know
an efficient way to lock the rate in at a specific
speed, say 50fps?

Thanks again,
Walt

On Wed, 2004-10-13 at 16:04, Jonathan Atkins wrote:

you only need to lock a surface when you are
accessing the

surface->pixels

array directly. Don’t lock it otherwise or you may
cause a performance

hit.

Also, if you are locking it to do some pixel access,
try to lock it only

once

and do all the work before unlocking and flipping the
buffer.

-LIM-

Walter Crowley wrote:

I am new to the idea of using Hardware Buffers. I
am using Linux

(FC2)

with a Transmeta 1gig cpu. The Video is ATI Radeon
9001 Mobile with

64m

of memory.

I have a simple program that displays some png
graphics and moves them around. It works fine
withe Video Mode settings set to SDL_SWSURFACE and
SDL_FULLSCREEN. Using the DGA driver I can get a
frame rate of about 54 frames per second. I got
this by doing

fps=frames*1000/(end_time-start_time) where frames
is a counter that increments while the animation is
going.

The Radeon driver seems to have a lot of overhead
and slows things down.

I wanted to push the speed more so I tried to use
the setting SDL_HWSURFACE with SDL_DOUBLEBUF and
SDL_FULLSCREEN. I believe that

you

have to lock the surface every time you want to use
it so nothing else ‘steals’ it from the program. I
did this and unlocked it. SDL initialized and the
information I got back said that HW was there

(using

SDL_GetVideo). The only thing is that nothing is
displayed on the screen.

I am not sure what I need to do different when
dealing with SW and HW surfaces.

If anyone has a simple example, or direct me to a
solution that would

be

great.

Thanks,
Walt


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


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


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


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


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

VSync is only supported in a few drivers and usually only in fullscreen,
plus you can’t really tell SDL to turn it on or off, and sometimes you
have to set some unknown environment variable before calling
SDL_SetVideoMode. In any case, it’s not a reliable solution since you
have no good control over it.

A more or less reliable way of doing it, is to calculate the frames/sec
and either use a timer, or an SDL_Delay (along with a time that will get
you close to your desired next frame time). Or just skip rendering in
your event loop until the time for the next frame arrives, replacing the
redraw with a small SDL_Delay(10) if you want to be cpu friendly.

since FPS limiting has been discussed here before, I also suggest
searching the archives…

-LIM-

Alan Wolfe wrote:> you can turn on vsync, that limits the framerate to the verticle refresh

rate of your monitor, which in turn makes the images look alot nicer because
it gets rid of tearing.

there are other ways too im sure someone else will speak up about (:

----- Original Message -----
From: “Walter Crowley”
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Wednesday, October 13, 2004 3:52 PM
Subject: Re: [SDL] New Hardware Acceleration/Double buffering

Thank You. That was the clue I needed. I looked again at the doc and
realized that you cannot Blit to a locked surface. I changed that up
and it worked. Now I am getting fast speeds (125-1000fps), and this is
way too fast for the monitor. Do you or anyone else know an efficient
way to lock the rate in at a specific speed, say 50fps?

Thanks again,
Walt

On Wed, 2004-10-13 at 16:04, Jonathan Atkins wrote:

you only need to lock a surface when you are accessing the

surface->pixels

array directly. Don’t lock it otherwise or you may cause a performance

hit.

Also, if you are locking it to do some pixel access, try to lock it only

once

and do all the work before unlocking and flipping the buffer.

-LIM-

Walter Crowley wrote:

I am new to the idea of using Hardware Buffers. I am using Linux

(FC2)

with a Transmeta 1gig cpu. The Video is ATI Radeon 9001 Mobile with

64m

of memory.

I have a simple program that displays some png graphics and moves them
around. It works fine withe Video Mode settings set to SDL_SWSURFACE
and SDL_FULLSCREEN. Using the DGA driver I can get a frame rate of
about 54 frames per second. I got this by doing

fps=frames*1000/(end_time-start_time) where frames is a counter that
increments while the animation is going.

The Radeon driver seems to have a lot of overhead and slows things
down.

I wanted to push the speed more so I tried to use the setting
SDL_HWSURFACE with SDL_DOUBLEBUF and SDL_FULLSCREEN. I believe that

you

have to lock the surface every time you want to use it so nothing else
’steals’ it from the program. I did this and unlocked it. SDL
initialized and the information I got back said that HW was there

(using

SDL_GetVideo). The only thing is that nothing is displayed on the
screen.

I am not sure what I need to do different when dealing with SW and HW
surfaces.

If anyone has a simple example, or direct me to a solution that would

be

great.

Thanks,
Walt


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


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


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


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

Paul Lowe wrote:

Just out of curiosity,

How does one turn on vsync?

With SDL ? you can’t.

Stephane