pkgsrc-Bugs archive

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

pkg/50202: graphics/MesaLib can be upgraded to 10.6.5 and use libdevq on FreeBSD / DragonFly



>Number:         50202
>Category:       pkg
>Synopsis:       graphics/MesaLib can be upgraded to 10.6.5 and use libdevq on FreeBSD / DragonFly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 04 03:55:00 +0000 2015
>Originator:     David Shao
>Release:        pkgsrc current
>Organization:
>Environment:
DragonFly  4.3-DEVELOPMENT DragonFly v4.3.1.401.g3f4ec-DEVELOPMENT #2: Thu Sep  3 07:03:26 PDT 2015     xxxxxx@:/usr/obj/usr/src/sys/X86_64_GENERIC  x86_64

>Description:
MesaLib can be upgraded fairly easily to mesa 10.6.5, basically involving just the deletion of a couple of patches.  It should be because according to the mesa3d web site 10.5.9 is the end of the line for that branch, and users wishing further updates should switch to the 10.6 series.

10.6.5 has been working on systems using NetBSD 7.99.x with X11_TYPE=modular, FreeBSD 10.2 release, 10.2 stable, and 11 current, and DragonFly 4.3-DEVELOPMENT.  So far no systems running 10.5.7 have failed to run with 10.6.5, but it must be said that FreeBSD, Intel integrated graphics, and the latest MesaLib / modular-xorg-server do not seem compatible at the moment.  (There is an on-going effort to eventually update FreeBSD to Intel graphics Linux kernel 3.8 equivalents.  For 10.2 release that might require a port of a kernel module similar to what was done for the 9.x series.)

Patches no longer needed:
patch-src_gallium_include_pipe_p__config.h
patch-src_mesa_main_compiler.h

Files no longer distributed:
src/mapi/vgapi/vg.pc.in
include/GL/wmesa.h

There is a configuration file drirc that by default MesaLib looks for as /etc/drirc.  I have changed the Makefile for MesaLib so that MesaLib looks for this file in ${PREFIX}/etc and the file drirc is installed into ${PREFIX}/share/examples/MesaLib so that the user can choose whether or not to install it manually.

DragonFly dports suggests using gtar.

I have included patches to at least have an option to build glamor.  Note there is an additional buildlink3.mk for libelf, and that libelf needs the extra include directory fix I filed earlier as a problem report, else
#include <gelf.h>
will cause build failure.

I have included patches for MesaLib to use libdevq for FreeBSD and DragonFly.






>How-To-Repeat:

>Fix:
diff -Nurb MesaLib.orig/Makefile MesaLib/Makefile
--- MesaLib.orig/Makefile	2015-06-07 08:48:12.000000000 -0700
+++ MesaLib/Makefile	2015-08-24 13:48:38.852917000 -0700
@@ -1,6 +1,6 @@
 # $NetBSD: Makefile,v 1.104 2015/06/07 15:48:12 tnn Exp $
 
-DISTNAME=	mesa-10.5.7
+DISTNAME=	mesa-10.6.5
 PKGNAME=	${DISTNAME:S/mesa/MesaLib/}
 CATEGORIES=	graphics x11
 MASTER_SITES=	ftp://ftp.freedesktop.org/pub/mesa/${PKGVERSION_NOREV}/
@@ -16,6 +16,9 @@
 USE_LANGUAGES=	c99 c++
 USE_LIBTOOL=	yes
 
+EXTRACT_USING=	gtar
+INSTALLATION_DIRS+=	share/examples/MesaLib	
+
 GCC_REQD+=	4.2
 
 PKGCONFIG_OVERRIDE+=	src/egl/main/egl.pc.in
@@ -26,7 +29,7 @@
 PKGCONFIG_OVERRIDE+=	src/gbm/main/gbm.pc.in
 PKGCONFIG_OVERRIDE+=	src/mapi/es1api/glesv1_cm.pc.in
 PKGCONFIG_OVERRIDE+=	src/mapi/es2api/glesv2.pc.in
-PKGCONFIG_OVERRIDE+=	src/mapi/vgapi/vg.pc.in
+# PKGCONFIG_OVERRIDE+=	src/mapi/vgapi/vg.pc.in
 PKGCONFIG_OVERRIDE+=	src/mesa/drivers/dri/dri.pc.in
 PKGCONFIG_OVERRIDE+=	src/mesa/drivers/osmesa/osmesa.pc.in
 PKGCONFIG_OVERRIDE+=	src/mesa/gl.pc.in
@@ -45,6 +48,14 @@
 SUBST_SED.wrapper-bug+=		-e 's,libglapi.la,libglapi_static.la,g'
 SUBST_SED.wrapper-bug+=		-e 's,libglapi_shared.la,libglapi.la,g'
 
+# Replace /etc/drirc with ${PREFIX}/etc/drirc
+
+SUBST_CLASSES+=			drirc	
+SUBST_STAGE.drirc=		post-patch
+SUBST_MESSAGE.drirc=		Patching /etc/drirc 
+SUBST_FILES.drirc+=		src/mesa/drivers/dri/common/xmlconfig.c
+SUBST_SED.drirc+=		 -e 's|/etc/|${PREFIX}/etc/|g'
+
 .include "../../mk/bsd.prefs.mk"
 .include "../../mk/compiler.mk"
 .include "options.mk"
@@ -77,6 +88,9 @@
 CPPFLAGS+=	-Dexp2f\(x\)=expf\(\(x\)\*M_LN2\)
 .endif
 
+post-install:
+	${INSTALL_DATA} ${WRKSRC}/src/mesa/drivers/dri/common/drirc ${DESTDIR}${PREFIX}/share/examples/MesaLib
+
 .include "../../x11/libX11/buildlink3.mk"
 .include "../../x11/libXext/buildlink3.mk"
 .include "../../x11/libxcb/buildlink3.mk"

diff -Nurb MesaLib.orig/PLIST MesaLib/PLIST
--- MesaLib.orig/PLIST	2015-04-25 04:19:18.000000000 -0700
+++ MesaLib/PLIST	2015-08-17 03:01:25.616875000 -0700
@@ -1,4 +1,5 @@
 @comment $NetBSD: PLIST,v 1.27 2015/04/25 11:19:18 tnn Exp $
+share/examples/MesaLib/drirc
 include/EGL/egl.h
 include/EGL/eglext.h
 include/EGL/eglextchromium.h
@@ -14,7 +15,6 @@
 ${PLIST.dri}include/GL/internal/dri_interface.h
 include/GL/osmesa.h
 include/GL/wglext.h
-include/GL/wmesa.h
 include/KHR/khrplatform.h
 ${PLIST.dri}include/gbm.h
 ${PLIST.i915_dri}lib/dri/i915_dri.so

diff -Nurb MesaLib.orig/dri.mk MesaLib/dri.mk
--- MesaLib.orig/dri.mk	2015-06-22 15:45:06.000000000 -0700
+++ MesaLib/dri.mk	2015-08-12 23:15:12.116190000 -0700
@@ -35,4 +35,8 @@
 .    include "../../x11/presentproto/buildlink3.mk"
 .    include "../../x11/libxshmfence/buildlink3.mk"
 .  endif
+.  if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
+.    include "../../x11/libxshmfence/buildlink3.mk"
+.    include "../../devel/libdevq/buildlink3.mk"
+.  endif
 .endif

diff -Nurb MesaLib.orig/options.mk MesaLib/options.mk
--- MesaLib.orig/options.mk	2015-05-28 14:09:07.000000000 -0700
+++ MesaLib/options.mk	2015-08-23 11:48:48.398817000 -0700
@@ -2,6 +2,7 @@
 
 PKG_OPTIONS_VAR=		PKG_OPTIONS.MesaLib
 PKG_SUPPORTED_OPTIONS=		llvm dri
+PKG_SUPPORTED_OPTIONS+=		glamor debug
 PKG_SUGGESTED_OPTIONS=
 
 .if !empty(MACHINE_PLATFORM:MNetBSD-[789].*-*) && (	\
@@ -28,10 +29,25 @@
 
 .if !empty(PKG_OPTIONS:Mdri)
 
+.if !empty(PKG_OPTIONS:Mglamor)
+# Recommended by
+# http://www.freedesktop.org/wiki/Software/Glamor/
+CONFIGURE_ARGS+=	--enable-gbm
+CONFIGURE_ARGS+=	--enable-shared-glapi
+CONFIGURE_ARGS+=	--enable-glx-tls
+
+.else
+
 # (EE) Failed to load /usr/pkg/lib/xorg/modules/extensions/libglx.so:
 # /usr/pkg/lib/libGL.so.1: Use of initialized Thread Local Storage with model initial-exec and dlopen is not supported
 CONFIGURE_ARGS+=	--disable-glx-tls
 
+.endif
+
+.if !empty(PKG_OPTIONS:Mdebug)
+CFLAGS+=	-DDEBUG -O0 -g3
+.endif
+
 PLIST.dri=	yes
 
 BUILDLINK_DEPMETHOD.libpciaccess=      full
@@ -114,6 +130,7 @@
 GALLIUM_DRIVERS+=	radeonsi
 CONFIGURE_ARGS+=	--enable-gallium-llvm
 CONFIGURE_ARGS+=	--enable-r600-llvm-compiler
+.include "../../devel/libelf/buildlink3.mk"
 .include "../../lang/libLLVM/buildlink3.mk"
 CONFIGURE_ENV+=		ac_cv_path_ac_pt_LLVM_CONFIG=${LLVM_CONFIG_PATH}
 .else # !llvm

diff -Nurb MesaLib.orig/patches/patch-configure MesaLib/patches/patch-configure
--- MesaLib.orig/patches/patch-configure	2015-04-25 04:19:18.000000000 -0700
+++ MesaLib/patches/patch-configure	2015-08-14 17:47:50.800458000 -0700
@@ -1,10 +1,45 @@
-$NetBSD: patch-configure,v 1.1 2015/04/25 11:19:18 tnn Exp $
+$NetBSD$
 
-Make sure toolchain can assemble SSE stuff in addition to having intrinsics.
-
---- configure.orig	2015-03-28 18:43:34.000000000 +0000
+--- configure.orig	2015-08-11 15:40:48.000000000 +0000
 +++ configure
-@@ -19578,7 +19578,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
+@@ -858,6 +858,8 @@ GLPROTO_LIBS
+ GLPROTO_CFLAGS
+ XLIBGL_LIBS
+ XLIBGL_CFLAGS
++LIBDEVQ_LIBS
++LIBDEVQ_CFLAGS
+ LIBUDEV_LIBS
+ LIBUDEV_CFLAGS
+ MESA_LLVM
+@@ -1154,6 +1156,8 @@ LIBDRM_CFLAGS
+ LIBDRM_LIBS
+ LIBUDEV_CFLAGS
+ LIBUDEV_LIBS
++LIBDEVQ_CFLAGS
++LIBDEVQ_LIBS
+ XLIBGL_CFLAGS
+ XLIBGL_LIBS
+ GLPROTO_CFLAGS
+@@ -1957,6 +1961,10 @@ Some influential environment variables:
+               C compiler flags for LIBUDEV, overriding pkg-config
+   LIBUDEV_LIBS
+               linker flags for LIBUDEV, overriding pkg-config
++  LIBDEVQ_CFLAGS
++              C compiler flags for LIBDEVQ, overriding pkg-config
++  LIBDEVQ_LIBS
++              linker flags for LIBDEVQ, overriding pkg-config
+   XLIBGL_CFLAGS
+               C compiler flags for XLIBGL, overriding pkg-config
+   XLIBGL_LIBS linker flags for XLIBGL, overriding pkg-config
+@@ -5231,6 +5239,7 @@ DRI2PROTO_REQUIRED=2.6
+ DRI3PROTO_REQUIRED=1.0
+ PRESENTPROTO_REQUIRED=1.0
+ LIBUDEV_REQUIRED=151
++LIBDEVQ_REQUIRED=0.0.2
+ GLPROTO_REQUIRED=1.4.14
+ LIBOMXIL_BELLAGIO_REQUIRED=0.0
+ LIBVA_REQUIRED=0.35.0
+@@ -19694,7 +19703,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
  #include <smmintrin.h>
  int main () {
      __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
@@ -13,12 +48,133 @@
      return 0;
  }
  _ACEOF
-@@ -23563,7 +23563,7 @@ if test "x$enable_nine" = xyes; then
-     if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
-         as_fn_error $? "nine requires the gallium swrast driver" "$LINENO" 5
+@@ -20466,7 +20475,7 @@ _ACEOF
+ $as_echo_n "checking if more special flags are required for pthreads... " >&6; }
+         flag=no
+         case ${host_os} in
+-            aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
++            aix* | freebsd* | dragonfly* | darwin*) flag="-D_THREAD_SAFE";;
+             osf* | hpux*) flag="-D_REENTRANT";;
+             solaris*)
+             if test "$GCC" = "yes"; then
+@@ -21269,6 +21278,7 @@ linux*)
+ esac
+ 
+ 
++
+ pkg_failed=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUDEV" >&5
+ $as_echo_n "checking for LIBUDEV... " >&6; }
+@@ -21340,6 +21350,82 @@ $as_echo "yes" >&6; }
+ 	have_libudev=yes
+ fi
+ 
++
++
++# Check for libdevq
++
++pkg_failed=no
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDEVQ" >&5
++$as_echo_n "checking for LIBDEVQ... " >&6; }
++if test -n "$LIBDEVQ_CFLAGS"; then
++    pkg_cv_LIBDEVQ_CFLAGS="$LIBDEVQ_CFLAGS"
++ elif test -n "$PKG_CONFIG"; then
++    if test -n "$PKG_CONFIG" && \
++    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq >= \$LIBDEVQ_REQUIRED\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "libdevq >= $LIBDEVQ_REQUIRED") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
++  pkg_cv_LIBDEVQ_CFLAGS=`$PKG_CONFIG --cflags "libdevq >= $LIBDEVQ_REQUIRED" 2>/dev/null`
++		      test "x$?" != "x0" && pkg_failed=yes
++else
++  pkg_failed=yes
++fi
++ else
++    pkg_failed=untried
++fi
++if test -n "$LIBDEVQ_LIBS"; then
++    pkg_cv_LIBDEVQ_LIBS="$LIBDEVQ_LIBS"
++ elif test -n "$PKG_CONFIG"; then
++    if test -n "$PKG_CONFIG" && \
++    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdevq >= \$LIBDEVQ_REQUIRED\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "libdevq >= $LIBDEVQ_REQUIRED") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
++  pkg_cv_LIBDEVQ_LIBS=`$PKG_CONFIG --libs "libdevq >= $LIBDEVQ_REQUIRED" 2>/dev/null`
++		      test "x$?" != "x0" && pkg_failed=yes
++else
++  pkg_failed=yes
++fi
++ else
++    pkg_failed=untried
++fi
++
++
++
++if test $pkg_failed = yes; then
++   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
++        _pkg_short_errors_supported=yes
++else
++        _pkg_short_errors_supported=no
++fi
++        if test $_pkg_short_errors_supported = yes; then
++	        LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdevq >= $LIBDEVQ_REQUIRED" 2>&1`
++        else
++	        LIBDEVQ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdevq >= $LIBDEVQ_REQUIRED" 2>&1`
++        fi
++	# Put the nasty error message in config.log where it belongs
++	echo "$LIBDEVQ_PKG_ERRORS" >&5
++
++	have_libdevq=no
++elif test $pkg_failed = untried; then
++     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++	have_libdevq=no
++else
++	LIBDEVQ_CFLAGS=$pkg_cv_LIBDEVQ_CFLAGS
++	LIBDEVQ_LIBS=$pkg_cv_LIBDEVQ_LIBS
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++	have_libdevq=yes
++fi
++
++
++
+ # Check whether --enable-sysfs was given.
+ if test "${enable_sysfs+set}" = set; then :
+   enableval=$enable_sysfs; have_sysfs="$enableval"
+@@ -22055,6 +22141,10 @@ if test "$have_libudev" = yes; then
+     DEFINES="$DEFINES -DHAVE_LIBUDEV"
+     have_pci_id=yes
+ fi
++if test "$have_libdevq" = yes; then
++    DEFINES="$DEFINES -DHAVE_LIBDEVQ"
++    have_pci_id=yes
++fi
+ 
+ if test "$have_sysfs" = yes; then
+     DEFINES="$DEFINES -DHAVE_SYSFS"
+@@ -23002,6 +23092,8 @@ fi
+ 
+ if test "x$need_pci_id$have_libudev" = xyesyes; then
+     GBM_PC_REQ_PRIV="libudev >= $LIBUDEV_REQUIRED"
++elif test "x$need_libdevq" = xyes; then
++    GBM_PC_REQ_PRIV="libdevq >= $LIBDEVQ_REQUIRED"
+ else
+     GBM_PC_REQ_PRIV=""
+ fi
+@@ -24554,9 +24646,6 @@ fi
+                 CLANG_LIBDIR=${LLVM_LIBDIR}
      fi
--    if test "x$with_gallium_drivers" == xswrast; then
-+    if test "x$with_gallium_drivers" = xswrast; then
-         as_fn_error $? "nine requires at least one non-swrast gallium driver" "$LINENO" 5
+             CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
+-            if test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"; then :
+-  as_fn_error $? "Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries." "$LINENO" 5
+-fi
      fi
-     if test "x$enable_dri3" = xno; then
+     else
+         MESA_LLVM=0

diff -Nurb MesaLib.orig/patches/patch-src_gallium_auxiliary_util_u__cpu__detect.c MesaLib/patches/patch-src_gallium_auxiliary_util_u__cpu__detect.c
--- MesaLib.orig/patches/patch-src_gallium_auxiliary_util_u__cpu__detect.c	1969-12-31 16:00:00.000000000 -0800
+++ MesaLib/patches/patch-src_gallium_auxiliary_util_u__cpu__detect.c	2015-07-29 14:13:18.281968000 -0700
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/gallium/auxiliary/util/u_cpu_detect.c.orig	2015-07-29 21:10:43.953534000 +0000
++++ src/gallium/auxiliary/util/u_cpu_detect.c
+@@ -52,7 +52,7 @@
+ #include <machine/cpu.h>
+ #endif
+ 
+-#if defined(PIPE_OS_FREEBSD)
++#if defined(PIPE_OS_FREEBSD) || defined(PIPE_OS_DRAGONFLY)
+ #include <sys/types.h>
+ #include <sys/sysctl.h>
+ #endif
diff -Nurb MesaLib.orig/patches/patch-src_gallium_auxiliary_util_u__math.h MesaLib/patches/patch-src_gallium_auxiliary_util_u__math.h
--- MesaLib.orig/patches/patch-src_gallium_auxiliary_util_u__math.h	2015-05-11 14:33:58.000000000 -0700
+++ MesaLib/patches/patch-src_gallium_auxiliary_util_u__math.h	2015-08-10 21:07:35.260225000 -0700
@@ -1,23 +1,21 @@
-$NetBSD: patch-src_gallium_auxiliary_util_u__math.h,v 1.2 2015/05/11 21:33:58 tnn Exp $
+$NetBSD$
 
-The C99 "restrict" keyword is not valid in C++, but most compilers will
-understand __restrict.
-
---- src/gallium/auxiliary/util/u_math.h.orig   2015-03-28 18:20:39.000000000 +0000
+--- src/gallium/auxiliary/util/u_math.h.orig	2015-07-26 13:32:59.000000000 +0000
 +++ src/gallium/auxiliary/util/u_math.h
-@@ -528,7 +528,10 @@ unsigned ffs( unsigned u )
+@@ -384,6 +384,12 @@ unsigned ffs( unsigned u )
  
     return i;
  }
--#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID)
 +#elif defined(__NetBSD__)
 +#include <sys/bitops.h>
 +#define ffsll ffs64
 +#elif defined(__GNUC__)
++#define ffs __builtin_ffs
++#define ffsll __builtin_ffsll
+ #elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID) || \
+     defined(HAVE___BUILTIN_FFS)
  #define ffs __builtin_ffs
- #define ffsll __builtin_ffsll
- #endif
-@@ -821,6 +824,11 @@ util_bswap16(uint16_t n)
+@@ -690,6 +696,11 @@ util_bswap16(uint16_t n)
            (n << 8);
  }
  
@@ -29,7 +27,7 @@
  static INLINE void*
  util_memcpy_cpu_to_le32(void * restrict dest, const void * restrict src, size_t n)
  {
-@@ -839,6 +847,11 @@ util_memcpy_cpu_to_le32(void * restrict 
+@@ -708,6 +719,11 @@ util_memcpy_cpu_to_le32(void * restrict
  #endif
  }
  
diff -Nurb MesaLib.orig/patches/patch-src_loader_Makefile.am MesaLib/patches/patch-src_loader_Makefile.am
--- MesaLib.orig/patches/patch-src_loader_Makefile.am	1969-12-31 16:00:00.000000000 -0800
+++ MesaLib/patches/patch-src_loader_Makefile.am	2015-08-11 18:05:07.939169000 -0700
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- src/loader/Makefile.am.orig	2015-08-12 00:54:19.197784000 +0000
++++ src/loader/Makefile.am
+@@ -30,7 +30,9 @@ libloader_la_CPPFLAGS = \
+ 	-I$(top_srcdir)/include \
+ 	-I$(top_srcdir)/src \
+ 	$(VISIBILITY_CFLAGS) \
+-	$(LIBUDEV_CFLAGS)
++	$(LIBUDEV_CFLAGS) \
++	$(LIBDEVQ_CFLAGS)
++
+ 
+ libloader_la_SOURCES = $(LOADER_C_FILES)
+ libloader_la_LIBADD =
diff -Nurb MesaLib.orig/patches/patch-src_loader_Makefile.in MesaLib/patches/patch-src_loader_Makefile.in
--- MesaLib.orig/patches/patch-src_loader_Makefile.in	1969-12-31 16:00:00.000000000 -0800
+++ MesaLib/patches/patch-src_loader_Makefile.in	2015-08-11 18:05:13.259098000 -0700
@@ -0,0 +1,22 @@
+$NetBSD$
+
+--- src/loader/Makefile.in.orig	2015-08-12 00:50:19.110973000 +0000
++++ src/loader/Makefile.in
+@@ -319,6 +319,8 @@ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+ LIBCLC_INCLUDEDIR = @LIBCLC_INCLUDEDIR@
+ LIBCLC_LIBEXECDIR = @LIBCLC_LIBEXECDIR@
++LIBDEVQ_CFLAGS = @LIBDEVQ_CFLAGS@
++LIBDEVQ_LIBS = @LIBDEVQ_LIBS@
+ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+ LIBDRM_LIBS = @LIBDRM_LIBS@
+ LIBOBJS = @LIBOBJS@
+@@ -508,7 +510,7 @@ EXTRA_DIST = SConscript
+ noinst_LTLIBRARIES = libloader.la
+ libloader_la_CPPFLAGS = $(DEFINES) -I$(top_srcdir)/include \
+ 	-I$(top_srcdir)/src $(VISIBILITY_CFLAGS) $(LIBUDEV_CFLAGS) \
+-	$(am__append_1) $(am__append_3) $(am__append_4)
++	$(LIBDEVQ_CFLAGS) $(am__append_1) $(am__append_3) $(am__append_4)
+ libloader_la_SOURCES = $(LOADER_C_FILES)
+ libloader_la_LIBADD = $(am__append_2) $(am__append_5)
+ all: all-am
diff -Nurb MesaLib.orig/patches/patch-src_loader_loader.c MesaLib/patches/patch-src_loader_loader.c
--- MesaLib.orig/patches/patch-src_loader_loader.c	1969-12-31 16:00:00.000000000 -0800
+++ MesaLib/patches/patch-src_loader_loader.c	2015-08-11 22:33:43.181869000 -0700
@@ -0,0 +1,80 @@
+$NetBSD$
+
+--- src/loader/loader.c.orig	2015-07-26 13:32:59.000000000 +0000
++++ src/loader/loader.c
+@@ -68,7 +68,7 @@
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <string.h>
+-#ifdef HAVE_LIBUDEV
++#if defined(HAVE_LIBUDEV) || defined(HAVE_LIBDEVQ)
+ #include <assert.h>
+ #include <dlfcn.h>
+ #include <fcntl.h>
+@@ -501,6 +501,53 @@ sysfs_get_pci_id_for_fd(int fd, int *ven
+ }
+ #endif
+ 
++#if defined(HAVE_LIBDEVQ)
++#include <libdevq.h>
++
++static void *devq_handle = NULL;
++
++static void *
++devq_dlopen_handle(void)
++{
++   if (!devq_handle) {
++      devq_handle = dlopen("libdevq.so.0", RTLD_LOCAL | RTLD_LAZY);
++   }
++
++   return devq_handle;
++}
++
++static void *
++asserted_dlsym(void *dlopen_handle, const char *name)
++{
++   void *result = dlsym(dlopen_handle, name);
++   assert(result);
++   return result;
++}
++
++#define DEVQ_SYMBOL(ret, name, args) \
++   ret (*name) args = asserted_dlsym(devq_dlopen_handle(), #name);
++
++static int
++devq_get_pci_id_from_fd(int fd, int *vendor_id, int *chip_id)
++{
++   int ret;
++   DEVQ_SYMBOL(int, devq_device_get_pciid_from_fd,
++               (int fd, int *vendor_id, int *chip_id));
++
++   *chip_id = -1;
++
++   ret = devq_device_get_pciid_from_fd(fd, vendor_id, chip_id);
++   if (ret < 0) {
++      log_(_LOADER_WARNING, "MESA-LOADER: could not get PCI ID\n");
++      goto out;
++   }
++
++out:
++   return (*chip_id >= 0);
++}
++
++#endif
++
+ #if !defined(__NOT_HAVE_DRM_H)
+ /* for i915 */
+ #include <i915_drm.h>
+@@ -584,6 +631,12 @@ loader_get_pci_id_for_fd(int fd, int *ve
+    if (sysfs_get_pci_id_for_fd(fd, vendor_id, chip_id))
+       return 1;
+ #endif
++
++#if HAVE_LIBDEVQ
++   if (devq_get_pci_id_from_fd(fd, vendor_id, chip_id))
++      return 1;
++#endif
++
+ #if !defined(__NOT_HAVE_DRM_H)
+    if (drm_get_pci_id_for_fd(fd, vendor_id, chip_id))
+       return 1;
diff -Nurb MesaLib.orig/patches/patch-src_mapi_glapi_gen_gl__gentable.py MesaLib/patches/patch-src_mapi_glapi_gen_gl__gentable.py
--- MesaLib.orig/patches/patch-src_mapi_glapi_gen_gl__gentable.py	1969-12-31 16:00:00.000000000 -0800
+++ MesaLib/patches/patch-src_mapi_glapi_gen_gl__gentable.py	2015-07-29 14:30:33.644982000 -0700
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/mapi/glapi/gen/gl_gentable.py.orig	2015-07-29 21:28:50.156039000 +0000
++++ src/mapi/glapi/gen/gl_gentable.py
+@@ -42,7 +42,7 @@ header = """/* GLXEXT is the define used
+ #endif
+ 
+ #if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \\
+-	|| (!defined(GLXEXT) && defined(DEBUG) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__))
++	|| (!defined(GLXEXT) && defined(DEBUG) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__DragonFly__))
+ #define USE_BACKTRACE
+ #endif
+ 
diff -Nurb MesaLib.orig/patches/patch-src_mesa_drivers_dri_Makefile.in MesaLib/patches/patch-src_mesa_drivers_dri_Makefile.in
--- MesaLib.orig/patches/patch-src_mesa_drivers_dri_Makefile.in	2015-04-25 04:19:18.000000000 -0700
+++ MesaLib/patches/patch-src_mesa_drivers_dri_Makefile.in	2015-07-29 22:44:01.671595000 -0700
@@ -1,12 +1,9 @@
-$NetBSD: patch-src_mesa_drivers_dri_Makefile.in,v 1.1 2015/04/25 11:19:18 tnn Exp $
+$NetBSD$
 
-DRI drivers need explicit linkage to glapi. FDO bug 57702. We only need to do
-this for the "mega" drivers since that's where final linking takes place.
-
---- src/mesa/drivers/dri/Makefile.in.orig	2015-03-28 18:43:41.000000000 +0000
+--- src/mesa/drivers/dri/Makefile.in.orig	2015-07-04 11:11:08.000000000 +0000
 +++ src/mesa/drivers/dri/Makefile.in
-@@ -581,6 +581,7 @@ mesa_dri_drivers_la_LIBADD = \
-         common/libdricommon.la \
+@@ -583,6 +583,7 @@ mesa_dri_drivers_la_LIBADD = \
+         common/libxmlconfig.la \
          $(MEGADRIVERS_DEPS) \
          $(DRI_LIB_DEPS) \
 +         $(top_srcdir)/src/mapi/shared-glapi/libglapi.la \

diff -Nurb MesaLib.orig/patches/patch-src_mesa_drivers_dri_common_xmlconfig.c MesaLib/patches/patch-src_mesa_drivers_dri_common_xmlconfig.c
--- MesaLib.orig/patches/patch-src_mesa_drivers_dri_common_xmlconfig.c	2015-04-25 04:19:18.000000000 -0700
+++ MesaLib/patches/patch-src_mesa_drivers_dri_common_xmlconfig.c	2015-08-10 21:10:48.897901000 -0700
@@ -1,15 +1,22 @@
-$NetBSD: patch-src_mesa_drivers_dri_common_xmlconfig.c,v 1.1 2015/04/25 11:19:18 tnn Exp $
+$NetBSD$
 
-Fix broken ifdef.
-
---- src/mesa/drivers/dri/common/xmlconfig.c.orig	2015-03-28 18:20:39.000000000 +0000
+--- src/mesa/drivers/dri/common/xmlconfig.c.orig	2015-07-14 18:10:47.000000000 +0000
 +++ src/mesa/drivers/dri/common/xmlconfig.c
-@@ -53,7 +53,7 @@ extern char *program_invocation_name, *p
+@@ -50,12 +50,17 @@ extern char *program_invocation_name, *p
+ #    define GET_PROGRAM_NAME() program_invocation_short_name
+ #elif defined(__CYGWIN__)
+ #    define GET_PROGRAM_NAME() program_invocation_short_name
++/*
+ #elif defined(__FreeBSD__) && (__FreeBSD__ >= 2)
+ #    include <osreldate.h>
+ #    if (__FreeBSD_version >= 440000)
  #        include <stdlib.h>
  #        define GET_PROGRAM_NAME() getprogname()
  #    endif
--#elif defined(__NetBSD__) && defined(__NetBSD_Version) && (__NetBSD_Version >= 106000100)
-+#elif defined(__NetBSD__) && defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106000100)
++*/
++#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
++#    include <stdlib.h>
++#    define GET_PROGRAM_NAME() getprogname()
+ #elif defined(__NetBSD__) && defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106000100)
  #    include <stdlib.h>
  #    define GET_PROGRAM_NAME() getprogname()
- #elif defined(__APPLE__)

diff -Nurb MesaLib.orig/patches/patch-src_mesa_x86_common__x86.c MesaLib/patches/patch-src_mesa_x86_common__x86.c
--- MesaLib.orig/patches/patch-src_mesa_x86_common__x86.c	2015-04-25 04:19:18.000000000 -0700
+++ MesaLib/patches/patch-src_mesa_x86_common__x86.c	2015-08-10 21:11:52.497137000 -0700
@@ -1,15 +1,22 @@
-$NetBSD: patch-src_mesa_x86_common__x86.c,v 1.1 2015/04/25 11:19:18 tnn Exp $
+$NetBSD$
 
-Treat NetBSD like OpenBSD.
-
---- src/mesa/x86/common_x86.c.orig	2015-03-28 18:20:39.000000000 +0000
+--- src/mesa/x86/common_x86.c.orig	2015-07-14 18:10:47.000000000 +0000
 +++ src/mesa/x86/common_x86.c
-@@ -42,7 +42,7 @@
+@@ -38,7 +38,7 @@
+ #if defined(USE_SSE_ASM) && defined(__linux__)
+ #include <linux/version.h>
+ #endif
+-#if defined(USE_SSE_ASM) && defined(__FreeBSD__)
++#if defined(USE_SSE_ASM) && (defined(__FreeBSD__) || defined(__DragonFly__))
  #include <sys/types.h>
  #include <sys/sysctl.h>
  #endif
--#if defined(USE_SSE_ASM) && defined(__OpenBSD__)
-+#if defined(USE_SSE_ASM) && (defined(__OpenBSD__) || defined(__NetBSD__))
- #include <sys/param.h>
- #include <sys/sysctl.h>
- #include <machine/cpu.h>
+@@ -128,7 +128,7 @@ static LONG WINAPI ExceptionFilter(LPEXC
+  */
+ void _mesa_check_os_sse_support( void )
+ {
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__DragonFly__)
+    {
+       int ret, enabled;
+       unsigned int len;



Home | Main Index | Thread Index | Old Index