tech-x11 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

xsrc dri patch



Attached is a patch to fix some problems with the xorg dri modules.
The patch does the following:

 1) Add include directories to external/mit/xorg/lib/dri/libmesa/Makefile
    so that the dri modules and libmesa use the same struct GLcontext.
    Otherwise they are different and programs such as glxinfo may experience
    segmentation faults.

 2) Make libmesa an installed shared library (module). This code is shared
    by all the dri modules and results in a saving of roughly 1.8MB per module.

 3) Adds the appropriate dependencies to external/mit/xorg/lib/dri/dri.mk.

I think at least the include directories in libmesa/Makefile and
dependencies in dri.mk need to be added for the dri modules to
compile correctly.

Is this acceptable?

--
Kind regards,

Yorick Hardy

This email and all contents are subject to the following disclaimer:

http://www.uj.ac.za/UJ_email_legal_disclaimer.htm
--- ./external/mit/xorg/lib/dri/libmesa/Makefile.orig   2009-02-09 
22:31:23.000000000 +0200
+++ ./external/mit/xorg/lib/dri/libmesa/Makefile        2009-02-11 
16:46:52.000000000 +0200
@@ -2,12 +2,22 @@
 
 .include <bsd.own.mk>
 
-LIB=           mesa
-LIBISPRIVATE=  yes
-NOSTATICLIB=   # defined
+LIB=           mesa_dri
+LIBISMODULE=   yes
+
+SHLIB_MAJOR=   0
 
 MESA_SRC_MODULES=      main math vbo tnl shader swrast slang
 
+CPPFLAGS+=     -I${X11SRCDIR.MesaLib}/src/mesa/main \
+               -I${X11SRCDIR.MesaLib}/src/mesa/glapi \
+               -I${X11SRCDIR.MesaLib}/src/mesa/shader \
+               -I${X11SRCDIR.MesaLib}/src/mesa/drivers/dri/common \
+               -I${X11SRCDIR.MesaLib}/src/mesa \
+               -I${X11SRCDIR.MesaLib}/include \
+               -I${DESTDIR}${X11INCDIR}/X11/drm \
+               -I${DESTDIR}${X11INCDIR}/X11
+
 CPPFLAGS+=     ${X11FLAGS.THREADLIB} \
                -DPTHREADS -D_NETBSD_SOURCE -DUSE_EXTERNAL_DXTN_LIB=1 \
                -DHAVE_ALIAS
@@ -16,4 +26,7 @@
 .include "../../libOSMesa/libmesa.mk"
 
 .include <bsd.x11.mk>
+
+LIBDIR=                ${X11USRLIBDIR}/modules/dri
+
 .include <bsd.lib.mk>
--- ./external/mit/xorg/lib/dri/dri.mk.orig     2009-02-11 10:47:01.000000000 
+0200
+++ ./external/mit/xorg/lib/dri/dri.mk  2009-02-11 16:23:14.000000000 +0200
@@ -37,17 +37,11 @@
 LIB=           ${MODULE}_dri
 LIBDIR=                ${X11USRLIBDIR}/modules/dri
 
-.if !defined(_LIBMESAOBJDIR)
-_LIBMESAOBJDIR!=       cd ${NETBSDSRCDIR}/external/mit/xorg/lib/dri/libmesa \
-                       && ${PRINTOBJDIR}
-.endif
-
-.if ${MKPICLIB} != "no"
-LIBMESA=       mesa_pic
-.else
-LIBMESA=       mesa
-.endif
-LDADD+=        -L${_LIBMESAOBJDIR} -l${LIBMESA}
-DPADD+=        ${_LIBMESAOBJDIR}/lib${LIBMESA}.a
+LIBDPLIBS+=    drm             ${.CURDIR}/../../libdrm
+LIBDPLIBS+=    expat           ${.CURDIR}/../../expat
+LIBDPLIBS+=    m               ${NETBSDSRCDIR}/lib/libm
+LIBDPLIBS+=    mesa_dri        ${.CURDIR}/../libmesa
+# to find mesa_dri.so
+LDFLAGS+=      -Wl,-rpath,${LIBDIR}
 
 .include <bsd.lib.mk>
--- ./external/mit/xorg/lib/Makefile.orig       2009-02-11 10:47:01.000000000 
+0200
+++ ./external/mit/xorg/lib/Makefile    2009-02-11 10:47:19.000000000 +0200
@@ -2,10 +2,10 @@
 
 # build libraries for xorg
 
-SUBDIR=        dri expat libfontenc freetype libFS libICE libOSMesa \
+SUBDIR=        expat libfontenc freetype libFS libICE libOSMesa \
        libXau libXdmcp libdrm pixman xkbdata \
        .WAIT \
-       fontconfig libSM libX11 liblbxutil \
+       dri fontconfig libSM libX11 liblbxutil \
        .WAIT \
        libXcomposite libXdamage libXext libXfixes libXt \
        libxkbfile \
--- ./distrib/sets/lists/xserver/md.amd64.orig  2009-02-12 10:04:55.000000000 
+0200
+++ ./distrib/sets/lists/xserver/md.amd64       2009-02-12 14:11:47.000000000 
+0200
@@ -364,6 +364,8 @@
 ./usr/X11R7/lib/modules/dri/mach64_dri.so.0            -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/mga_dri.so                 -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/mga_dri.so.0               -unknown-       xorg
+./usr/X11R7/lib/modules/dri/mesa_dri.so                        -unknown-       
xorg
+./usr/X11R7/lib/modules/dri/mesa_dri.so.0              -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/r128_dri.so                        -unknown-       
xorg
 ./usr/X11R7/lib/modules/dri/r128_dri.so.0              -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/r200_dri.so                        -unknown-       
xorg
--- ./distrib/sets/lists/xserver/md.i386.orig   2009-02-12 10:04:55.000000000 
+0200
+++ ./distrib/sets/lists/xserver/md.i386        2009-02-12 14:11:47.000000000 
+0200
@@ -398,6 +398,8 @@
 ./usr/X11R7/lib/modules/dri/mach64_dri.so.0            -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/mga_dri.so                 -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/mga_dri.so.0               -unknown-       xorg
+./usr/X11R7/lib/modules/dri/mesa_dri.so                        -unknown-       
xorg
+./usr/X11R7/lib/modules/dri/mesa_dri.so.0              -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/r128_dri.so                        -unknown-       
xorg
 ./usr/X11R7/lib/modules/dri/r128_dri.so.0              -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/r200_dri.so                        -unknown-       
xorg
--- ./distrib/sets/lists/xserver/md.macppc.orig 2009-01-05 12:51:24.000000000 
+0200
+++ ./distrib/sets/lists/xserver/md.macppc      2009-02-12 14:11:47.000000000 
+0200
@@ -321,6 +321,8 @@
 ./usr/X11R7/lib/modules/dri/mach64_dri.so.0            -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/mga_dri.so                 -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/mga_dri.so.0               -unknown-       xorg
+./usr/X11R7/lib/modules/dri/mesa_dri.so                        -unknown-       
xorg
+./usr/X11R7/lib/modules/dri/mesa_dri.so.0              -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/r128_dri.so                        -unknown-       
xorg
 ./usr/X11R7/lib/modules/dri/r128_dri.so.0              -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/r200_dri.so                        -unknown-       
xorg
--- ./distrib/sets/lists/xserver/md.sparc.orig  2009-02-12 10:04:55.000000000 
+0200
+++ ./distrib/sets/lists/xserver/md.sparc       2009-02-12 14:11:47.000000000 
+0200
@@ -290,6 +290,8 @@
 ./usr/X11R7/lib/modules/dri/mach64_dri.so.0            -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/mga_dri.so                 -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/mga_dri.so.0               -unknown-       xorg
+./usr/X11R7/lib/modules/dri/mesa_dri.so                        -unknown-       
xorg
+./usr/X11R7/lib/modules/dri/mesa_dri.so.0              -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/r128_dri.so                        -unknown-       
xorg
 ./usr/X11R7/lib/modules/dri/r128_dri.so.0              -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/r200_dri.so                        -unknown-       
xorg
--- ./distrib/sets/lists/xserver/md.sparc64.orig        2009-02-12 
10:04:55.000000000 +0200
+++ ./distrib/sets/lists/xserver/md.sparc64     2009-02-12 14:11:47.000000000 
+0200
@@ -289,6 +289,8 @@
 ./usr/X11R7/lib/modules/dri/mach64_dri.so.0            -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/mga_dri.so                 -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/mga_dri.so.0               -unknown-       xorg
+./usr/X11R7/lib/modules/dri/mesa_dri.so                        -unknown-       
xorg
+./usr/X11R7/lib/modules/dri/mesa_dri.so.0              -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/r128_dri.so                        -unknown-       
xorg
 ./usr/X11R7/lib/modules/dri/r128_dri.so.0              -unknown-       xorg
 ./usr/X11R7/lib/modules/dri/r200_dri.so                        -unknown-       
xorg


Home | Main Index | Thread Index | Old Index