Bug 14675 - mythfrontend crashes in glXMakeCurrentReadSGI()
Summary: mythfrontend crashes in glXMakeCurrentReadSGI()
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: GLX (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact:
URL: http://svn.mythtv.org/trac/ticket/4603
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-25 21:55 UTC by Timo Aaltonen
Modified: 2009-09-17 17:07 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Timo Aaltonen 2008-02-25 21:55:15 UTC
Bug forwarded from launchpad.net, originally from the mythtv tracker:

Upstream MythTV indicated that this is actually a bug in mesa. Quoting on MythTV #4206: http://svn.mythtv.org/trac/ticket/4603

For anyone keeping score at home various myth threads open and close the display for local queries. Inside X11 this eventually works its way down to dri_glx.c::OpenDriver? which dlopen's the correct .so on the first call. Subsequent calls get the handle from that initial dlopen.

Unfortunately this doesn't increment the reference count for the .so and a dlclose at the first nested XOpenDisplay/XCloseDisplay (like in libmythtv's get_glx_version) causes the dri library to be unloaded and soon after that MythTV go boom. The unload message in the initial report turned out to be the key, something I realized moments after submitting the bug.

The quick fix, and this is Linux-specific, is to tweak the inital search at the top of OpenDriver? in mesa's dri_glx.c.

+--- mesa-7.0.2.orig/src/glx/x11/dri_glx.c	2008-02-21 18:37:58.000000000 -0600
++++ mesa-7.0.2/src/glx/x11/dri_glx.c	2008-02-21 18:39:13.000000000 -0600
+@@ -48,6 +48,7 @@
+ #include "dri_glx.h"
+ #include <sys/types.h>
+ #include <stdarg.h>
++#include <link.h>
+ 
+ #ifndef RTLD_NOW
+ #define RTLD_NOW 0
+@@ -198,6 +199,8 @@
+    for (driver = Drivers; driver; driver = driver->next) {
+       if (strcmp(driver->name, driverName) == 0) {
+          /* found it */
++         char *libPath = ((struct link_map *)(driver->handle))->l_name;
++         dlopen(libPath, RTLD_NOW | RTLD_GLOBAL);
+          return driver;
+       }
+    }
Comment 1 Michel Dänzer 2008-02-26 01:23:58 UTC
Looks like a duplicate of bug 13541, the fix of which was pushed as commit 17afc800c9b69997ae7ba52b67c021f68066e008 (and a followup fix as 62f6e550138ebccbdeb8dd044eabf757d5482126). If you can confirm that these fix the problem, maybe we can backport them to the 7.0 branch.
Comment 2 Timo Aaltonen 2008-02-26 03:52:43 UTC
Cool, I'll add those to the package and ask people to test.
Comment 3 Ian Romanick 2009-09-17 17:07:23 UTC
No reply from submitter in over a year.  Closing as fixed.  If this is not the case, please reopen and add info.

Thanks.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.