From 4e8f5c52bb023f48b7503cf13c246f4995d56df7 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Tue, 12 Mar 2013 19:31:58 -0400 Subject: [PATCH] DRI2: HACK: no GLX_INTEL_swap_event if no ScheduleSwap If ddx does not support swap, don't advertise it. This is a hack to work around current xservers which advertise this extension even when it is clearly not supported. When: http://lists.x.org/archives/xorg-devel/2013-February/035449.html is merged in upstream xserver and makes it's way into most distros then this hack can be removed. In the mean time, it is required to allow gnome-shell/clutter/etc to work properly with a DDX driver which does not support ScheduleSwap. Signed-off-by: Rob Clark --- src/glx/dri2_glx.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index c4f6996561e..7ce57751f24 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -1051,11 +1051,16 @@ static const struct glx_context_vtable dri2_context_vtable = { }; static void -dri2BindExtensions(struct dri2_screen *psc, const __DRIextension **extensions, +dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv, const char *driverName) { + const struct dri2_display *const pdp = (struct dri2_display *) + priv->dri2Display; + const __DRIextension **extensions; int i; + extensions = psc->core->getExtensions(psc->driScreen); + __glXEnableDirectExtension(&psc->base, "GLX_SGI_video_sync"); __glXEnableDirectExtension(&psc->base, "GLX_SGI_swap_control"); __glXEnableDirectExtension(&psc->base, "GLX_MESA_swap_control"); @@ -1066,10 +1071,15 @@ dri2BindExtensions(struct dri2_screen *psc, const __DRIextension **extensions, * currently unconditionally enabled. This completely breaks * systems running on drivers which don't support that extension. * There's no way to test for its presence on this side, so instead - * of disabling it uncondtionally, just disable it for drivers - * which are known to not support it. + * of disabling it unconditionally, just disable it for drivers + * which are known to not support it, or for DDX drivers supporting + * only an older (pre-ScheduleSwap) version of DRI2. + * + * This is a hack which is required until: + * http://lists.x.org/archives/xorg-devel/2013-February/035449.html + * is merged and updated xserver makes it's way into distros: */ - if (strcmp(driverName, "vmwgfx") != 0) { + if (pdp->swapAvailable && strcmp(driverName, "vmwgfx") != 0) { __glXEnableDirectExtension(&psc->base, "GLX_INTEL_swap_event"); } @@ -1212,8 +1222,7 @@ dri2CreateScreen(int screen, struct glx_display * priv) goto handle_error; } - extensions = psc->core->getExtensions(psc->driScreen); - dri2BindExtensions(psc, extensions, driverName); + dri2BindExtensions(psc, priv, driverName); configs = driConvertConfigs(psc->core, psc->base.configs, driver_configs); visuals = driConvertConfigs(psc->core, psc->base.visuals, driver_configs); -- 2.30.2