Multiple MIT-SHM surfaces

Hi all,

Many thanks to all you developers and testers for
creating an extremely simple, elegant library. It
took me no time to get up to speed with SDL. I also
found #sdl on irc to be very helpful.

I’m currently using SDL for movie playback in a
window, and the frames are quite large. Because the
movies are spooled across the network via NFS, I’ve
got a ring buffer of surfaces, where each surface is
created using SDL_CreateRGBSurface. This buffer
allows my decoder to run ahead of playback so that I
can tolerate variable latencies in the network and/or
disk I/O.

Unfortunately, due to the large frame sizes, the extra
blit from each surface into the “video” surface
created with SDL_SetVideoMode is impacting the
framerate by as much as 20% for some flicks. What I
want is to create a ring of multiple MIT-SHM surfaces
like the one returned by SDL_SetVideoMode, and have
the decoder go around the ring writing pixels into
each one; while a display thread/signal/whatever wakes
up approx. every 24th of a second and calls
SDL_UpdateRect(surfaces[current_frame], …). This
way I can avoid the extra blit, since I’m writing into
surfaces which can be read directly by the X server.

I think I know how to do this for X11, at least.
Unfortunately, I don’t have access to machines or time
enough to do it for other platforms. Does anyone
already have plans for this type of thing in 1.2? If
not, I’ll give it a shot. Suggestions and/or advice
on how to go about doing it are welcome.

thanks
-dwh-__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

What I
want is to create a ring of multiple MIT-SHM surfaces
like the one returned by SDL_SetVideoMode, and have
the decoder go around the ring writing pixels into
each one; while a display thread/signal/whatever wakes
up approx. every 24th of a second and calls
SDL_UpdateRect(surfaces[current_frame], …). This
way I can avoid the extra blit, since I’m writing into
surfaces which can be read directly by the X server.

Why don’t you read-ahead and buffer the undecoded frames in memory instead?
Then just decode next frame immediately after calling UpdateRect() on
the previous one, and sleep until it should be displayed. You may still
do the reading from another thread if you like.

What you are asking for might be possible in a future release of SDL,
if (when) we implement support for large virtual screens