From owner-freebsd-x11@FreeBSD.ORG Tue Feb 22 21:05:37 2005 Return-Path: Delivered-To: freebsd-x11@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 99BA916A4CF for ; Tue, 22 Feb 2005 21:05:37 +0000 (GMT) Received: from mail.gmx.net (pop.gmx.de [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 15C6643D48 for ; Tue, 22 Feb 2005 21:05:36 +0000 (GMT) (envelope-from fxkuehl@gmx.de) Received: (qmail invoked by alias); 22 Feb 2005 21:05:33 -0000 Received: from dialin-212-144-009-100.arcor-ip.net (EHLO trabant) (212.144.9.100) by mail.gmx.net (mp020) with SMTP; 22 Feb 2005 22:05:33 +0100 X-Authenticated: #7318305 Received: from trabant ([127.0.0.1] ident=felix) by trabant with esmtp (Exim 3.36 #1 (Debian)) id 1D3hGI-0001nw-00; Tue, 22 Feb 2005 22:08:06 +0100 From: Felix =?ISO-8859-1?Q?K=FChling?= To: Mikhail Teterin In-Reply-To: <200502221710.j1MH9a5v009787@harik.murex.com> References: <200502220508.j1M58MAN094098@corbulon.video-collage.com> <1109078622.3320.2.camel@trabant> <200502221710.j1MH9a5v009787@harik.murex.com> Content-Type: multipart/mixed; boundary="=-F9sq+sEiv6SE5fhEmTl3" Date: Tue, 22 Feb 2005 22:08:05 +0100 Message-Id: <1109106485.6323.13.camel@trabant> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3 X-Y-GMX-Trusted: 0 cc: freebsd-x11@freebsd.org cc: freebsd-gnats-submit@freebsd.org cc: acardenas@bsdperu.org Subject: Re: ports/76257: nvidia_driver breaks xorg-clients build X-BeenThere: freebsd-x11@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: X11 on FreeBSD -- maintaining and support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Feb 2005 21:05:37 -0000 --=-F9sq+sEiv6SE5fhEmTl3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Am Dienstag, den 22.02.2005, 12:19 -0500 schrieb Mikhail Teterin: > > It was already changed in my patch. Do you have any better suggestions? >=20 > Not really... >=20 > > As I mentioned in an earlier mail, the GLX headers from Xorg don't seem > > to define the ARB function any more. >=20 > 6.8.1 still has it. Not sure about 6.8.2. In that case, the following lit= tle=20 > hunk: >=20 > +#ifndef GLX_VERSION_1_4 > +# define glXGetProcAddress glXGetProcAddressARB > +#endif >=20 > seems less intrusive :-) The utility will still not *work* when compiled=20 > against GLX-1.3 headers, but it will *compile*. >=20 > To allow for -lGL to be interchangible post-build, however, it may be req= uired=20 > to make a dlopen/dlsym search for the glXGetProcAddress symbol at run-tim= e. >=20 > Would you like a patch? It will, unavoidably, system-specific, but should= work=20 > on most (all?) systems supported by Xorg. You will also be able to remove= =20 > this hack in a few years, when all available GLX implementations are=20 > upgraded. Yours, >=20 > -mi The attached patch (undo my other patch first) implements something like this without actually loading libGL dynamically. It uses dlopen(NULL, ...) to get a handle for the main program (including libGL). I hope this is portable. Does this work for you? Note that the patch also changes the Imakefile. In xc/programs/xdriinfo run this to update the Makefile: make Makefile make depend Then recompile xdriinfo as usual. --=20 | Felix K=FChling http://fxk.de.vu | | PGP Fingerprint: 6A3C 9566 5B30 DDED 73C3 B152 151C 5CC1 D888 E595 | --=-F9sq+sEiv6SE5fhEmTl3 Content-Disposition: attachment; filename=xdriinfo_oldglx2.diff Content-Type: text/x-patch; name=xdriinfo_oldglx2.diff; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit --- ./xdriinfo.c.~1.1.3.1.~ 2004-06-16 11:27:39.000000000 +0200 +++ ./xdriinfo.c 2005-02-22 21:58:15.000000000 +0100 @@ -27,10 +27,13 @@ #include #include #include +#include +typedef void (* glXGetProcAddress_t (const GLubyte *procname)) (void); typedef const char * glXGetScreenDriver_t (Display *dpy, int scrNum); typedef const char * glXGetDriverConfig_t (const char *driverName); +glXGetProcAddress_t *GetProcAddress; glXGetScreenDriver_t *GetScreenDriver; glXGetDriverConfig_t *GetDriverConfig; @@ -56,11 +59,33 @@ enum INFO_FUNC func = LIST; char *funcArg = NULL; char *dpyName = NULL; + void *dlHandle; - GetScreenDriver = (glXGetScreenDriver_t *)glXGetProcAddress ("glXGetScreenDriver"); - GetDriverConfig = (glXGetDriverConfig_t *)glXGetProcAddress ("glXGetDriverConfig"); + /* dlopen (NULL, ...) returns a handle for the main program. */ + dlHandle = dlopen (NULL, RTLD_NOW | RTLD_GLOBAL); + if (dlHandle == NULL) { + /* should never happen */ + fprintf (stderr, "Can't dlopen main program.\n"); + return 1; + } + GetProcAddress = (glXGetProcAddress_t *) + dlsym (dlHandle, "glXGetProcAddress"); + if (GetProcAddress == NULL) + GetProcAddress = (glXGetProcAddress_t *) + dlsym (dlHandle, "glXGetProcAddressARB"); + if (GetProcAddress == NULL) { + fprintf (stderr, "Couldn't find glXGetProcAddress[ARB].\n"); + return 1; + } + dlclose (dlHandle); + + GetScreenDriver = (glXGetScreenDriver_t *) + GetProcAddress ((GLubyte*)"glXGetScreenDriver"); + GetDriverConfig = (glXGetDriverConfig_t *) + GetProcAddress ((GLubyte*)"glXGetDriverConfig"); if (!GetScreenDriver || !GetDriverConfig) { - fprintf (stderr, "libGL is too old.\n"); + fprintf (stderr, "libGL does not support the " + "DRI configuration infrastructure.\n"); return 1; } --- ./Imakefile.~1.2.~ 2004-08-28 15:44:48.000000000 +0200 +++ ./Imakefile 2005-02-22 21:50:48.000000000 +0100 @@ -4,7 +4,7 @@ SRCS = xdriinfo.c OBJS = xdriinfo.o - LOCAL_LIBRARIES = $(GLXLIB) $(XLIB) + LOCAL_LIBRARIES = $(GLXLIB) $(XLIB) -ldl DEPLIBS = AllTarget(ProgramTargetName(xdriinfo)) --=-F9sq+sEiv6SE5fhEmTl3--