diff options
author | tnn <tnn@pkgsrc.org> | 2015-04-05 17:01:37 +0000 |
---|---|---|
committer | tnn <tnn@pkgsrc.org> | 2015-04-05 17:01:37 +0000 |
commit | 3106a17d9462a04e4345a63c18cef13eaeb5703f (patch) | |
tree | cad1321431079935702dac7fc4c2e0c6a8d6f04b /graphics | |
parent | b2280b6757a9b3377bc7216f90d82f9af77c6e50 (diff) | |
download | pkgsrc-3106a17d9462a04e4345a63c18cef13eaeb5703f.tar.gz |
Re-import the old MesaLib package as graphics/MesaLib7.
Set INSTALLATION_PREFIX to allow this to co-exist with graphics/MesaLib.
This package is here to allow x11/modular-xorg-server112 to find
dri drivers, which it should pick up from /usr/pkg/MesaLib7/lib/dri.
Diffstat (limited to 'graphics')
39 files changed, 1527 insertions, 0 deletions
diff --git a/graphics/MesaLib7/DESCR b/graphics/MesaLib7/DESCR new file mode 100644 index 00000000000..8a8cccf5b97 --- /dev/null +++ b/graphics/MesaLib7/DESCR @@ -0,0 +1,5 @@ +MesaLib is a 3-D graphics library with an API which is very similar to +that of OpenGL*. To the extent that Mesa utilizes the OpenGL command syntax +or state machine, it is being used with authorization from Silicon Graphics, +Inc. However, the author makes no claim that Mesa is in any way a +compatible replacement for OpenGL or associated with Silicon Graphics, Inc. diff --git a/graphics/MesaLib7/Makefile b/graphics/MesaLib7/Makefile new file mode 100644 index 00000000000..331a94eec96 --- /dev/null +++ b/graphics/MesaLib7/Makefile @@ -0,0 +1,145 @@ +# $NetBSD: Makefile,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +DISTNAME?= ${MESA_DISTNAME} +PKGNAME= MesaLib7-${MESA_PKGVERSION} +CATEGORIES= graphics +MASTER_SITES= ${MESA_SITES} +EXTRACT_SUFX= .tar.bz2 + +MAINTAINER= pkgsrc-users@NetBSD.org +HOMEPAGE= http://www.mesa3d.org/ +COMMENT= Graphics library similar to SGI's OpenGL + +INSTALLATION_PREFIX= ${LOCALBASE}/MesaLib7 + +DISTFILES+= MesaLib-${MESA_VERSION}${EXTRACT_SUFX} +MESA_DISTNAME= MesaLib-${MESA_VERSION} +MESA_SITES= ftp://freedesktop.org/pub/mesa/${MESA_VERSION}/ +MESA_VERSION= 7.11.2 +MESA_PKGVERSION= ${MESA_VERSION} + +GNU_CONFIGURE= yes +USE_LANGUAGES= c99 c++ +USE_TOOLS+= automake bison flex gmake pkg-config makedepend +WRKSRC= ${WRKDIR}/Mesa-${MESA_VERSION} +DIST_SUBDIR= Mesa-${MESA_PKGVERSION} + +CONFLICTS+= xf86driproto<2.0.4 + +PLIST_VARS= dri nodri + +PKGCONFIG_OVERRIDE+= src/mesa/drivers/dri/dri.pc.in +PKGCONFIG_OVERRIDE+= src/mesa/gl.pc.in +PKGCONFIG_OVERRIDE+= src/mesa/osmesa.pc.in +PKGCONFIG_OVERRIDE+= src/glw/glw.pc.in + +CONFIGURE_ARGS+= --disable-glu +CONFIGURE_ARGS+= --disable-glut +CONFIGURE_ARGS+= --disable-motif +CONFIGURE_ARGS+= --with-gallium-drivers="" +CONFIGURE_ARGS+= --disable-gallium-llvm +CONFIGURE_ARGS+= --disable-egl + +.include "glx-config.mk" + +PYTHON_FOR_BUILD_ONLY= tool +PYTHON_VERSIONS_INCOMPATIBLE= 33 34 # not yet ported as of 7.11.2 + +MAKE_ENV+= MAKE=${GMAKE:Q} + +.include "../../mk/compiler.mk" + +.if !empty(PKGSRC_COMPILER:Mccc) +CFLAGS+= -D__FUNCTION__=__FILE__ +.endif + +.include "../../mk/bsd.prefs.mk" +.if ${OPSYS} == "MirBSD" +BUILDLINK_TRANSFORM+= rm:-fvisibility=hidden +.endif + +.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) +# XXX This is not quite enough: we will need to patch the makefile +# because it bogusly tries to reuse objects for native tools and target +# libraries, and for cross-compiling the objects need to be built +# separately. Alternatively, we could just update Mesa to something +# less prehistoric... +SUBST_CLASSES+= nativecc +SUBST_STAGE.nativecc= pre-configure +SUBST_MESSAGE.nativecc= Fix makefiles to compile tools with native cc. +SUBST_FILES.nativecc+= src/glsl/Makefile +SUBST_SED.nativecc+= -e 's,$$(CC),$$(APP_CC),g' +SUBST_SED.nativecc+= -e 's,$$(CXX),$$(APP_CXX),g' +MAKE_FLAGS+= APP_CC=${NATIVE_CC:Q} +MAKE_FLAGS+= APP_CXX=${NATIVE_CXX:Q} +.endif + +.include "options.mk" + +.if !empty(MACHINE_PLATFORM:MNetBSD-[12].*) +## +## NetBSD 2.x and earlier require pthread stubs +## +. include "../../devel/pthread-stublib/buildlink3.mk" +PTHREAD_STUBLIB= -L${PREFIX}/lib -Wl,-R${PREFIX}/lib -lpthstub +.elif !empty(MACHINE_PLATFORM:MNetBSD-*) +## +## NetBSD 3.x and later have pthread stubs in libc +## +PTHREAD_STUBLIB= +.else +## +## Other platforms may or may not have stubs provided by libc, but pulling in +## threading support via the pthread.buildlink3.mk definitions will provide +## all the necessary interfaces. This matches the standard configuration for +## most platforms as they appear in "${WRKSRC}/configs", and is necessary +## for successful linking with libGL under many platforms. +## +.include "../../mk/pthread.buildlink3.mk" +PTHREAD_STUBLIB= ${PTHREAD_LDFLAGS} ${PTHREAD_LIBS} +.endif +PKGSRC_MAKE_ENV+= PTHREAD_STUBLIB=${PTHREAD_STUBLIB:Q} +MAKE_ENV+= PTHREAD_STUBLIB=${PTHREAD_STUBLIB:Q} + +.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) +MAKE_ENV+= CROSS_COMPILING=yes +.endif + +pre-configure: + cd ${WRKSRC} && ${MAKE} configure + +post-extract: +.if !empty(PKG_OPTIONS:Mdri) && (${OPSYS} == "SunOS") + ${CP} ${FILESDIR}/mapfile.externs ${WRKSRC}/src/mesa/drivers/dri/ +.endif + ${CP} ${FILESDIR}/gen_matypes.awk ${WRKSRC}/src/mesa/x86 + ${CP} ${FILESDIR}/gen_matypes.sh ${WRKSRC}/src/mesa/x86 + ${CHMOD} a+x ${WRKSRC}/src/mesa/x86/gen_matypes.sh + +# +# remove include files installed respectively by ../glu and ../glut +# +pre-install: + ${RM} -f ${WRKSRC}/include/GL/glu*.h + +.include "../../mk/compiler.mk" + +.if !empty(PKGSRC_COMPILER:Mclang) +CFLAGS+= -no-integrated-as -fvisibility=hidden +.endif + +.if ${OPSYS} == "MirBSD" +BUILDLINK_TRANSFORM+= rm:-fvisibility=hidden +.endif + +.include "../../lang/python/tool.mk" +BUILDLINK_DEPMETHOD.libxml2?= build +.include "../../textproc/libxml2/buildlink3.mk" +BUILDLINK_API_DEPENDS.glproto+= glproto>=1.4.11 +.include "../../x11/glproto/buildlink3.mk" +.include "../../x11/libX11/buildlink3.mk" +.include "../../x11/libXi/buildlink3.mk" +.include "../../x11/libXmu/buildlink3.mk" +.include "../../x11/libXext/buildlink3.mk" +.include "../../x11/libXt/buildlink3.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/graphics/MesaLib7/PLIST b/graphics/MesaLib7/PLIST new file mode 100644 index 00000000000..8888aad2c3b --- /dev/null +++ b/graphics/MesaLib7/PLIST @@ -0,0 +1,46 @@ +@comment $NetBSD: PLIST,v 1.1 2015/04/05 17:01:37 tnn Exp $ +include/GL/GLwDrawA.h +include/GL/GLwDrawAP.h +include/GL/GLwMDrawA.h +include/GL/GLwMDrawAP.h +include/GL/gl.h +include/GL/gl_mangle.h +include/GL/glext.h +include/GL/glfbdev.h +include/GL/glx.h +include/GL/glx_mangle.h +include/GL/glxext.h +${PLIST.dri}include/GL/internal/dri_interface.h +include/GL/mesa_wgl.h +include/GL/osmesa.h +include/GL/vms_x_fix.h +include/GL/wglext.h +include/GL/wmesa.h +lib/libGL.so +lib/libGL.so.1 +lib/libGL.so.1.2 +lib/libGLw.so +lib/libGLw.so.1 +lib/libGLw.so.1.0.0 +${PLIST.nodri}lib/libOSMesa.so +${PLIST.nodri}lib/libOSMesa.so.7 +${PLIST.nodri}lib/libOSMesa.so.7.11.0 +${PLIST.dri}lib/dri/i810_dri.so +${PLIST.dri}lib/dri/i915_dri.so +${PLIST.dri}lib/dri/i965_dri.so +${PLIST.dri}lib/dri/mach64_dri.so +${PLIST.dri}lib/dri/mga_dri.so +${PLIST.dri}lib/dri/r128_dri.so +${PLIST.dri}lib/dri/r200_dri.so +${PLIST.dri}lib/dri/r300_dri.so +${PLIST.dri}lib/dri/r600_dri.so +${PLIST.dri}lib/dri/radeon_dri.so +${PLIST.dri}lib/dri/savage_dri.so +${PLIST.dri}lib/dri/sis_dri.so +${PLIST.dri}lib/dri/swrast_dri.so +${PLIST.dri}lib/dri/tdfx_dri.so +${PLIST.dri}lib/dri/unichrome_dri.so +${PLIST.dri}lib/pkgconfig/dri.pc +lib/pkgconfig/gl.pc +lib/pkgconfig/glw.pc +${PLIST.nodri}lib/pkgconfig/osmesa.pc diff --git a/graphics/MesaLib7/buildlink3.mk b/graphics/MesaLib7/buildlink3.mk new file mode 100644 index 00000000000..568d1bca0bd --- /dev/null +++ b/graphics/MesaLib7/buildlink3.mk @@ -0,0 +1,36 @@ +# $NetBSD: buildlink3.mk,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +BUILDLINK_TREE+= MesaLib7 + +.if !defined(MESALIB7_BUILDLINK3_MK) +MESALIB7_BUILDLINK3_MK:= + +BUILDLINK_API_DEPENDS.MesaLib7+= MesaLib7>=7.11.2 +BUILDLINK_PKGSRCDIR.MesaLib7?= ../../graphics/MesaLib7 + +.include "../../mk/bsd.fast.prefs.mk" + +# See <http://developer.apple.com/qa/qa2007/qa1567.html>. +.if !empty(MACHINE_PLATFORM:MDarwin-[9].*-*) +BUILDLINK_LDFLAGS.MesaLib7+= -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib +.endif + +pkgbase:= MesaLib7 +.include "../../mk/pkg-build-options.mk" + +.if ${X11_TYPE} == "native" && ${OPSYS} != "Cygwin" && exists(${X11BASE}/lib/pkgconfig/dri.pc) +PKG_BUILD_OPTIONS.MesaLib7+= dri +.endif + +.if !empty(PKG_BUILD_OPTIONS.MesaLib7:Mdri) +. include "../../graphics/MesaLib/dri.mk" +.endif + +.if !empty(MACHINE_PLATFORM:MNetBSD-[12].*) +.include "../../devel/pthread-stublib/buildlink3.mk" +.endif + +.include "../../x11/libXext/buildlink3.mk" +.endif # MESALIB7_BUILDLINK3_MK + +BUILDLINK_TREE+= -MesaLib7 diff --git a/graphics/MesaLib7/distinfo b/graphics/MesaLib7/distinfo new file mode 100644 index 00000000000..10da6c3b64c --- /dev/null +++ b/graphics/MesaLib7/distinfo @@ -0,0 +1,34 @@ +$NetBSD: distinfo,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +SHA1 (Mesa-7.11.2/MesaLib-7.11.2.tar.bz2) = 5981ac2de8438e5f4a1f3561f2044d700c5f0de9 +RMD160 (Mesa-7.11.2/MesaLib-7.11.2.tar.bz2) = 656ded1db6c1f6fdd15a3f2cdee1b895d393bcea +Size (Mesa-7.11.2/MesaLib-7.11.2.tar.bz2) = 6257280 bytes +SHA1 (patch-af) = da0bd412b81d4b826b6d9b4bb8d98ca1fe0006ba +SHA1 (patch-bin_mklib) = 8c54bf5382541cab9d971b0e0e627035db1af468 +SHA1 (patch-configure.ac) = 0e3f9a1f21ba3a50161312683e9a0ad36f9f3e61 +SHA1 (patch-include_GL_gl.h) = a97ab309556c78d818d0b8bd867b5f2412c141b0 +SHA1 (patch-src_gallium_auxiliary_util_u__atomic.h) = 68ba9694aca506add2aa96a6892a7227481c2c11 +SHA1 (patch-src_gallium_include_pipe_p__config.h) = 34f4c2a033dd7a494dd3f51db407002a3388f84e +SHA1 (patch-src_glsl_ir__constant__expression.cpp) = 281e281f51afed244b1a29b92942d572fc095124 +SHA1 (patch-src_glsl_ralloc.c) = 40885fac898058f8e83852a79ca50a74b61121ab +SHA1 (patch-src_glu_sgi_glu.exports) = 66609d2ea59b02fc46b41311b0042fe4a2da517f +SHA1 (patch-src_glu_sgi_libtess_sweep.c) = 6ee6d67b2178d23e1b7848d64eede6349f46ee96 +SHA1 (patch-src_glx_XF86dri.c) = b69b7cf5e0d617eca129f0d7f0b06c7603d00db0 +SHA1 (patch-src_mesa_drivers_dri_common_dri__util.h) = 53e63dcc6243b1872f4e4816b46e92910cf97edc +SHA1 (patch-src_mesa_drivers_dri_common_mmio.h) = b6da48111fb2792b1c71eb7549d0f03adceec9f1 +SHA1 (patch-src_mesa_drivers_dri_i915_intel__batchbuffer.c) = fec8b1a9f6888e9a4225861ea5bda776ecc5f054 +SHA1 (patch-src_mesa_drivers_dri_i915_intel__tris.c) = 74a2ca9f9c865db9b6212087e442f65bb0621227 +SHA1 (patch-src_mesa_drivers_dri_i965_brw__draw.c) = ce12dc2d2391300d32776a06f5d0096448019c6b +SHA1 (patch-src_mesa_drivers_dri_i965_brw__draw__upload.c) = 44162ca546072669b85093981728e635dda69e55 +SHA1 (patch-src_mesa_drivers_dri_i965_brw__misc__state.c) = d37f967dea0fc3bd32566d6a26fd434ca9564081 +SHA1 (patch-src_mesa_drivers_dri_i965_gen6__vs__state.c) = c918b5a91b339e49850d718c957d7e717c2dc130 +SHA1 (patch-src_mesa_drivers_dri_i965_gen6__wm__state.c) = a8ecf943525888b22ec99fe454b08f43c5d8a911 +SHA1 (patch-src_mesa_drivers_dri_i965_intel__batchbuffer.c) = 653c87e1123ce9a27b71221fff4119df34abe15f +SHA1 (patch-src_mesa_drivers_dri_intel_intel__context.c) = 21d3c08a27817a6358b88101f889120869eebcce +SHA1 (patch-src_mesa_drivers_dri_intel_intel__context.h) = 6d394e704636134768a6cb5a200ebcc7bc3f52ed +SHA1 (patch-src_mesa_drivers_dri_mach64_mach64__context.h) = fe95c6610de4c1482c568463aca82f53ed0df900 +SHA1 (patch-src_mesa_drivers_x11_Makefile) = 17b72d2b74d89fbd8db05491cfcf253bb856b139 +SHA1 (patch-src_mesa_main_compiler.h) = b164781b541cb83b64597facbb7a7e21d8bdb686 +SHA1 (patch-src_mesa_main_context.c) = 6b6f1e3ad4ea189291fcf221d4b8bfbd650f8908 +SHA1 (patch-src_mesa_main_imports.c) = d0c50004c749e4c5c136ac2ed50a6989ca90065f +SHA1 (patch-src_mesa_main_imports.h) = f5a96195b3a14294ca3389c9fe17a6076c46db8a diff --git a/graphics/MesaLib7/files/gen_matypes.awk b/graphics/MesaLib7/files/gen_matypes.awk new file mode 100644 index 00000000000..8fb60fc83b1 --- /dev/null +++ b/graphics/MesaLib7/files/gen_matypes.awk @@ -0,0 +1,31 @@ +# $NetBSD: gen_matypes.awk,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +BEGIN { + while (getline) { + if (/int main/) break; + } +} + +/printf/ { + printf("printf %s\n", substr($0, 12, length($0) - 14)) +} +/OFFSET\(/ { + split(substr($0,12, length($0) - 14), offsets, ","); + printf("offset %s \"%s\" \"%s\"\n", offsets[1], offsets[2], offsets[3]); +} +/OFFSET_HEADER/ { + printf("offset_header %s\n", substr($0,19, length($0) - 21)) +} + +/DEFINE\(/ { + split(substr($0,12, length($0) - 14), offsets, ","); + printf("define %s \"%s\"\n", offsets[1], offsets[2]); +} +/DEFINE_HEADER/ { + printf("define_header %s\n", substr($0,19, length($0) - 21)) +} + +/SIZEOF\(/ { + split(substr($0,12, length($0) - 14), offsets, ","); + printf("sizeof %s \"%s\"\n", offsets[1], offsets[2]); +} diff --git a/graphics/MesaLib7/files/gen_matypes.sh b/graphics/MesaLib7/files/gen_matypes.sh new file mode 100644 index 00000000000..ff01122c707 --- /dev/null +++ b/graphics/MesaLib7/files/gen_matypes.sh @@ -0,0 +1,98 @@ +#!/bin/sh +# +# $NetBSD: gen_matypes.sh,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +test_condition() { + cat > gen_matypes_cross.c << EOF +#include "main/glheader.h" +#include "main/mtypes.h" +#include "tnl/t_context.h" + +#undef offsetof +#define offsetof( type, member ) ((size_t) &((type *)0)->member) + +int test_variable[($1) ? 1 : -1]; +EOF + ${CC} -c -o /dev/null ${CFLAGS} gen_matypes_cross.c > /dev/null 2>&1 +} + +compute_powers(){ + local cur + local i + cur=1 + i=1 + while [ ${i} -le 16 ]; do + power_of_two="${cur} ${power_of_two}" + cur=`expr ${cur} + ${cur}` + i=`expr ${i} + 1` + done +} + +compute_powers + +offset() { + local got_mismatch + local bits + local o + o=0 + got_mismatch=0 + for bits in ${power_of_two}; do + if test_condition "offsetof($2, $3) >= $o + $bits"; then + o=`expr $o + $bits` + else + got_mismatch=1 + fi + done + [ "$got_mismatch" = 0 ] && exit 1 + printf "#define %s\t%d\n" "$1" $o +} + +offset_header() { + printf "\n" + printf "\n" + printf "/* =============================================================\n" + printf " * Offsets for %s\n" "$1" + printf " */\n" + printf "\n" +} + +define_header() { + printf "\n" + printf "/*\n" + printf " * Flags for %s\n" "$1" + printf " */\n" + printf "\n" +} + +define() { + local bits + local v + v=0 + for bits in ${power_of_two}; do + if test_condition "$2 >= $v + $bits"; then + v=`expr $v + $bits` + fi + done + printf "#define %s\t0x%x\n" "$1" $v +} + +sizeof() { + local got_mismatch + local bits + local v + v=0 + got_mismatch=0 + for bits in ${power_of_two}; do + if test_condition "sizeof($2) >= $v + $bits"; then + v=`expr $v + $bits` + else + got_mismatch=1 + fi + done + [ "$got_mismatch" = 0 ] && exit 1 + printf "#define %s\t0x%x\n" "$1" $v +} + +awk -f gen_matypes.awk < gen_matypes.c > gen_matypes_tmp.sh +. ./gen_matypes_tmp.sh +rm gen_matypes_tmp.sh diff --git a/graphics/MesaLib7/files/mapfile.externs b/graphics/MesaLib7/files/mapfile.externs new file mode 100644 index 00000000000..9a4dccbdb9d --- /dev/null +++ b/graphics/MesaLib7/files/mapfile.externs @@ -0,0 +1,27 @@ +# Functions which are allowed to be unresolved when building dri modules + +{ + global: + _glapi_Context = DATA extern; + _glapi_Dispatch = DATA extern; + _glapi_add_dispatch = FUNCTION extern; + _glapi_get_dispatch = FUNCTION extern; + _glapi_get_dispatch_table_size = FUNCTION extern; + _glapi_set_dispatch = FUNCTION extern; + _glapi_get_context = FUNCTION extern; + _glapi_set_context = FUNCTION extern; + _glapi_set_warning_func = FUNCTION extern; + _glapi_noop_enable_warnings = FUNCTION extern; + _glapi_check_multithread = FUNCTION extern; + _glthread_GetID = FUNCTION extern; + sl_pp_context_add_extension = FUNCTION extern; + sl_pp_context_create = FUNCTION extern; + sl_pp_context_error_message = FUNCTION extern; + sl_pp_context_destroy = FUNCTION extern; + sl_pp_version = FUNCTION extern; + sl_cl_compile = FUNCTION extern; + + radeon_gem_get_kernel_name = FUNCTION extern; + + _mesa_bitcount = FUNCTION extern; +}; diff --git a/graphics/MesaLib7/glx-config.mk b/graphics/MesaLib7/glx-config.mk new file mode 100644 index 00000000000..58d92501291 --- /dev/null +++ b/graphics/MesaLib7/glx-config.mk @@ -0,0 +1,58 @@ +# $NetBSD: glx-config.mk,v 1.1 2015/04/05 17:01:37 tnn Exp $ +# +# used by x11/modular-xorg-server112/options.mk + +.if !defined(GLX_CONFIG_MK) +GLX_CONFIG_MK= # empty + +### XXX Older versions of xf86driproto installed dri_interface.h, which +### is now installed by Mesa. +### +BUILDLINK_API_DEPENDS.xf86driproto+= xf86driproto>=2.0.4 + +. include "../../mk/bsd.fast.prefs.mk" + +CFLAGS.NetBSD+= -D_NETBSD_SOURCE +CFLAGS.NetBSD+= ${ATOMIC_OPS_CHECK}HAVE_NETBSD_ATOMIC_OPS + +. if ${OPSYS} == "NetBSD" && !target(netbsd-atomic-ops-check) +.PHONY: netbsd-atomic-opts-check +netbsd-atomic-ops-check: +ATOMIC_OPS_CHECK!=\ + if ( ${NM} /usr/lib/libc.so | ${GREP} -q atomic_cas_uint ); then \ + ${ECHO} "-D"; \ + else \ + ${ECHO} "-U"; \ + fi +.endif + +.if (${MACHINE_ARCH} == "x86_64" || \ + ${MACHINE_ARCH} == "sparc64" || \ + ${MACHINE_ARCH} == "alpha") +CFLAGS+= -D__GLX_ALIGN64 +.endif + +.if !empty(MACHINE_ARCH:Mi386) || !empty(MACHINE_ARCH:Mx86_64) +### +### This is taken from <sys/arch/i386/include/npx.h>. If we don't override +### it, the FPU control word will be restored to 0x037f. +### +### Also, see patch-aq about the libm functions required (float functions +### such as floorf). Proper configuration of this should be a goal of +### the Mesa developers; alas, it obviously is not. +### +### XXX We need a reliable check for these functions. +### +#/* NetBSD uses IEEE double precision. */ +CFLAGS.NetBSD+= -DDEFAULT_X86_FPU=0x127f +### +#/* FreeBSD leaves some exceptions unmasked as well. */ +### +CFLAGS.FreeBSD+= -DDEFAULT_X86_FPU=0x1272 +. endif + +CFLAGS.FreeBSD+= -DUSE_NATIVE_LIBM_FUNCS +CFLAGS.NetBSD+= -DUSE_NATIVE_LIBM_FUNCS +CFLAGS.DragonFly+= -DUSE_NATIVE_LIBM_FUNCS + +.endif # GLX_CONFIG_MK diff --git a/graphics/MesaLib7/options.mk b/graphics/MesaLib7/options.mk new file mode 100644 index 00000000000..01444742cf9 --- /dev/null +++ b/graphics/MesaLib7/options.mk @@ -0,0 +1,66 @@ +# $NetBSD: options.mk,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +PKG_OPTIONS_VAR= PKG_OPTIONS.MesaLib +PKG_SUPPORTED_OPTIONS= + +# Assembler code build configurations +.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") && \ + ${OPSYS} != "Darwin" +#PKG_SUPPORTED_OPTIONS+= ${MACHINE_ARCH} +#PKG_SUGGESTED_OPTIONS+= ${MACHINE_ARCH} +.endif +### +### XXX There are [probably] others, but let's not get crazy just yet. +### This will take a while to test for the myriad platforms we +### support. +### +.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || \ + ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc" || \ + ${MACHINE_ARCH} == "sparc64") && \ + (${OPSYS} == "NetBSD" || \ + ${OPSYS} == "FreeBSD" || ${OPSYS} == "OpenBSD" || \ + ${OPSYS} == "DragonFly" || ${OPSYS} == "Linux" || \ + ${OPSYS} == "SunOS") +PKG_SUPPORTED_OPTIONS+= dri +.endif +.if !empty(MACHINE_PLATFORM:MNetBSD-[4-9]*-*86*) +PKG_SUGGESTED_OPTIONS+= dri +.endif +.if !empty(MACHINE_PLATFORM:MLinux-*-*86*) +PKG_SUGGESTED_OPTIONS+= dri +.endif + +.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly" || (${OPSYS} == "SunOS" && ${OS_VERSION} == "5.11") +PKG_SUGGESTED_OPTIONS+= dri +.endif + +.include "../../mk/bsd.options.mk" +### +### XXX Yes, this is a bit overly verbose; with Mesa, that can't hurt much. +### NOTE: there is no assembler code built with libOSMesa. +#.if (!empty(PKG_OPTIONS:Mi386) || !empty(PKG_OPTIONS:Mx86_64)) && \ +# !empty(PKG_OPTIONS:Mdri) +#BUILD_TARGET_SUFFIX= -${MACHINE_ARCH} +#.else +#BUILD_TARGET_SUFFIX= # empty +#.endif + +.if !empty(PKG_OPTIONS:Mdri) +CONFIGURE_ARGS+= --with-driver=dri +PLIST.dri= yes +BUILDLINK_DEPMETHOD.libpciaccess= full +. include "../../sysutils/libpciaccess/buildlink3.mk" +USE_BUILTIN.MesaLib= no +. include "../../graphics/MesaLib/dri.mk" +CONFIGURE_ARGS+= --with-dri-drivers="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon savage sis swrast tdfx unichrome" +.else +CONFIGURE_ARGS+= --with-driver=xlib +PLIST.nodri= yes +.if !empty(MACHINE_PLATFORM:MNetBSD-[4-9]*-*86*) +PKG_FAIL_REASON= "The dri option needs to be enabled for this to build on NetBSD." +.endif +### +### XXX building libOSMesa breaks with -j, and GNU make has no .WAIT +### +#MAKE_JOBS_SAFE= no +.endif diff --git a/graphics/MesaLib7/patches/patch-af b/graphics/MesaLib7/patches/patch-af new file mode 100644 index 00000000000..2ce498b2a2d --- /dev/null +++ b/graphics/MesaLib7/patches/patch-af @@ -0,0 +1,21 @@ +$NetBSD: patch-af,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/sis/sis_context.h.orig 2009-01-22 17:38:34.000000000 +0000 ++++ src/mesa/drivers/dri/sis/sis_context.h +@@ -404,7 +404,16 @@ struct sis_context + #define MMIO_WMB() __asm __volatile("" : : : "memory") + #elif defined(__ia64__) + #define MMIO_WMB() __asm __volatile("mf" : : : "memory") ++#elif defined(__sparc64__) ++#define MMIO_WMB() __asm __volatile("membar #Sync" : : : "memory") ++#elif defined(HAVE_NETBSD_ATOMIC_H) ++#include <sys/atomic.h> ++#define MMIO_WMB() membar_sync() /* XXX is this adequate? */ ++#elif defined(__sync_synchronize) /* gcc built-in */ ++#define MMIO_WMB() __sync_synchronize() + #else ++#warning Please define MMIO_WMB for this platform ++#define MMIO_WMB() + #error platform needs WMB + #endif + diff --git a/graphics/MesaLib7/patches/patch-bin_mklib b/graphics/MesaLib7/patches/patch-bin_mklib new file mode 100644 index 00000000000..8d022b665d8 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-bin_mklib @@ -0,0 +1,79 @@ +$NetBSD: patch-bin_mklib,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +Solaris ld seemingly has a hard time swallowing nested archives, +so flatten them out as is done for linux. + +Also, to simplify PLIST processing, add versioned shared libraries +for SunOS. + +--- bin/mklib.orig Sat Oct 15 00:43:34 2011 ++++ bin/mklib +@@ -305,9 +305,15 @@ fi + # + # OK, make the library now + # ++if [ x${PATCH} = "x" ] ; then ++ VERSION="${MAJOR}.${MINOR}" ++else ++ VERSION="${MAJOR}.${MINOR}.${PATCH}" ++fi ++ + case $ARCH in + +- 'Linux' | 'OpenBSD' | 'DragonFly' | 'GNU' | GNU/* | 'NetBSD') ++ 'Linux' | 'OpenBSD' | 'DragonFly' | 'GNU' | GNU/* | 'NetBSD' | 'FreeBSD' | 'MirBSD') + # we assume gcc + + if [ "x$LINK" = "x" ] ; then +@@ -398,12 +404,6 @@ case $ARCH in + OPTS=${ALTOPTS} + fi + +- if [ x${PATCH} = "x" ] ; then +- VERSION="${MAJOR}.${MINOR}" +- else +- VERSION="${MAJOR}.${MINOR}.${PATCH}" +- fi +- + echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}.so.${VERSION} + + # rm any old libs +@@ -426,7 +426,20 @@ case $ARCH in + if [ $STATIC = 1 ] ; then + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making SunOS static library: " ${LIBNAME} +- FINAL_LIBS=`make_ar_static_lib -ruc 0 ${LIBNAME} ${OBJECTS}` ++# FINAL_LIBS=`make_ar_static_lib -ruc 0 ${LIBNAME} ${OBJECTS}` ++ OPTS="-rucs" ++ if [ "${ALTOPTS}" ] ; then ++ OPTS=${ALTOPTS} ++ fi ++ ++ # expand .a into .o files ++ NEW_OBJECTS=`expand_archives ${LIBNAME}.obj $OBJECTS` ++ ++ # make static lib ++ FINAL_LIBS=`make_ar_static_lib ${OPTS} 0 ${LIBNAME} ${NEW_OBJECTS}` ++ ++ # remove temporary extracted .o files ++ rm -rf ${LIBNAME}.obj + else + if [ $NOPREFIX = 0 ] ; then + LIBNAME="lib${LIBNAME}.so" +@@ -517,10 +530,13 @@ case $ARCH in + ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + FINAL_LIBS="${LIBNAME}" + else +- rm -f ${LIBNAME}.${MAJOR} ${LIBNAME} +- ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} -h ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS} ++ # rm any old libs ++ rm -f ${LIBNAME}.${VERSION} ${LIBNAME}.${MAJOR} ${LIBNAME} ++ ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${VERSION} -h ${LIBNAME}.${VERSION} ${OBJECTS} ${DEPS} ++ ++ ln -s ${LIBNAME}.${VERSION} ${LIBNAME}.${MAJOR} + ln -s ${LIBNAME}.${MAJOR} ${LIBNAME} +- FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}" ++ FINAL_LIBS="${LIBNAME}.${VERSION} ${LIBNAME}.${MAJOR} ${LIBNAME}" + fi + fi + ;; diff --git a/graphics/MesaLib7/patches/patch-configure.ac b/graphics/MesaLib7/patches/patch-configure.ac new file mode 100644 index 00000000000..64e36587d3f --- /dev/null +++ b/graphics/MesaLib7/patches/patch-configure.ac @@ -0,0 +1,13 @@ +$NetBSD: patch-configure.ac,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- configure.ac.orig 2011-10-15 00:43:58.000000000 +0000 ++++ configure.ac +@@ -1086,6 +1086,8 @@ if test "$mesa_driver" = dri -o "$mesa_d + if test "x$driglx_direct" = xyes; then + DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" + fi ++ DRI_LIB_MAPFILE='-Wl,-M,$(TOP)/src/mesa/drivers/dri/mapfile.externs' ++ DRI_LIB_DEPS="$DRI_LIB_DEPS $DRI_LIB_MAPFILE" + ;; + cygwin*) + DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" diff --git a/graphics/MesaLib7/patches/patch-include_GL_gl.h b/graphics/MesaLib7/patches/patch-include_GL_gl.h new file mode 100644 index 00000000000..c4f5bd41e42 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-include_GL_gl.h @@ -0,0 +1,16 @@ +$NetBSD: patch-include_GL_gl.h,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +Check for symbol existence with #ifdef, not #if. +Needed since some other files only #define the symbol without a value. + +--- include/GL/gl.h.orig 2011-11-23 01:09:52.000000000 +0000 ++++ include/GL/gl.h +@@ -2094,7 +2094,7 @@ typedef void (APIENTRYP PFNGLMULTITEXCOO + + + +-#if GL_ARB_shader_objects ++#ifdef GL_ARB_shader_objects + + #ifndef GL_MESA_shader_debug + #define GL_MESA_shader_debug 1 diff --git a/graphics/MesaLib7/patches/patch-src_gallium_auxiliary_util_u__atomic.h b/graphics/MesaLib7/patches/patch-src_gallium_auxiliary_util_u__atomic.h new file mode 100644 index 00000000000..445b7176949 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_gallium_auxiliary_util_u__atomic.h @@ -0,0 +1,107 @@ +$NetBSD: patch-src_gallium_auxiliary_util_u__atomic.h,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +Add atomic operations for PowerPC platforms without GCC >= 4.1. This +should probably be sent to the upstream. + +--- src/gallium/auxiliary/util/u_atomic.h.orig 2014-01-10 06:56:00.000000000 +0000 ++++ src/gallium/auxiliary/util/u_atomic.h +@@ -31,6 +31,8 @@ + #define PIPE_ATOMIC_ASM_GCC_X86 + #elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64)) + #define PIPE_ATOMIC_ASM_GCC_X86_64 ++#elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_PPC)) ++#define PIPE_ATOMIC_ASM_GCC_PPC + #elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401) + #define PIPE_ATOMIC_GCC_INTRINSIC + #else +@@ -131,6 +133,90 @@ p_atomic_cmpxchg(int32_t *v, int32_t old + #endif + + ++#if defined(PIPE_ATOMIC_ASM_GCC_PPC) ++ ++#define PIPE_ATOMIC "GCC ppc assembly" ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#define p_atomic_set(_v, _i) (*(_v) = (_i)) ++#define p_atomic_read(_v) (*(_v)) ++ ++static INLINE boolean ++p_atomic_dec_zero(int32_t *v) ++{ ++ int32_t c; ++ ++ __asm__ __volatile__( ++ "1: lwarx %0,0,%1\n" ++ " addic %0,%0,-1\n" ++ " stwcx. %0,0,%1\n" ++ " bne- 1b" ++ : "=&r" (c) ++ : "r" (v) ++ : "cc", "memory"); ++ ++ return c != 0; ++} ++ ++static INLINE void ++p_atomic_inc(int32_t *v) ++{ ++ int32_t c; ++ ++ __asm__ __volatile__( ++ "1: lwarx %0,0,%1\n" ++ " addic %0,%0,1\n" ++ " stwcx. %0,0,%1\n" ++ " bne- 1b" ++ : "=&r" (c) ++ : "r" (v) ++ : "cc", "memory"); ++} ++ ++static INLINE void ++p_atomic_dec(int32_t *v) ++{ ++ int32_t c; ++ ++ __asm__ __volatile__( ++ "1: lwarx %0,0,%1\n" ++ " addic %0,%0,-1\n" ++ " stwcx. %0,0,%1\n" ++ " bne- 1b" ++ : "=&r" (c) ++ : "r" (v) ++ : "cc", "memory"); ++} ++ ++static INLINE int32_t ++p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) ++{ ++ int32_t oldval; ++ ++ __asm__ __volatile__( ++ "1: lwarx %0,0,%2\n" ++ " cmpw 0,%0,%3\n" ++ " bne- 2f\n" ++ " stwcx. %4,0,%2\n" ++ " bne- 1b\n" ++ "2:\n" ++ : "=&r" (oldval), "+m" (*v) ++ : "r" (v), "r" (old), "r" (_new) ++ : "cc", "memory"); ++ ++ return oldval; ++} ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* PIPE_ATOMIC_ASM_PPC */ ++ ++ + + /* Implementation using GCC-provided synchronization intrinsics + */ diff --git a/graphics/MesaLib7/patches/patch-src_gallium_include_pipe_p__config.h b/graphics/MesaLib7/patches/patch-src_gallium_include_pipe_p__config.h new file mode 100644 index 00000000000..3567d5473e0 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_gallium_include_pipe_p__config.h @@ -0,0 +1,44 @@ +$NetBSD: patch-src_gallium_include_pipe_p__config.h,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +Adjust Endianness for PowerPC, NetBSD, OpenBSD or SunOS. + +--- src/gallium/include/pipe/p_config.h.orig 2011-10-15 00:43:58.000000000 +0000 ++++ src/gallium/include/pipe/p_config.h +@@ -99,7 +99,7 @@ + #endif + #endif + +-#if defined(__ppc__) || defined(__ppc64__) || defined(__PPC__) ++#if defined(__ppc__) || defined(__ppc64__) || defined(__PPC__) || defined(__powerpc__) + #define PIPE_ARCH_PPC + #if defined(__ppc64__) || defined(__PPC64__) + #define PIPE_ARCH_PPC_64 +@@ -129,6 +129,28 @@ + # define PIPE_ARCH_BIG_ENDIAN + #endif + ++#elif defined(__NetBSD__) || defined(__OpenBSD__) ++#if defined(__NetBSD__) ++#include <sys/endian.h> ++#else /* OpenBSD */ ++#include <machine/endian.h> ++#endif ++ ++#if _BYTE_ORDER == _LITTLE_ENDIAN ++# define PIPE_ARCH_LITTLE_ENDIAN ++#elif _BYTE_ORDER == _BIG_ENDIAN ++# define PIPE_ARCH_BIG_ENDIAN ++#endif ++ ++#elif defined(__sun) ++#include <sys/isa_defs.h> ++ ++#if defined(_LITTLE_ENDIAN) ++# define PIPE_ARCH_LITTLE_ENDIAN ++#elif defined(_BIG_ENDIAN) ++# define PIPE_ARCH_BIG_ENDIAN ++#endif ++ + #else + + #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) diff --git a/graphics/MesaLib7/patches/patch-src_glsl_ir__constant__expression.cpp b/graphics/MesaLib7/patches/patch-src_glsl_ir__constant__expression.cpp new file mode 100644 index 00000000000..9e02f640833 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_glsl_ir__constant__expression.cpp @@ -0,0 +1,20 @@ +$NetBSD: patch-src_glsl_ir__constant__expression.cpp,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +* band-aid patch for missing fxp2f(3) on NetBSD<6 + +--- src/glsl/ir_constant_expression.cpp.orig 2011-10-15 00:43:58.000000000 +0000 ++++ src/glsl/ir_constant_expression.cpp +@@ -39,6 +39,13 @@ + #include "ir_visitor.h" + #include "glsl_types.h" + ++#ifdef __NetBSD__ ++#include <sys/param.h> ++# if __NetBSD_Version < 600000000 ++#define exp2f(x) expf((x) * M_LN2) ++# endif ++#endif ++ + static float + dot(ir_constant *op0, ir_constant *op1) + { diff --git a/graphics/MesaLib7/patches/patch-src_glsl_ralloc.c b/graphics/MesaLib7/patches/patch-src_glsl_ralloc.c new file mode 100644 index 00000000000..33de2e3ea7e --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_glsl_ralloc.c @@ -0,0 +1,23 @@ +$NetBSD: patch-src_glsl_ralloc.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +* Fix exit time segfault of qt5 application with modular xorg + +--- src/glsl/ralloc.c.orig 2011-10-15 00:43:58.000000000 +0000 ++++ src/glsl/ralloc.c +@@ -272,7 +272,7 @@ ralloc_parent(const void *ptr) + + static void *autofree_context = NULL; + +-static void ++static void __attribute__((__destructor__)) + autofree(void) + { + ralloc_free(autofree_context); +@@ -283,7 +283,6 @@ ralloc_autofree_context(void) + { + if (unlikely(autofree_context == NULL)) { + autofree_context = ralloc_context(NULL); +- atexit(autofree); + } + return autofree_context; + } diff --git a/graphics/MesaLib7/patches/patch-src_glu_sgi_glu.exports b/graphics/MesaLib7/patches/patch-src_glu_sgi_glu.exports new file mode 100644 index 00000000000..4e58a37131f --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_glu_sgi_glu.exports @@ -0,0 +1,67 @@ +$NetBSD: patch-src_glu_sgi_glu.exports,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/glu/sgi/glu.exports.orig 2010-02-05 00:10:40.000000000 +0000 ++++ src/glu/sgi/glu.exports +@@ -57,62 +57,3 @@ + gluTessVertex + gluUnProject + gluUnProject4 +- mgluBeginCurve +- mgluBeginPolygon +- mgluBeginSurface +- mgluBeginTrim +- mgluBuild1DMipmapLevels +- mgluBuild1DMipmaps +- mgluBuild2DMipmapLevels +- mgluBuild2DMipmaps +- mgluBuild3DMipmapLevels +- mgluBuild3DMipmaps +- mgluCheckExtension +- mgluCylinder +- mgluDeleteNurbsRenderer +- mgluDeleteQuadric +- mgluDeleteTess +- mgluDisk +- mgluEndCurve +- mgluEndPolygon +- mgluEndSurface +- mgluEndTrim +- mgluErrorString +- mgluGetNurbsProperty +- mgluGetString +- mgluGetTessProperty +- mgluLoadSamplingMatrices +- mgluLookAt +- mgluNewNurbsRenderer +- mgluNewQuadric +- mgluNewTess +- mgluNextContour +- mgluNurbsCallback +- mgluNurbsCallbackData +- mgluNurbsCallbackDataEXT +- mgluNurbsCurve +- mgluNurbsProperty +- mgluNurbsSurface +- mgluOrtho2D +- mgluPartialDisk +- mgluPerspective +- mgluPickMatrix +- mgluProject +- mgluPwlCurve +- mgluQuadricCallback +- mgluQuadricDrawStyle +- mgluQuadricNormals +- mgluQuadricOrientation +- mgluQuadricTexture +- mgluScaleImage +- mgluSphere +- mgluTessBeginContour +- mgluTessBeginPolygon +- mgluTessCallback +- mgluTessEndContour +- mgluTessEndPolygon +- mgluTessNormal +- mgluTessProperty +- mgluTessVertex +- mgluUnProject +- mgluUnProject4 diff --git a/graphics/MesaLib7/patches/patch-src_glu_sgi_libtess_sweep.c b/graphics/MesaLib7/patches/patch-src_glu_sgi_libtess_sweep.c new file mode 100644 index 00000000000..f27b1782ac9 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_glu_sgi_libtess_sweep.c @@ -0,0 +1,49 @@ +$NetBSD: patch-src_glu_sgi_libtess_sweep.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +Fixes segfaults and crashes in applications using libGLU. +--- src/glu/sgi/libtess/sweep.c.orig 2010-10-05 16:56:51.000000000 +0000 ++++ src/glu/sgi/libtess/sweep.c +@@ -546,7 +546,9 @@ static int CheckForRightSplice( GLUtesse + if( EdgeSign( eUp->Dst, eLo->Org, eUp->Org ) < 0 ) return FALSE; + + /* eLo->Org appears to be above eUp, so splice eLo->Org into eUp */ +- RegionAbove(regUp)->dirty = regUp->dirty = TRUE; ++ if (RegionAbove(regUp)) ++ RegionAbove(regUp)->dirty = TRUE; ++ regUp->dirty = TRUE; + if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eLo->Oprev, eUp ) ) longjmp(tess->env,1); + } +@@ -584,7 +586,9 @@ static int CheckForLeftSplice( GLUtessel + if( EdgeSign( eUp->Dst, eLo->Dst, eUp->Org ) < 0 ) return FALSE; + + /* eLo->Dst is above eUp, so splice eLo->Dst into eUp */ +- RegionAbove(regUp)->dirty = regUp->dirty = TRUE; ++ if (RegionAbove(regUp)) ++ RegionAbove(regUp)->dirty = TRUE; ++ regUp->dirty = TRUE; + e = __gl_meshSplitEdge( eUp ); + if (e == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eLo->Sym, e ) ) longjmp(tess->env,1); +@@ -718,7 +722,9 @@ static int CheckForIntersect( GLUtessela + * (and wait for ConnectRightVertex to splice it appropriately). + */ + if( EdgeSign( dstUp, tess->event, &isect ) >= 0 ) { +- RegionAbove(regUp)->dirty = regUp->dirty = TRUE; ++ if (RegionAbove(regUp)) ++ RegionAbove(regUp)->dirty = TRUE; ++ regUp->dirty = TRUE; + if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1); + eUp->Org->s = tess->event->s; + eUp->Org->t = tess->event->t; +@@ -753,7 +759,9 @@ static int CheckForIntersect( GLUtessela + longjmp(tess->env,1); + } + GetIntersectData( tess, eUp->Org, orgUp, dstUp, orgLo, dstLo ); +- RegionAbove(regUp)->dirty = regUp->dirty = regLo->dirty = TRUE; ++ if (RegionAbove(regUp)) ++ RegionAbove(regUp)->dirty = TRUE; ++ regUp->dirty = regLo->dirty = TRUE; + return FALSE; + } + diff --git a/graphics/MesaLib7/patches/patch-src_glx_XF86dri.c b/graphics/MesaLib7/patches/patch-src_glx_XF86dri.c new file mode 100644 index 00000000000..c6bbc61d4e7 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_glx_XF86dri.c @@ -0,0 +1,40 @@ +$NetBSD: patch-src_glx_XF86dri.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/glx/XF86dri.c.orig 2010-10-19 17:58:29.000000000 +0000 ++++ src/glx/XF86dri.c +@@ -43,6 +43,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + #include <X11/extensions/Xext.h> + #include <X11/extensions/extutil.h> + #include "xf86dristr.h" ++#include <limits.h> + + static XExtensionInfo _xf86dri_info_data; + static XExtensionInfo *xf86dri_info = &_xf86dri_info_data; +@@ -201,7 +202,11 @@ XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA, + } + + if (rep.length) { +- if (!(*busIdString = (char *) Xcalloc(rep.busIdStringLength + 1, 1))) { ++ if (rep.busIdStringLength < INT_MAX) ++ *busIdString = (char *) Xcalloc(rep.busIdStringLength + 1, 1); ++ else ++ *busIdString = NULL; ++ if (*busIdString == NULL) { + _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3)); + UnlockDisplay(dpy); + SyncHandle(); +@@ -300,9 +301,11 @@ XF86DRIGetClientDriverName(Display * dpy + *ddxDriverPatchVersion = rep.ddxDriverPatchVersion; + + if (rep.length) { +- if (! +- (*clientDriverName = +- (char *) Xcalloc(rep.clientDriverNameLength + 1, 1))) { ++ if (rep.clientDriverNameLength < INT_MAX) ++ *clientDriverName = (char *) Xcalloc(rep.clientDriverNameLength + 1, 1); ++ else ++ *clientDriverName = NULL; ++ if (*clientDriverName == NULL) { + _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3)); + UnlockDisplay(dpy); + SyncHandle(); diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_common_dri__util.h b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_common_dri__util.h new file mode 100644 index 00000000000..ef5249a94b6 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_common_dri__util.h @@ -0,0 +1,15 @@ +$NetBSD: patch-src_mesa_drivers_dri_common_dri__util.h,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/common/dri_util.h.orig 2011-07-09 01:31:41.000000000 +0000 ++++ src/mesa/drivers/dri/common/dri_util.h +@@ -58,6 +58,10 @@ + + #define GLX_BAD_CONTEXT 5 + ++#define u_int64_t uint64_t ++#define u_int32_t uint32_t ++#define u_int8_t uint8_t ++ + typedef struct __DRIswapInfoRec __DRIswapInfo; + + /** diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_common_mmio.h b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_common_mmio.h new file mode 100644 index 00000000000..5fd35edff29 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_common_mmio.h @@ -0,0 +1,12 @@ +$NetBSD: patch-src_mesa_drivers_dri_common_mmio.h,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/common/mmio.h.orig 2010-02-05 00:10:40.000000000 +0000 ++++ src/mesa/drivers/dri/common/mmio.h +@@ -34,6 +34,7 @@ + #define MMIO_H + + #include "main/glheader.h" ++#include "dri_util.h" + + #if defined( __powerpc__ ) + diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i915_intel__batchbuffer.c b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i915_intel__batchbuffer.c new file mode 100644 index 00000000000..1832341dd0b --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i915_intel__batchbuffer.c @@ -0,0 +1,16 @@ +$NetBSD: patch-src_mesa_drivers_dri_i915_intel__batchbuffer.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/i915/intel_batchbuffer.c.orig 2011-10-15 04:29:59.000000000 +0000 ++++ src/mesa/drivers/dri/i915/intel_batchbuffer.c +@@ -427,8 +427,10 @@ intel_batchbuffer_emit_mi_flush(struct i + OUT_BATCH(PIPE_CONTROL_INSTRUCTION_FLUSH | + PIPE_CONTROL_WRITE_FLUSH | + PIPE_CONTROL_DEPTH_CACHE_FLUSH | ++ PIPE_CONTROL_VF_CACHE_INVALIDATE | + PIPE_CONTROL_TC_FLUSH | +- PIPE_CONTROL_NO_WRITE); ++ PIPE_CONTROL_NO_WRITE | ++ PIPE_CONTROL_CS_STALL); + OUT_BATCH(0); /* write address */ + OUT_BATCH(0); /* write data */ + ADVANCE_BATCH(); diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i915_intel__tris.c b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i915_intel__tris.c new file mode 100644 index 00000000000..fa12a217262 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i915_intel__tris.c @@ -0,0 +1,13 @@ +$NetBSD: patch-src_mesa_drivers_dri_i915_intel__tris.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/i915/intel_tris.c.orig 2011-10-15 00:43:58.000000000 +0000 ++++ src/mesa/drivers/dri/i915/intel_tris.c +@@ -337,7 +337,7 @@ void intel_finish_vb(struct intel_contex + * Emit primitives as inline vertices * + ***********************************************************************/ + +-#ifdef __i386__ ++#if (defined(i386) || defined(__i386__)) && !(defined(__SOLARIS__) || defined(sun)) + #define COPY_DWORDS( j, vb, vertsize, v ) \ + do { \ + int __tmp; \ diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_brw__draw.c b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_brw__draw.c new file mode 100644 index 00000000000..d755147c355 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_brw__draw.c @@ -0,0 +1,22 @@ +$NetBSD: patch-src_mesa_drivers_dri_i965_brw__draw.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/i965/brw_draw.c.orig 2013-04-23 05:46:06.246377394 +0000 ++++ src/mesa/drivers/dri/i965/brw_draw.c +@@ -168,7 +168,7 @@ static void brw_emit_prim(struct brw_con + * and missed flushes of the render cache as it heads to other parts of + * the besides the draw code. + */ +- if (intel->always_flush_cache) { ++ if ((intel->always_flush_cache) || (intel->gen == 6)) { + intel_batchbuffer_emit_mi_flush(intel); + } + +@@ -185,7 +185,7 @@ static void brw_emit_prim(struct brw_con + + intel->batch.need_workaround_flush = true; + +- if (intel->always_flush_cache) { ++ if ((intel->always_flush_cache) || (intel->gen == 6)) { + intel_batchbuffer_emit_mi_flush(intel); + } + } diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_brw__draw__upload.c b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_brw__draw__upload.c new file mode 100644 index 00000000000..9de5b54833f --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_brw__draw__upload.c @@ -0,0 +1,19 @@ +$NetBSD: patch-src_mesa_drivers_dri_i965_brw__draw__upload.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/i965/brw_draw_upload.c.orig 2011-10-15 00:43:58.000000000 +0000 ++++ src/mesa/drivers/dri/i965/brw_draw_upload.c +@@ -531,8 +531,14 @@ static void brw_emit_vertices(struct brw + struct intel_context *intel = intel_context(ctx); + GLuint i; + ++ /* workaround for gen6, reserve enough space for HW workaround */ ++ if (intel->gen == 6) { ++ if (intel_batchbuffer_space(intel) < (13 + 4*brw->vb.nr_buffers + 2* brw->vb.nr_enabled)*4) ++ intel_batchbuffer_flush(intel); ++ } + brw_emit_query_begin(brw); + ++ + /* If the VS doesn't read any inputs (calculating vertex position from + * a state variable for some reason, for example), emit a single pad + * VERTEX_ELEMENT struct and bail. diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_brw__misc__state.c b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_brw__misc__state.c new file mode 100644 index 00000000000..574be946330 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_brw__misc__state.c @@ -0,0 +1,142 @@ +$NetBSD: patch-src_mesa_drivers_dri_i965_brw__misc__state.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/i965/brw_misc_state.c.orig 2013-04-23 05:46:06.246006959 +0000 ++++ src/mesa/drivers/dri/i965/brw_misc_state.c +@@ -223,6 +223,12 @@ static void emit_depthbuffer(struct brw_ + struct intel_region *hiz_region = depth_irb ? depth_irb->hiz_region : NULL; + unsigned int len; + ++ /* workaround for gen6, reserve enough space for HW workaround */ ++ if (intel->gen == 6) { ++ if (intel_batchbuffer_space(intel) < 31*4) ++ intel_batchbuffer_flush(intel); ++ } ++ + /* 3DSTATE_DEPTH_BUFFER, 3DSTATE_STENCIL_BUFFER are both + * non-pipelined state that will need the PIPE_CONTROL workaround. + */ +@@ -456,6 +462,12 @@ static void upload_polygon_stipple(struc + if (!ctx->Polygon.StippleFlag) + return; + ++ /* workaround for gen6, reserve enough space for HW workaround */ ++ if (intel->gen == 6) { ++ if (intel_batchbuffer_space(intel) < 41*4) ++ intel_batchbuffer_flush(intel); ++ } ++ + if (intel->gen == 6) + intel_emit_post_sync_nonzero_flush(intel); + +@@ -504,6 +516,12 @@ static void upload_polygon_stipple_offse + if (!ctx->Polygon.StippleFlag) + return; + ++ /* workaround for gen6, reserve enough space for HW workaround */ ++ if (intel->gen == 6) { ++ if (intel_batchbuffer_space(intel) < 10*4) ++ intel_batchbuffer_flush(intel); ++ } ++ + if (intel->gen == 6) + intel_emit_post_sync_nonzero_flush(intel); + +@@ -548,6 +566,12 @@ static void upload_aa_line_parameters(st + if (!ctx->Line.SmoothFlag || !brw->has_aa_line_parameters) + return; + ++ /* workaround for gen6, reserve enough space for HW workaround */ ++ if (intel->gen == 6) { ++ if (intel_batchbuffer_space(intel) < 11*4) ++ intel_batchbuffer_flush(intel); ++ } ++ + if (intel->gen == 6) + intel_emit_post_sync_nonzero_flush(intel); + +@@ -581,6 +605,12 @@ static void upload_line_stipple(struct b + if (!ctx->Line.StippleFlag) + return; + ++ /* workaround for gen6, reserve enough space for HW workaround */ ++ if (intel->gen == 6) { ++ if (intel_batchbuffer_space(intel) < 11*4) ++ intel_batchbuffer_flush(intel); ++ } ++ + if (intel->gen == 6) + intel_emit_post_sync_nonzero_flush(intel); + +@@ -612,8 +642,62 @@ static void upload_invarient_state( stru + struct intel_context *intel = &brw->intel; + + /* 3DSTATE_SIP, 3DSTATE_MULTISAMPLE, etc. are nonpipelined. */ +- if (intel->gen == 6) +- intel_emit_post_sync_nonzero_flush(intel); ++ if (intel->gen == 6) { ++ int i; ++ ++ if (intel->batch.need_workaround_flush) { ++ ++ BEGIN_BATCH(33); ++ OUT_BATCH(_3DSTATE_PIPE_CONTROL); ++ OUT_BATCH(PIPE_CONTROL_CS_STALL | ++ PIPE_CONTROL_STALL_AT_SCOREBOARD); ++ OUT_BATCH(0); /* address */ ++ OUT_BATCH(0); /* write data */ ++ ++ OUT_BATCH(_3DSTATE_PIPE_CONTROL); ++ OUT_BATCH(PIPE_CONTROL_WRITE_IMMEDIATE); ++ OUT_RELOC(intel->batch.workaround_bo, ++ I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION, 0); ++ OUT_BATCH(0); /* write data */ ++ } else ++ BEGIN_BATCH(25); ++ /* Select the 3D pipeline (as opposed to media) */ ++ OUT_BATCH(brw->CMD_PIPELINE_SELECT << 16 | 0); ++ ++ OUT_BATCH(_3DSTATE_MULTISAMPLE << 16 | (1)); ++ OUT_BATCH(MS_PIXEL_LOCATION_CENTER | ++ MS_NUMSAMPLES_1); ++ OUT_BATCH(0); /* positions for 4/8-sample */ ++ ++ OUT_BATCH(_3DSTATE_SAMPLE_MASK << 16 | (2 - 2)); ++ OUT_BATCH(1); ++ ++ if (intel->gen < 7) { ++ for (i = 0; i < 4; i++) { ++ OUT_BATCH(_3DSTATE_GS_SVB_INDEX << 16 | (4 - 2)); ++ OUT_BATCH(i << SVB_INDEX_SHIFT); ++ OUT_BATCH(0); ++ OUT_BATCH(0xffffffff); ++ } ++ } ++ ++ /* 0x61020000 State Instruction Pointer */ ++ { ++ OUT_BATCH(CMD_STATE_INSN_POINTER); ++ OUT_BATCH(0); ++ } ++ ++ ++ { ++ OUT_BATCH(brw->CMD_VF_STATISTICS << 16 | ++ (unlikely(INTEL_DEBUG & DEBUG_STATS) ? 1 : 0)); ++ } ++ ADVANCE_BATCH(); ++ ++ if (intel->batch.need_workaround_flush) ++ intel->batch.need_workaround_flush = false; ++ ++ } else { + + { + /* 0x61040000 Pipeline Select */ +@@ -693,6 +777,7 @@ static void upload_invarient_state( stru + + BRW_BATCH_STRUCT(brw, &vfs); + } ++ } + } + + const struct brw_tracked_state brw_invarient_state = { diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_gen6__vs__state.c b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_gen6__vs__state.c new file mode 100644 index 00000000000..ecc1b1ea50b --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_gen6__vs__state.c @@ -0,0 +1,17 @@ +$NetBSD: patch-src_mesa_drivers_dri_i965_gen6__vs__state.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/i965/gen6_vs_state.c.orig 2011-11-23 01:09:52.000000000 +0000 ++++ src/mesa/drivers/dri/i965/gen6_vs_state.c +@@ -120,6 +120,12 @@ upload_vs_state(struct brw_context *brw) + { + struct intel_context *intel = &brw->intel; + ++ /* workaround for gen6, reserve enough space for HW workaround */ ++ if (intel->gen == 6) { ++ if (intel_batchbuffer_space(intel) < 23*4) ++ intel_batchbuffer_flush(intel); ++ } ++ + if (brw->vs.push_const_size == 0) { + /* Disable the push constant buffers. */ + BEGIN_BATCH(5); diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_gen6__wm__state.c b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_gen6__wm__state.c new file mode 100644 index 00000000000..55832cf033f --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_gen6__wm__state.c @@ -0,0 +1,38 @@ +$NetBSD: patch-src_mesa_drivers_dri_i965_gen6__wm__state.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/i965/gen6_wm_state.c.orig 2011-10-15 00:43:58.000000000 +0000 ++++ src/mesa/drivers/dri/i965/gen6_wm_state.c +@@ -102,15 +102,14 @@ upload_wm_state(struct brw_context *brw) + /* CACHE_NEW_WM_PROG */ + if (brw->wm.prog_data->nr_params == 0) { + /* Disable the push constant buffers. */ +- BEGIN_BATCH(5); ++ BEGIN_BATCH(14); + OUT_BATCH(_3DSTATE_CONSTANT_PS << 16 | (5 - 2)); + OUT_BATCH(0); + OUT_BATCH(0); + OUT_BATCH(0); + OUT_BATCH(0); +- ADVANCE_BATCH(); + } else { +- BEGIN_BATCH(5); ++ BEGIN_BATCH(14); + OUT_BATCH(_3DSTATE_CONSTANT_PS << 16 | + GEN6_CONSTANT_BUFFER_0_ENABLE | + (5 - 2)); +@@ -123,7 +122,6 @@ upload_wm_state(struct brw_context *brw) + OUT_BATCH(0); + OUT_BATCH(0); + OUT_BATCH(0); +- ADVANCE_BATCH(); + } + + dw2 = dw4 = dw5 = dw6 = 0; +@@ -183,7 +181,6 @@ upload_wm_state(struct brw_context *brw) + dw6 |= brw_count_bits(brw->fragment_program->Base.InputsRead) << + GEN6_WM_NUM_SF_OUTPUTS_SHIFT; + +- BEGIN_BATCH(9); + OUT_BATCH(_3DSTATE_WM << 16 | (9 - 2)); + OUT_BATCH(brw->wm.prog_offset); + OUT_BATCH(dw2); diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_intel__batchbuffer.c b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_intel__batchbuffer.c new file mode 100644 index 00000000000..a913ea559a3 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_i965_intel__batchbuffer.c @@ -0,0 +1,16 @@ +$NetBSD: patch-src_mesa_drivers_dri_i965_intel__batchbuffer.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/i965/intel_batchbuffer.c.orig 2011-10-15 04:29:59.000000000 +0000 ++++ src/mesa/drivers/dri/i965/intel_batchbuffer.c +@@ -427,8 +427,10 @@ intel_batchbuffer_emit_mi_flush(struct i + OUT_BATCH(PIPE_CONTROL_INSTRUCTION_FLUSH | + PIPE_CONTROL_WRITE_FLUSH | + PIPE_CONTROL_DEPTH_CACHE_FLUSH | ++ PIPE_CONTROL_VF_CACHE_INVALIDATE | + PIPE_CONTROL_TC_FLUSH | +- PIPE_CONTROL_NO_WRITE); ++ PIPE_CONTROL_NO_WRITE | ++ PIPE_CONTROL_CS_STALL); + OUT_BATCH(0); /* write address */ + OUT_BATCH(0); /* write data */ + ADVANCE_BATCH(); diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_intel_intel__context.c b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_intel_intel__context.c new file mode 100644 index 00000000000..c7bb09992f1 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_intel_intel__context.c @@ -0,0 +1,13 @@ +$NetBSD: patch-src_mesa_drivers_dri_intel_intel__context.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/intel/intel_context.c.orig 2011-11-23 01:10:52.000000000 +0000 ++++ src/mesa/drivers/dri/intel/intel_context.c +@@ -737,7 +737,7 @@ intelInitContext(struct intel_context *i + driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache, + sPriv->myNum, (intel->gen >= 4) ? "i965" : "i915"); + if (intel->gen < 4) +- intel->maxBatchSize = 4096; ++ intel->maxBatchSize = 2*4096; + else + intel->maxBatchSize = sizeof(intel->batch.map); + diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_intel_intel__context.h b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_intel_intel__context.h new file mode 100644 index 00000000000..b01f1b91960 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_intel_intel__context.h @@ -0,0 +1,27 @@ +$NetBSD: patch-src_mesa_drivers_dri_intel_intel__context.h,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/intel/intel_context.h.orig 2011-10-15 00:43:58.000000000 +0000 ++++ src/mesa/drivers/dri/intel/intel_context.h +@@ -304,8 +304,12 @@ struct intel_context + driOptionCache optionCache; + }; + ++#if defined(__sun) ++#include <stdlib.h> ++#define __progname getexecname() ++#else + extern char *__progname; +- ++#endif + + #define SUBPIXEL_X 0.125 + #define SUBPIXEL_Y 0.125 +@@ -364,7 +368,7 @@ do { \ + * than COPY_DWORDS would: + * XXX Put this in src/mesa/main/imports.h ??? + */ +-#if defined(i386) || defined(__i386__) ++#if (defined(i386) || defined(__i386__)) && !(defined(__SOLARIS__) || defined(sun)) + static INLINE void * __memcpy(void * to, const void * from, size_t n) + { + int d0, d1, d2; diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_mach64_mach64__context.h b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_mach64_mach64__context.h new file mode 100644 index 00000000000..6669110f484 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_dri_mach64_mach64__context.h @@ -0,0 +1,23 @@ +$NetBSD: patch-src_mesa_drivers_dri_mach64_mach64__context.h,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/drivers/dri/mach64/mach64_context.h.orig 2011-10-15 00:43:58.000000000 +0000 ++++ src/mesa/drivers/dri/mach64/mach64_context.h +@@ -37,7 +37,7 @@ + #include "mach64_drm.h" + + #include "main/mtypes.h" +- ++#include "main/macros.h" + #include "mach64_reg.h" + + #include "texmem.h" +@@ -298,6 +298,9 @@ extern GLboolean mach64UnbindContext( __ + #if defined(__OpenBSD__) || defined(__NetBSD__) + #include <machine/endian.h> + #define bswap_32 bswap32 ++#elif defined(__FreeBSD__) || defined(__DragonFly__) ++#include <sys/endian.h> ++#define bswap_32 bswap32 + #else + #include <byteswap.h> + #endif diff --git a/graphics/MesaLib7/patches/patch-src_mesa_drivers_x11_Makefile b/graphics/MesaLib7/patches/patch-src_mesa_drivers_x11_Makefile new file mode 100644 index 00000000000..48f1a86ec0e --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_drivers_x11_Makefile @@ -0,0 +1,16 @@ +$NetBSD: patch-src_mesa_drivers_x11_Makefile,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +Build the x11 version libGL.so with version numbering major 1 and minor 2, +the same a the glx version of libGL (simplifies PLIST handling). + +--- src/mesa/drivers/x11/Makefile.orig 2011-10-15 00:43:58.000000000 +0000 ++++ src/mesa/drivers/x11/Makefile +@@ -61,7 +61,7 @@ default: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME + + $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) $(CORE_MESA) + @ $(MKLIB) -o $(GL_LIB) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \ +- -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \ ++ -major 1 -minor 2 \ + -install $(TOP)/$(LIB_DIR) \ + -cplusplus $(MKLIB_OPTIONS) \ + -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).$(GL_MAJOR).dylib \ diff --git a/graphics/MesaLib7/patches/patch-src_mesa_main_compiler.h b/graphics/MesaLib7/patches/patch-src_mesa_main_compiler.h new file mode 100644 index 00000000000..72f30ad7155 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_main_compiler.h @@ -0,0 +1,47 @@ +$NetBSD: patch-src_mesa_main_compiler.h,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/main/compiler.h.orig 2011-11-23 01:09:52.000000000 +0000 ++++ src/mesa/main/compiler.h +@@ -248,7 +248,26 @@ extern "C" { + * Try to use a runtime test instead. + * For now, only used by some DRI hardware drivers for color/texel packing. + */ +-#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN ++#ifdef __sun ++#include <sys/isa_defs.h> ++#elif defined(__OpenBSD__) || defined(__NetBSD__) ++#include <machine/endian.h> ++#elif defined(__FreeBSD__) || defined(__DragonFly__) ++#include <sys/endian.h> ++#endif ++ ++#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) ++# if BYTE_ORDER == BIG_ENDIAN ++#define MESA_BIG_ENDIAN 1 ++# endif ++#elif defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) ++# if _BYTE_ORDER == _BIG_ENDIAN ++#define MESA_BIG_ENDIAN 1 ++# endif ++#elif defined(__sun) && defined(_BIG_ENDIAN) ++#define MESA_BIG_ENDIAN 1 ++#endif ++#if MESA_BIG_ENDIAN == 1 + #if defined(__linux__) + #include <byteswap.h> + #define CPU_TO_LE32( x ) bswap_32( x ) +@@ -263,11 +282,13 @@ static INLINE GLuint CPU_TO_LE32(GLuint + ((x & 0x00ff0000) >> 8) | + ((x & 0xff000000) >> 24)); + } ++#elif defined(__sun) ++#include <sys/byteorder.h> ++#define CPU_TO_LE32( x ) BSWAP_32( x ) + #else /*__linux__ */ + #include <sys/endian.h> + #define CPU_TO_LE32( x ) bswap32( x ) + #endif /*__linux__*/ +-#define MESA_BIG_ENDIAN 1 + #else + #define CPU_TO_LE32( x ) ( x ) + #define MESA_LITTLE_ENDIAN 1 diff --git a/graphics/MesaLib7/patches/patch-src_mesa_main_context.c b/graphics/MesaLib7/patches/patch-src_mesa_main_context.c new file mode 100644 index 00000000000..99a0ac05003 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_main_context.c @@ -0,0 +1,40 @@ +$NetBSD: patch-src_mesa_main_context.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +* Fix exit time segfault of qt5 application with modular xorg + +--- src/mesa/main/context.c.orig 2011-10-15 00:43:58.000000000 +0000 ++++ src/mesa/main/context.c +@@ -383,10 +383,10 @@ _glthread_DECLARE_STATIC_MUTEX(OneTimeLo + * + * \sa _math_init(). + */ ++static GLbitfield api_init_mask = 0x0; + static void + one_time_init( struct gl_context *ctx ) + { +- static GLbitfield api_init_mask = 0x0; + + _glthread_LOCK_MUTEX(OneTimeLock); + +@@ -441,14 +441,16 @@ one_time_init( struct gl_context *ctx ) + + _glthread_UNLOCK_MUTEX(OneTimeLock); + +- /* Hopefully atexit() is widely available. If not, we may need some +- * #ifdef tests here. +- */ +- atexit(_mesa_destroy_shader_compiler); +- + dummy_enum_func(); + } + ++static void __attribute__((__destructor__)) ++one_time_fini(void) ++{ ++ if (api_init_mask) ++ _mesa_destroy_shader_compiler(); ++} ++ + + /** + * Initialize fields of gl_current_attrib (aka ctx->Current.*) diff --git a/graphics/MesaLib7/patches/patch-src_mesa_main_imports.c b/graphics/MesaLib7/patches/patch-src_mesa_main_imports.c new file mode 100644 index 00000000000..24c05e5ffc7 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_main_imports.c @@ -0,0 +1,13 @@ +$NetBSD: patch-src_mesa_main_imports.c,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/main/imports.c.orig 2011-10-15 00:43:58.000000000 +0000 ++++ src/mesa/main/imports.c +@@ -514,7 +514,7 @@ _mesa_ffsll(int64_t val) + #endif + + #if !defined(__GNUC__) ||\ +- ((_GNUC__ == 3 && __GNUC_MINOR__ < 4) && __GNUC__ < 4) ++ ((__GNUC__ == 3 && __GNUC_MINOR__ < 4) && __GNUC__ < 4) + /** + * Return number of bits set in given GLuint. + */ diff --git a/graphics/MesaLib7/patches/patch-src_mesa_main_imports.h b/graphics/MesaLib7/patches/patch-src_mesa_main_imports.h new file mode 100644 index 00000000000..072a426b420 --- /dev/null +++ b/graphics/MesaLib7/patches/patch-src_mesa_main_imports.h @@ -0,0 +1,13 @@ +$NetBSD: patch-src_mesa_main_imports.h,v 1.1 2015/04/05 17:01:37 tnn Exp $ + +--- src/mesa/main/imports.h.orig 2011-10-15 00:43:58.000000000 +0000 ++++ src/mesa/main/imports.h +@@ -570,7 +570,7 @@ _mesa_init_sqrt_table(void); + #define _mesa_ffs(i) ffs(i) + #define _mesa_ffsll(i) ffsll(i) + +-#if ((_GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4) ++#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4) + #define _mesa_bitcount(i) __builtin_popcount(i) + #else + extern unsigned int |