From owner-freebsd-x11@FreeBSD.ORG Wed Sep 24 03:25:18 2008 Return-Path: Delivered-To: freebsd-x11@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 640AE1065676 for ; Wed, 24 Sep 2008 03:25:18 +0000 (UTC) (envelope-from callumgibson@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 001AA8FC15 for ; Wed, 24 Sep 2008 03:25:17 +0000 (UTC) (envelope-from callumgibson@optusnet.com.au) Received: from omma.gibson.athome (c122-106-69-195.rivrw1.nsw.optusnet.com.au [122.106.69.195]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with SMTP id m8O3PFBJ003671 for ; Wed, 24 Sep 2008 13:25:16 +1000 Received: (qmail 26378 invoked by uid 107); 24 Sep 2008 13:25:14 +1000 Date: 24 Sep 2008 13:25:14 +1000 Date: Wed, 24 Sep 2008 13:25:14 +1000 From: Callum Gibson To: freebsd-x11@freebsd.org Message-ID: <20080924032514.GA19313@omma.gibson.athome> References: <20080903204028.GA17408@omma.gibson.athome> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080903204028.GA17408@omma.gibson.athome> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Working! (was Re: Matrox G550 fails dual-head, used to work) X-BeenThere: freebsd-x11@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: X11 on FreeBSD -- maintaining and support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Sep 2008 03:25:18 -0000 On 04Sep08 06:40, Callum Gibson wrote: }to be willing to do), the only other option is to use the linux binary }driver from the ports. This also used to work, and apparently people have }it working under 6.X, but under 7.X you get: } }http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/117907 } }I'm beginning to think this will be the only way to get dual dvi going }for matrox cards, but it seems to involve addressing a problem with the }linuxulator which I don't yet understand. I've worked out how to get the linux mga_hal driver to work under 7.X and now have dual DVI screens working with my G550 again! It turns out to have nothing to do with linux emulation at all. Apparently mga_hal only ever worked because Xorg loaded in the linux .so files directly, and likewise the linux libs pulled in the FreeBSD libc.so.6, not the linux libc - no emulation required. This is arguably not meant to work, but I guess both systems use gcc and there are no system calls so it happens to work. Ok, so after installing mga_hal from ports you'll have 2 new .so files in /usr/local/lib/modules/drivers. You'll need to symlink or copy these to where Xorg 7.3 expects to find them, which is /usr/local/lib/xorg/modules/drivers. Note, if you have xf86-video-mga installed you might want to back up the previous version of mga_drv.so. You might also want to copy the files so if you make a mistake and mangle the mga_hal libraries you can start again. One this is done, you should see the GLIBC dependency error as per PR 117907 when you try to start Xorg. For whatever reason, something in the runtime linker has changed between FreeBSD 6.X and 7.X so that it picks up a version dependency in mga_drv.so and mga_hal_drv.so, even though it's marked as a weak symbol from what I can tell. You can see this by running: % readelf -V /usr/local/lib/xorg/modules/drivers/mga_drv.so At the bottom you will see: Version needs section '.gnu.version_r' contains 1 entries: Addr: 0x0000000000003de0 Offset: 0x003de0 Link to section: 3 (.dynstr) 000000: Version: 1 File: libc.so.6 Cnt: 1 0x0010: Name: GLIBC_2.1.3 Flags: none Version: 2 You can run the following to see all the version info that is causing problems. % readelf -a /usr/local/lib/xorg/modules/drivers/mga_drv.so |grep VER [ 4] .gnu.version VERSYM 00003aee 003aee 0002f0 02 A 2 0 2 [ 5] .gnu.version_r VERNEED 00003de0 003de0 000020 00 A 3 1 4 0x6ffffffe (VERNEED) 0x3de0 0x6fffffff (VERNEEDNUM) 1 0x6ffffff0 (VERSYM) 0x3aee Now, you need to hack both the linux .so files to eliminate this dependency. Eliminating the version sections is the easy bit. As root from /usr/local/lib/xorg/modules/drivers... # objcopy -R .gnu.version -R .gnu.version_r mga_drv.so # objcopy -R .gnu.version -R .gnu.version_r mga_hal_drv.so We also need to remove references to those sections from the Dynamic segment so the linker doesn't still go looking for them. You can find the relevant parts by doing this: The first hex number should be the same (maps to the tag type), but the second column of numbers (the value) might be different depending on your library. You will see the same tags in mga_hal_drv.so (with different values again). Now for the tricky bit. You need to edit the .so file with a hex editor (eg. editors/hexedit in port) and search for the tags. Note, in hexedit, the tag's hex value is byte-swapped on little endian machines. So I search for feffff6f (rather than 6ffffffe) to find the VERNEED tag and after that you will see (using my values above) "E0 3D". Here is the whole relevant line as displayed in hexedit: 000354C0 FE FF FF 6F E0 3D 00 00 FF FF FF 6F 01 00 00 00 F0 FF FF 6F EE 3A You need to null out the tag and values entirely. In other words write over "FE FF FF 6F E0 3D" with zeroes. Likewise "FF FF FF 6F 01" and "F0 FF FF 6F EE 3A". After saving, try: % readelf -a /usr/local/lib/xorg/modules/drivers/mga_drv.so |grep VER again, and there should be no output. Repeat editing on mga_hal_drv.so. As per other posts on this issue, you can now run Xorg -ignoreABI and it will successfully load up the linux .so files, and resolve the libc.so.6 reference against compat6x's libc.so.6 in /usr/local/lib/compat. You'll probably still need an appropriate xorg.conf for xinerama to work, but you should not have the GLIBC fatal error. The only other issue I have had since is that I noticed my window titles weren't redrawing properly and then starting firefox caused a crash. I removed BackingStore option, which I'd inherited from someone's xorg.conf, and that seems to have fixed the problem. So far, so good. All the other usual stuff is there, including subpixel rendering for font smoothing. I'm not sure if there is a way to do that hexediting in ports for 7.X machines or if a pre-hacked version of the libs could be distributed. C -- Callum Gibson @ home http://members.optusnet.com.au/callumgibson/