Problem with multiple displays under linux with SDL 1.2.x

hello all

first of all - thanks for SDL!

i’ve written a game that uses SDL for creating an OpenGL context under Windows and Linux. while everything seems to work fine on single-monitor systems, i’ve received a report from a linux user that the game actually spans both displays, while he only wants it displayed on the second display.

his setup: “Kubuntu 11.10 x64 with R600g video driver / Laptop Acer 7560G with external FullHD 27” display attached via HDMI. Configured via xrandr."

after some googling i’ve told him to try these variables:

SDL_VIDEO_FULLSCREEN_HEAD
SDL_VIDEO_X11_XINERAMA
SDL_VIDEO_X11_XINERAMA_SCREEN
SDL_VIDEO_X11_XRANDR

but he said even launching the game with SDL_VIDEO_FULLSCREEN_HEAD=1 doesn’t fix the issue…any suggestions?

one issue seems to be that SDL_GetVideoInfo() returns the resolution of BOTH displays combined, i.e. 3520 x 1080 … shouldn’t it return the resolution of the primary display?
(the rationale here is that calling SDL_SetVideoMode(info->current_w, info->current_h, 24, SDL_OPENGL | SDL_FULLSCREEN) should yield a usable fullscreen context on the main display and not some weird problem context that spans two displays)

however that can’t be responsible for all problems seen here as he said even when forcing the game to a lower resolution, windowed mode and FULLSCREEN_HEAD=1 it still spans both displays.

so are there any suggestions how to make SDL work fine with a multi monitor setup on linux?

thanks, julian

btw: it seems like NONE of the environment variables listed above are documented (http://www.libsdl.org/docs/html/sdlenvvars.html). please fix :wink:
-------------- next part --------------
A non-text attachment was scrubbed…
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3729 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20111219/4e8eaafd/attachment.bin

Hi,

One hack is to see the aspect ratio is very wide, and if so use half(or a
division of a standardish aspect if they have 3 monitors) the width. Then
set the position of the window based on that guess. Use the
SDL_VIDEO_WINDOW_POS=“x,y” environment variable to set the position (then
re-init).

Otherwise, SDL 1.2 does not do multiple monitors.

Or wait for SDL 1.3 to be released ; Because that supports multi-monitors
on some platforms.

cu!On Mon, Dec 19, 2011 at 10:08 PM, Julian Mayer wrote:

hello all

first of all - thanks for SDL!

i’ve written a game that uses SDL for creating an OpenGL context under
Windows and Linux. while everything seems to work fine on single-monitor
systems, i’ve received a report from a linux user that the game actually
spans both displays, while he only wants it displayed on the second display.

his setup: “Kubuntu 11.10 x64 with R600g video driver / Laptop Acer 7560G
with external FullHD 27” display attached via HDMI. Configured via xrandr."

after some googling i’ve told him to try these variables:

SDL_VIDEO_FULLSCREEN_HEAD
SDL_VIDEO_X11_XINERAMA
SDL_VIDEO_X11_XINERAMA_SCREEN
SDL_VIDEO_X11_XRANDR

but he said even launching the game with SDL_VIDEO_FULLSCREEN_HEAD=1
doesn’t fix the issue…any suggestions?

one issue seems to be that SDL_GetVideoInfo() returns the resolution of
BOTH displays combined, i.e. 3520 x 1080 … shouldn’t it return the
resolution of the primary display?
(the rationale here is that calling SDL_SetVideoMode(info->current_w,
info->current_h, 24, SDL_OPENGL | SDL_FULLSCREEN) should yield a usable
fullscreen context on the main display and not some weird problem context
that spans two displays)

however that can’t be responsible for all problems seen here as he said
even when forcing the game to a lower resolution, windowed mode and
FULLSCREEN_HEAD=1 it still spans both displays.

so are there any suggestions how to make SDL work fine with a multi
monitor setup on linux?

thanks, julian

btw: it seems like NONE of the environment variables listed above are
documented (http://www.libsdl.org/docs/html/sdlenvvars.html). please fix
:wink:


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi,

One hack is to see the aspect ratio is very wide, and if so use half(or a division of a standardish aspect if they have 3 monitors) the width. Then set the position of the window based on that guess. Use the SDL_VIDEO_WINDOW_POS=“x,y” environment variable to set the position (then re-init).

Otherwise, SDL 1.2 does not do multiple monitors.

Or wait for SDL 1.3 to be released ; Because that supports multi-monitors on some platforms.

hello

thanks for your response, i’m looking forward to a stable SDL 1.3 release.

because i investigated this issue some more i want to clarify on what i previously said.

the problem here was/is a combination of problems in my game, SDL and the MESA driver.

the problem in SDL as previously mentioned is that is reports the resolutions of BOTH displays combined as the current (SDL_GetVideoInfo) resolution. i don’t believe thats thats the way SDL_GetVideoInfo() works on the mac/windows or even on linux with other setups. the other problem the user reported is that SDL is not able to correctly determine all supported resolutions, but i believe this is a known issue under linux.

the problem in MESA is that it doesn’t support FSAA and trying to create a context with FSAA enabled currently always fails with the MESA video drivers.

the problem in my game was that it would always fall back to the current resolution first and as a last resort would disable FSAA. this means context creation would always fail because of FSAA and the resolution would always be changed to the incorrectly reported current resolution that spans both displays, i.e. the symptoms i reported - the game always spanning always both displays even when forcing a lower resolution and forcing SDL_VIDEO_FULLSCREEN_HEAD.

bye, julian
-------------- next part --------------
A non-text attachment was scrubbed…
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3729 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20111220/019b688f/attachment.binAm 20.12.2011 um 18:18 schrieb Ren? Dudfield: