How to display X window running SDL-based game on custom graphics board?

Hi everyone,

(I’m sorry as this isn’t really a purely SDL related question; I
need to find out how to tap into the X server and put an X window
into the framebuffer on my custom graphics hardware in order to
port my code to SDL…)

I am working on an embedded system which requires 2D sprite animation
to be overlayed on a live video feed. I have already written a
device driver for our custom graphics hardware which works in Linux,
and have a highly customized (and highly inflexible, and highly wheel-
reinventing) solution already implemented.

Very simply, I write pixels to the frame buffer memory on our custom
graphics board. The pixels are 32 bit RGBA (red, green, blue, alpha).
The board sits in an ISA slot and has video pass through (that is,
video in and video out; video in comes from a camera or VCR, and the
video out is the sprites blended over the video, with degree of blend
determined using the alpha channel).

Ideally, instead of writing new custom code everytime I need to animate
the sprites in a slightly different manner, I would like to be able
to use one of the videogame libraries such as SDL. So I would let
the library take care of the animation, and then my driver would become
just a way to “tap into” the X server and display the X window running
my sprite animations, on the custom graphics hardware.

So, I have two related questions:

o Is it possible to specify an X window with 32 bpp RGBA values? If
it is then this approach makes a lot of sense; if only 24 bit RGB
pixels are allowed then I would need to keep track of the alphas
on a pixel-by-pixel basis and that might negate a lot of the gains
of going to a video game library.

o Assuming I can specify that the X window running my sprite animation
uses 32 bit RGBA pixels, how do I “tap” the
X framebuffer in order to display the X window on my
custom graphics hardware? In particular, I need to learn how to
only update those pixels of the window that have actually changed
since the last frame. (Our custom graphics hardware uses the old
ISA bus and if I have to update the entire buffer every frame the
frame rate will be literally on the order of 0.3 fps.)

Summary-------
I have created highly customized and inflexible device driver/sprite animation
code to allow custom graphics hardware to do live video blending. I would
like
to instead port the animation portion of my code to a video game library such
as SDL, and run it in an X window; then change my device driver so that it
takes that X window and blits it across to the frame buffer on my custom
graphics hardware (and so blend the non-transparent parts of my X window
over the live video feed).

Alpha blending is crucial; I need to be able to use 32 bit RGBA pixels in
order to properly blend the sprites over the video. Also, I need to
only write the parts of the X window that change each frame to the
custom hardware, which uses an archaic and slow bus.

If anyone has any ideas, or knows of useful websites, newsgroups, technical
papers or email addresses of individuals that have covered such matters
in the past or that might prove helpful, I’d very much appreciate
it if you could please pass them on.

By the way, I have already implemented sound support in my extant code
using SDL, and I really like it. Now I just need to figure out this X
problem to use SDL for everything!

Thanks,

Steve Madsen
H2Eye Ltd
24-28 Hatton Wall
London EC1N 8JH
Tel: +44-171-404-9600
Fax: +44-171-404-9490
Email: @Steve_Madsen