Sdl and tinyx

Am trying to use SDL on our embedded Mips board and am running into some
basic problems. One problem is that I’m new to the X Windows world ;), but
come from years of Quicktime programming so the concepts are not totally
foreign.

The non-display test programs seem to work fine.

When I run any of the display programs I crash the X server. The error comes
when SetVideoMode calls down to into X11_SetupImage. The code sequence is
below, but basically it never comes back from XSync.

Three questions:

  1. We run TinyX, is there any problem with running SDL ontop of TinyX?
  2. Where do I find the documentation on the XShm calls? They’re not in the
    Xlib Programming/Reference Manuals.
  3. What does the NO_SHARED_MEMORY mean? If this is defined, then the XShmXX
    calls aren’t made and the ones from Xlib are. Not sure how this define would
    be set from the configure.

Thanks for any help.

casey-----

int X11_SetupImage(_THIS, SDL_Surface screen)
{
#ifdef NO_SHARED_MEMORY
screen->pixels = malloc(screen->h
screen->pitch);
#else
/* Allocate shared memory if possible /
if ( use_mitshm ) {
shminfo.shmid = shmget(IPC_PRIVATE, screen->h
screen->pitch,
IPC_CREAT|0777);
if ( shminfo.shmid >= 0 ) {
shminfo.shmaddr = (char *)shmat(shminfo.shmid, 0, 0);
shminfo.readOnly = False;
if ( shminfo.shmaddr != (char *)-1 ) {
shm_error = False;
X_handler = XSetErrorHandler(shm_errhandler);
XShmAttach(SDL_Display, &shminfo);
XSync(SDL_Display, True);

            *** this is where the crash happens ****

Casey King wrote:

When I run any of the display programs I crash the X server. The error comes
when SetVideoMode calls down to into X11_SetupImage. The code sequence is
below, but basically it never comes back from XSync.

Generally the X server should never crash regardless of what you throw at it,
or it is a bug in that server

  1. Where do I find the documentation on the XShm calls? They’re not in the
    Xlib Programming/Reference Manuals.

They are documented separately (the MIT-SHM extension). I happen to have
a text-formatted version; look in ftp://ptah.lnf.kth.se/pub/misc/mit-shm.txt.gz

  1. What does the NO_SHARED_MEMORY mean? If this is defined, then the XShmXX
    calls aren’t made and the ones from Xlib are. Not sure how this define would
    be set from the configure.

It’s defined from the compile line if the configure script thinks that
the host does not support system V style shared memory

I know of no particular successes or failures with TinyX so you are on
your own. MIT-SHM is somewhat tricky to set up correctly since some errors
only come asynchronously (hence the dance with the error handlers and XSync).
If you can isolate the problem to either an X server bug (and the user code
needed to trig it) or an SDL bug, it would be great