In Mesa 9.1 and current git, I cannot use eglSwapInterval with anything but 0: The value is always clamped to 0. Querying EGL_MAX_SWAP_INTERVAL shows that the driver indeed does not allow for any other value. As expected, this means applications are not v-synced. However, with Mesa 9.0 (and an otherwise unchanged setup), EGL_MAX_SWAP_INTERVAL is 1000 and v-syncing works all right. I compiled mesa from the current git repository with the following configure options: ./autogen.sh --with-dri-drivers=i965 --with-gallium-drivers= nice make -j5 Then I set the environment variables LIBGL_DRIVERS_PATH=$HOME/src/mesa/lib LD_LIBRARY_PATH=$HOME/src/mesa/lib I ran a simple GL test application of mine which you can find at http://www.ralfj.de/git/gltest.git . Calling "egltest -i 1" causes the application to set the swap interval, after checking whether this value is between MIN_SWAP_INTERVAL and MAX_SWAP_INTERVAL and aborting if this is not the case. Using the 9.0 branch (3d80d54b), the swap function behaves as expected and egltest runs fine. However, with the 9.1 branch (980f84c3) and current master (4de70bf4), I experience the bug described above and egltest aborts. I did a git bisect, with the following result: 7e9bd2b2ed35a440a96362417100a7e43715d606 is the first bad commit commit 7e9bd2b2ed35a440a96362417100a7e43715d606 Author: Eric Anholt <eric@anholt.net> Date: Tue Sep 25 14:05:30 2012 -0700 egl: Add support for driconf control of swapinterval. This behavior mostly matches glx_dri2. It's slightly complicated in comparison because EGL exposes the implementation limits in the EGL config. Note that platform_x11 was the only one setting swap_available, so the move of the MaxSwapInterval into it is appropriate. Acked-by: Chad Versace <chad.versace@linux.intel.com> :040000 040000 0a3b039e33c0b74c8d5ead726c30315addadef72 0ccd0a22c077d21003853b6f83e67789f9f0ca77 M src I am using Debian testing with a self-compiled vanilla 3.8.5 kernel. Other than that, I use the distribution packages. My GPU is the one built-in my Core i5-2450M (Sandy Bridge), I believe that's an HD2000.
I found the problem: In platform_x11.c, dri2_initialize_x11_dri2, the function dri2_add_configs_for_visuals (which sets the maximum swap interval of the EGLConfigs) is called before dri2_setup_swap_interval, so dri2_dpy->max_swap_interval is still 0 when the config is created. Later, it is changed, but that does not reflect in the EGLConfigs. I can fix the issue locally by moving the call of dri2_setup_swap_interval before the one to dri2_add_configs_for_visuals, but not knowing this codebase at all, I do not know whether everything is actually properly initialised for dri2_setup_swap_interval to be safe to call. All I know is that it does not crash here ;-) and applications can be v-sync'ed again.
Created attachment 77661 [details] [review] this patch fixes the issue for me, but I don't know whether it's actually safe to call dri2_setup_swap_interval that early
(In reply to comment #2) > Created attachment 77661 [details] [review] [review] > this patch fixes the issue for me, but I don't know whether it's actually > safe to call dri2_setup_swap_interval that early Your patch looks good to me. I'll submit it to the mesa-dev list. Your patch, though, only fixes X11. I'll follow up with a similar fix for Wayland. Embarassingly, I recall seeing this bug when I reviewed the guity commit long ago. But, that was a busy day and I forgot about the bug.
Change to RESOLVED/FIXED. Ralf's patch is committed to master as commit 3998f8c6b5da1a223926249755e54d8f701f81ab Author: Ralf Jung <post@ralfj.de> Date: Tue Apr 9 14:09:50 2013 +0200 egl/x11: Fix initialisation of swap_interval The EGLConfig attributes EGL_MIN/MAX_SWAP_INTERVAL were incorrectly set to 0 and 0. This prevented clients from setting the swap interval to a reasonable value, like 1 or 2. Swap interval worked correctly in Mesa 9.0. The commit below introduced the bug. commit 7e9bd2b2ed35a440a96362417100a7e43715d606 Author: Eric Anholt <eric@anholt.net> Date: Tue Sep 25 14:05:30 2012 -0700 egl: Add support for driconf control of swapinterval. Note: This is a candidate for the 9.1 branch. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63078 [chadv: Wrote commit message] Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Reviewed-by: Eric Anholt <eric@anholt.net>
Ralf, please verify that the bug is fixed on master, then change the bug status to CLOSED.
The bug is gone - thanks a lot :)
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.