path: root/src/egl/drivers
diff options
authorChad Versace <>2013-04-23 04:17:48 +0200
committerChad Versace <>2013-04-24 08:05:13 +0200
commitd3dfce32768dd698d12948987f93680ce02d465a (patch)
tree53ebc13a423fa41f0c10eecd4778cb9d20846e3d /src/egl/drivers
parentcef31bb290f9fa58b8393e355a0d86a90ee20e14 (diff)
egl/dri2: Fix min/max swap interval of configs
The commit below exposed a bug in dri2_add_config. commit 3998f8c6b5da1a223926249755e54d8f701f81ab Author: Ralf Jung <> Date: Tue Apr 9 14:09:50 2013 +0200 egl/x11: Fix initialisation of swap_interval This little code snippet near the bottom of dri2_add_config, if (double_buffer) { ... conf->base.MinSwapInterval = dri2_dpy->min_swap_interval; conf->base.MaxSwapInterval = dri2_dpy->max_swap_interval; } it never did what it claimed to do. The assignment never changed the value of conf->base.MaxSwapInterval, because dri2_dpy->max_swap_interval was, until the above exposing commit, unitialized here. That is, conf->base.MaxSwapInterval was 0 before and after assignment. Ditto for the min swap interval. Above the troublesome code snippet, the call to _eglFilterArray rejects the config as unmatching if its swap interval bounds differ from the base config's. Before the exposing commit, at the call to _eglFilterArray, the swap interval bounds were always [0,0], and hence no config was rejected due to swap interval. After the exposing commit, _eglFilterArray incorrectly rejected some configs, which prevented dri2_egl_config::dri_double_config from getting set for the rejected config, which resulted in a NULL pointer getting passed into dri2CreateNewDrawable, and then segfault. The solution: set the swap interval bounds before _eglFilterArray. Bugzilla: Tested-by: Lu Hua <> Signed-off-by: Chad Versace <>
Diffstat (limited to 'src/egl/drivers')
1 files changed, 3 insertions, 3 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 06a21d758be..1011f27665a 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -221,6 +221,9 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
base.RenderableType = disp->ClientAPIs;
base.Conformant = disp->ClientAPIs;
+ base.MinSwapInterval = dri2_dpy->min_swap_interval;
+ base.MaxSwapInterval = dri2_dpy->max_swap_interval;
if (!_eglValidateConfig(&base, EGL_FALSE)) {
_eglLog(_EGL_DEBUG, "DRI2: failed to validate config %d", id);
return NULL;
@@ -268,9 +271,6 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
if (double_buffer) {
surface_type &= ~EGL_PIXMAP_BIT;
- conf->base.MinSwapInterval = dri2_dpy->min_swap_interval;
- conf->base.MaxSwapInterval = dri2_dpy->max_swap_interval;
conf->base.SurfaceType |= surface_type;