xf86-video-intel: src/intel_glamor.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Mar 12 11:43:44 PDT 2013


 src/intel_glamor.c |   37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

New commits:
commit 50374fb4947e6682b6c8aced639b422110b6ec98
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Mar 12 18:39:07 2013 +0000

    uxa/glamor: Prevent a crash when trying to load a misconfigured glamor
    
    Glamor requires that glamoregl is explicitly loaded via Section "Module"
    or else it currently crashes.
    
    Based on a patch by Michel Dänzer for xf86-video-ati.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_glamor.c b/src/intel_glamor.c
index 55eb2de..0c4e3a7 100644
--- a/src/intel_glamor.c
+++ b/src/intel_glamor.c
@@ -72,6 +72,18 @@ intel_glamor_create_screen_resources(ScreenPtr screen)
 	return TRUE;
 }
 
+static Bool
+intel_glamor_enabled(intel_screen_private *intel)
+{
+	const char *s;
+
+	s = xf86GetOptValString(intel->Options, OPTION_ACCEL_METHOD);
+	if (s == NULL)
+		return FALSE;
+
+	return strcasecmp(s, "glamor") == 0;
+}
+
 Bool
 intel_glamor_pre_init(ScrnInfoPtr scrn)
 {
@@ -79,6 +91,16 @@ intel_glamor_pre_init(ScrnInfoPtr scrn)
 	pointer glamor_module;
 	CARD32 version;
 
+	if (!intel_glamor_enabled(intel))
+		return TRUE;
+
+	if (!xf86LoaderCheckSymbol("glamor_egl_init")) {
+		xf86DrvMsg(scrn->scrnIndex,  X_ERROR,
+			   "glamor requires Load \"glamoregl\" in "
+			   "Section \"Module\", disabling.\n");
+		return TRUE;
+	}
+
 	/* Load glamor module */
 	if ((glamor_module = xf86LoadSubModule(scrn, GLAMOR_EGL_MODULE_NAME))) {
 		version = xf86GetModuleVersion(glamor_module);
@@ -173,18 +195,6 @@ intel_glamor_finish_access(PixmapPtr pixmap, uxa_access_t access)
 	return;
 }
 
-static Bool
-intel_glamor_enabled(intel_screen_private *intel)
-{
-	const char *s;
-
-	s = xf86GetOptValString(intel->Options, OPTION_ACCEL_METHOD);
-	if (s == NULL)
-		return FALSE;
-
-	return strcasecmp(s, "glamor") == 0;
-}
-
 Bool
 intel_glamor_init(ScreenPtr screen)
 {
@@ -194,9 +204,6 @@ intel_glamor_init(ScreenPtr screen)
 	if ((intel->uxa_flags & UXA_GLAMOR_EGL_INITIALIZED) == 0)
 		goto fail;
 
-	if (!intel_glamor_enabled(intel))
-		goto fail;
-
 	if (!glamor_init(screen, GLAMOR_INVERTED_Y_AXIS | GLAMOR_USE_EGL_SCREEN)) {
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
 			   "Failed to initialize glamor.\n");


More information about the xorg-commit mailing list