Problems with fullscreen + Xinerama

When using multiple monitors in TwinView (Xinerama) mode, I have a
problem with fullscreen. SDL insists on centering the display between
the monitors, and it seems to be impossible to tell SDL to use just one
monitor. The environment variable SDL_VIDEO_FULLSCREEN_DISPLAY is
apparently there to fix this, but it has absolutely no effect, despite
SDL being built with xinerama support.

I have attached a minimal SDL fullscreen program (fullscreen.c):

$ gcc sdl-config --cflags fullscreen.c sdl-config --libs
$ export SDL_VIDEO_FULLSCREEN_DISPLAY=0
$ ./a.out

The displayed picture is still split between the monitors. Also tried
setting the environment variable to “1”, but no difference.

I’m using a GeForce GTX 280 card with NVIDIA’s own drivers
(v260.19.36). The SDL library is 1.2.14-10.fc14 (i.e., the one included
with Fedora 14). I can confirm that it is compiled with Xinerama
support:

$ strings /usr/lib64/libSDL.so | grep SDL_VIDEO_FULLSCREEN
SDL_VIDEO_FULLSCREEN_HEAD
SDL_VIDEO_FULLSCREEN_DISPLAY

(These would have been #ifdef’d away if SDL_VIDEO_DRIVER_X11_XINERAMA
was not set, so the library is properly built.)

Any ideas on how to fix this?–
Haakon
-------------- next part --------------
#include <SDL.h>

int main()
{
SDL_Event event;
SDL_Surface *screen;
int w = 1920, h = 1200, bpp = 24;
int y;

SDL_Init(SDL_INIT_VIDEO);
screen = SDL_SetVideoMode(w, h, bpp, SDL_HWSURFACE | SDL_FULLSCREEN);

for (y = 0; y < h; y++) {
    int offset = y * screen->pitch;
    unsigned char *pixels = (unsigned char *) screen->pixels + offset;
    memset(pixels, y & 0xff, w * bpp/8);
}
SDL_Flip(screen);

while (SDL_WaitEvent(&event)) {
    if (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_ESCAPE) {
        break;
    }
}
SDL_Quit();

return 0;

}

Never mind, I figured out why the environment variable wasn’t working:
nvidia-settings hadn’t added a single-monitor metamode to xorg.conf.

In the “screen” section, I used to have this:

Option “metamodes” “CRT: nvidia-auto-select +1920+0, DFP:
nvidia-auto-select +0+0”

I added “; DFP: 1920x1200” to it, and now I can set
SDL_VIDEO_FULLSCREEN_DISPLAY=0 to make it work.On Sat, 14 May 2011 12:54:45 +0200, Haakon Riiser <@Haakon_Riiser> wrote:

When using multiple monitors in TwinView (Xinerama) mode, I have a
problem with fullscreen. SDL insists on centering the display between
the monitors, and it seems to be impossible to tell SDL to use just
one monitor. The environment variable SDL_VIDEO_FULLSCREEN_DISPLAY is
apparently there to fix this, but it has absolutely no effect,
despite
SDL being built with xinerama support.


Haakon