Hi Michael,

see attached patch that checks that the GLX version is >= 1.3 before enabling 
TMU emulation. This should prevent QEMU from crashing on platforms that don't 
support pbuffers. Since I have GLX 1.4, I haven't completely tested it, but 
feel free to do so on the machine where the problem was present.

S.
diff --git a/hw/milkymist-hw.h b/hw/milkymist-hw.h
index bc1125a..d8c4c9d 100644
--- a/hw/milkymist-hw.h
+++ b/hw/milkymist-hw.h
@@ -91,14 +91,28 @@ milkymist_tmu2_create(target_phys_addr_t base, qemu_irq irq)
     Display *d;
     GLXFBConfig *configs;
     int nelements;
+    int ver_major, ver_minor;
 
     if (display_type == DT_NOGRAPHIC)
       return NULL;
 
-    /* check if we can access the X server and get a GLX config */
+    /* check that GLX will work */
     d = XOpenDisplay(NULL);
     if (d == NULL)
       return NULL;
+    if (!glXQueryVersion(d, &ver_major, &ver_minor)) {
+        /* Yeah, sometimes getting the GLX version can fail.
+         * Isn't X beautiful? */
+        XCloseDisplay(d);
+        return NULL;
+    }
+    if ((ver_major < 1)||((ver_major == 1) && (ver_minor < 3))) {
+        printf("Your GLX version is %d.%d,"
+          "but TMU emulation needs at least 1.3. TMU disabled.\n",
+          ver_major, ver_minor);
+        XCloseDisplay(d);
+        return NULL;
+    }
     configs = glXChooseFBConfig(d, 0, glx_fbconfig_attr, &nelements);
     if (configs == NULL) {
       XCloseDisplay(d);
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkym...@freenode
Twitter: www.twitter.com/milkymistvj
Ideas? http://milkymist.uservoice.com

Reply via email to