[Mesa-dev] [PATCH] DRI2: check DRI2 protocol version before advertising swap related extensions
Jesse Barnes
jbarnes at virtuousgeek.org
Mon Apr 26 11:19:32 PDT 2010
Should fix the mis-reporting people are seeing with DDX drivers that
don't support the new DRI2 protocol yet.
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 9347611..837afe8 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -644,7 +644,7 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
}
driBindCommonExtensions(psc);
- dri2BindExtensions(psc);
+ dri2BindExtensions(psc, pdp->driMajor, pdp->driMinor);
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index dbc6082..9b22aba 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -375,7 +375,7 @@ driBindExtensions(__GLXscreenConfigs *psc)
/* Bind DRI2 specific extensions */
_X_HIDDEN void
-dri2BindExtensions(__GLXscreenConfigs *psc)
+dri2BindExtensions(__GLXscreenConfigs *psc, int dri2_major, int dri2_minor)
{
const __DRIextension **extensions;
int i;
@@ -390,12 +390,12 @@ dri2BindExtensions(__GLXscreenConfigs *psc)
}
#endif
- __glXEnableDirectExtension(psc, "GLX_SGI_video_sync");
- __glXEnableDirectExtension(psc, "GLX_SGI_swap_control");
- __glXEnableDirectExtension(psc, "GLX_MESA_swap_control");
-
- /* FIXME: if DRI2 version supports it... */
- __glXEnableDirectExtension(psc, "INTEL_swap_event");
+ if (dri2_major == 1 && dri2_minor >= 2) {
+ __glXEnableDirectExtension(psc, "GLX_SGI_video_sync");
+ __glXEnableDirectExtension(psc, "GLX_SGI_swap_control");
+ __glXEnableDirectExtension(psc, "GLX_MESA_swap_control");
+ __glXEnableDirectExtension(psc, "INTEL_swap_event");
+ }
#ifdef __DRI2_FLUSH
if ((strcmp(extensions[i]->name, __DRI2_FLUSH) == 0)) {
diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h
index bb178db..6bac584 100644
--- a/src/glx/dri_common.h
+++ b/src/glx/dri_common.h
@@ -57,7 +57,8 @@ extern void ErrorMessageF(const char *f, ...);
extern void *driOpenDriver(const char *driverName);
extern void driBindExtensions(__GLXscreenConfigs * psc);
-extern void dri2BindExtensions(__GLXscreenConfigs * psc);
+extern void dri2BindExtensions(__GLXscreenConfigs * psc, int dri2_major,
+ int dri2_minor);
extern void driBindCommonExtensions(__GLXscreenConfigs * psc);
#endif /* _DRI_COMMON_H */
More information about the mesa-dev
mailing list