SDL

From OESF

Revision as of 15:54, 3 May 2006 by Uth (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

SDL is a cross platform library that abstracts and manages access to graphics, audio, input and other devices. It allows a program written for one platform to be easily be ported to another with little or no changes. Many games and emulators make use of SDL.

On the Zaurus there are several SDL ipkgs available. A problem is that they aren't always compatible with one another. Another problem is there is very little documentation available on Zaurus-specific implementations of SDL

This document will provide information for both users and developers

Contents

Basic SDL concepts

SDL achieves its cross-platform capabilities by implementing backend drivers for the different hardware and subsystems it supports. Sometimes there are multiple compatible backends, and SDL is pretty good at choosing the best options.

However there are some enviroment variables that can be set that override SDLs normal choices. Some notible ones:

SDL_VIDEODRIVER The backend driver to use for graphics. The normal choice for the Zaurus is 'qtopia', though it could also be 'bvdd' or maybe even 'x11' (on ROMS that support it)
SDL_AUDIODRIVER The audio system to use. Probably should be 'oss' or 'alsa'

There are many more, but not all are relevant to the Zaurus. See this page for a complete list

Zaurus Drivers

The 'qtopia' driver has been a part of the official SDL distribution since at least version 1.2.5. It supports some Z specific features, like rotation. It only supports full screen output.

The 'bvdd' driver is present only in a special build of SDL. It uses the bvdd overay of the PXA27x CPU, so it will only work on models using that CPU (currently the C1000, and C3x00). It may perform better than the qtopia driver (though my testing shows it is sometimes faster, sometimes not, depending on certain factors.) It appears to be based on the qtopia drive, and supports some of its features (like rotations). It too is full-screen only.

The 'x11' driver may be present on roms that offer X windows. This is the only driver that will allow the ouput to be drawn to a window.

qtopia driver

The qtopia driver recognizes these additional environment variables:

SDL_FBDEV Sets the framebuffer device to use. Defaults to /dev/fb0
USER determins which QtEmbedded-0.spec to read rotation info from. Where: /tmp/qtembedded-(USER)
SDL_FB_SIZE Limits framebuffer size?
SDL_QT_ROTATION_ENV_NAME supposedly affects how the screen is rotated
SDL_FB_DIRECT Not sure exactly what this does. Setting it greatly enhanced performance for some apps, seems to not work at all for others.
SDL_QT_INVERT_ROTATION_ENV_NAME Not sure what this does

bvdd driver

The bvdd driver recognizes these additional environment variables:

SDL_BVDDDEV points to the bvdd device file. Defaults to /dev/bvdd
USER determins which QtEmbedded-0.spec to read rotation info from. Where: /tmp/qtembedded-(USER)
SDL_QT_FORCE_QVGA unsure what this does
SDL_QT_ROTATION_ENV_NAME supposedly affects how the screen is rotated

Which SDL ipkgs should I install?

As mentioned earlier, there are several SDL ipkgs out there. And they may not all be compatible with your desired application.

It also may be desirable to keep an alternative version of SDL around in case your primary fails to run a certain app. For instance, I installed the bvdd version of SDL. There are a couple of apps that won't run with it, so I copied a 'qtopia' version of SDL to a separate directory. Before I run an app that won't work with the bvdd version, I set the LD_LIBRARY_PATH variable to point to the directory with my alternative SDL. E.g.:

export LD_LIBRARY_PATH=/mnt/cf/altlibs

This can be put in a script that launches the application which gets called from the palmtop environment.

Ideally, it would be nice to have an SDL library that includes both the qtopia and bvdd driver, but naming conflicts prevent it from being compiled that way.

Personal tools