summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/platform_x11.c
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2017-08-05 00:25:46 +0100
committerEmil Velikov <[email protected]>2017-08-10 19:23:31 +0100
commit47b06f5821551375e98699ca8ea41d06dc4ba0e9 (patch)
treec222901e59d22e1af94f0495413837515c43e5a1 /src/egl/drivers/dri2/platform_x11.c
parent4d9b0dcccb81ad10113d9aef52b4c84496e879f1 (diff)
egl: add dri2_setup_swap_interval helper
The current two implementations - X11 and Wayland were identical, barrind the upper limit. Instead of having same code twice - introduce a helper and pass the limit as an argument. Thus as Android/DRM/others get support - they only need to call the function ;-) v2: Rebase on top of keeping ::swap_available Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> (v1)
Diffstat (limited to 'src/egl/drivers/dri2/platform_x11.c')
-rw-r--r--src/egl/drivers/dri2/platform_x11.c37
1 files changed, 6 insertions, 31 deletions
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 4610ec579f5..f9aaf47e7d1 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -1273,9 +1273,9 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
}
static void
-dri2_x11_setup_swap_interval(struct dri2_egl_display *dri2_dpy)
+dri2_x11_setup_swap_interval(_EGLDisplay *disp)
{
- GLint vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1;
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
int arbitrary_max_interval = 1000;
/* default behavior for no SwapBuffers support: no vblank syncing
@@ -1288,34 +1288,9 @@ dri2_x11_setup_swap_interval(struct dri2_egl_display *dri2_dpy)
return;
/* If we do have swapbuffers, then we can support pretty much any swap
- * interval, but we allow driconf to override applications.
+ * interval.
*/
- if (dri2_dpy->config)
- dri2_dpy->config->configQueryi(dri2_dpy->dri_screen,
- "vblank_mode", &vblank_mode);
- switch (vblank_mode) {
- case DRI_CONF_VBLANK_NEVER:
- dri2_dpy->min_swap_interval = 0;
- dri2_dpy->max_swap_interval = 0;
- dri2_dpy->default_swap_interval = 0;
- break;
- case DRI_CONF_VBLANK_ALWAYS_SYNC:
- dri2_dpy->min_swap_interval = 1;
- dri2_dpy->max_swap_interval = arbitrary_max_interval;
- dri2_dpy->default_swap_interval = 1;
- break;
- case DRI_CONF_VBLANK_DEF_INTERVAL_0:
- dri2_dpy->min_swap_interval = 0;
- dri2_dpy->max_swap_interval = arbitrary_max_interval;
- dri2_dpy->default_swap_interval = 0;
- break;
- default:
- case DRI_CONF_VBLANK_DEF_INTERVAL_1:
- dri2_dpy->min_swap_interval = 0;
- dri2_dpy->max_swap_interval = arbitrary_max_interval;
- dri2_dpy->default_swap_interval = 1;
- break;
- }
+ dri2_setup_swap_interval(disp, arbitrary_max_interval);
}
#ifdef HAVE_DRI3
@@ -1359,7 +1334,7 @@ dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay *disp)
dri2_setup_screen(disp);
- dri2_x11_setup_swap_interval(dri2_dpy);
+ dri2_x11_setup_swap_interval(disp);
if (!dri2_dpy->is_different_gpu)
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
@@ -1459,7 +1434,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
dri2_setup_screen(disp);
- dri2_x11_setup_swap_interval(dri2_dpy);
+ dri2_x11_setup_swap_interval(disp);
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
disp->Extensions.NOK_swap_region = EGL_TRUE;