Bug#582801: libsdl1.2debian-all: SDL_GL_SWAP_CONTROL can't work (video tearing)
Sylvain Beucler
beuc at beuc.net
Sun May 23 18:14:29 UTC 2010
Package: libsdl1.2debian-all
Version: 1.2.14-6
Severity: important
SDL supports SDL_GL_SWAP_CONTROL since 1.2.10:
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
This setting allows the graphics card to update the screen memory in
sync with the physical's screen vertical refresh rate (typically
60Hz).
However, there is a bug, because it does not work under GNU/Linux. I
set this bug to important, because this is the _only_ way to avoid
tearing and jumpy scrolling under X11, and get a truly smooth
animation.
The bug is due to (AFAICT) an implementation mistake: it tries to load
'glXSwapIntervalMESA' or 'glXSwapIntervalSGI' dynamically ('dlsym')
from '/usr/lib/libGL.so.1', while it should load them through
'glXGetProcAddressARB', e.g.:
myfunc = glXGetProcAddressARB("glXSwapIntervalMESA").
To exhibit this behavior:
- the following will fail:
SDL_Init(SDL_INIT_EVERYTHING);
if (SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1) < 0) // since SDL v1.2.10
fprintf(stderr, "SDL_GL_SWAP_CONTROL: %s\n", SDL_GetError());
SDL_Surface* screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 0, SDL_OPENGL|SDL_DOUBLEBUF);
int swap_control = -1;
if (SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL, &swap_control) < 0)
fprintf(stderr, "SDL_GL_SWAP_CONTROL: %s\n", SDL_GetError());
else
printf("SDL_GL_SWAP_CONTROL = %d\n", swap_control);
=> "SDL_GL_SWAP_CONTROL: OpenGL attribute is unsupported on this system"
=> 200Hz FPS and scrolling that "shakes"
- the following will work around the bug:
GLint (*my_glXSwapIntervalMESA) ( unsigned interval );
my_glXSwapIntervalMESA = (GLint (*)(unsigned)) glXGetProcAddressARB("glXSwapIntervalMESA");
my_glXSwapIntervalMESA(1);
=> 60Hz FPS and smooth scrolling
I'm going to attach a scrolling demo so one can test the problem.
I'll also send a mail to the SDL mailing list to get their input.
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing'), (300, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.32-3-686 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages libsdl1.2debian-all depends on:
ii libaa1 1.4p5-38 ascii art library
ii libartsc0 1.5.9-3+b1 aRts sound system C support librar
ii libasound2 1.0.22-2 shared library for ALSA applicatio
ii libc6 2.10.2-6 Embedded GNU C Library: Shared lib
ii libcaca0 0.99.beta17-1 colour ASCII art library
ii libdirectfb-1.2-9 1.2.10.0-3 direct frame buffer graphics - sha
ii libesd0 0.2.41-7 Enlightened Sound Daemon - Shared
ii libncurses5 5.7+20100313-2 shared libraries for terminal hand
ii libpulse0 0.9.21-1 PulseAudio client libraries
ii libslang2 2.2.2-4 The S-Lang programming library - r
ii libsvga1 1:1.4.3-29 console SVGA display libraries
ii libx11-6 2:1.3.3-3 X11 client-side library
libsdl1.2debian-all recommends no packages.
libsdl1.2debian-all suggests no packages.
-- no debconf information
More information about the Pkg-sdl-maintainers
mailing list