pkgsrc-WIP-changes archive

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

MesaLib-dfbsd: Update wip/MesaLib-dfbsd to 18.3.6



Module Name:	pkgsrc-wip
Committed By:	David Shao <davshao%gmail.com@localhost>
Pushed By:	dshao
Date:		Mon Jul 22 22:05:32 2019 -0700
Changeset:	ecafd1a58aca6a26b297141f81ca263ec7d522e1

Modified Files:
	MesaLib-dfbsd/Makefile
	MesaLib-dfbsd/PLIST
	MesaLib-dfbsd/TODO
	MesaLib-dfbsd/builtin.mk
	MesaLib-dfbsd/distinfo
	MesaLib-dfbsd/options.mk
	MesaLib-dfbsd/patches/patch-include_GL_internal_dri__interface.h
	MesaLib-dfbsd/patches/patch-meson.build
	MesaLib-dfbsd/patches/patch-src_amd_vulkan_radv__device.c
	MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__format__tests.c
	MesaLib-dfbsd/patches/patch-src_gallium_drivers_freedreno_freedreno__screen.c
	MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__compute__blit.c
	MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__pipe.c
	MesaLib-dfbsd/patches/patch-src_glx_glxext.c
	MesaLib-dfbsd/patches/patch-src_intel_vulkan_anv__device.c
	MesaLib-dfbsd/patches/patch-src_mesa_main_context.c
	MesaLib-dfbsd/patches/patch-src_util_u__thread.h
	MesaLib-dfbsd/patches/patch-src_util_xmlconfig.c
Added Files:
	MesaLib-dfbsd/patches/patch-configure.ac
	MesaLib-dfbsd/patches/patch-src_amd_common_ac__llvm__util.c
	MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__helpers.c
	MesaLib-dfbsd/patches/patch-src_gbm_Makefile.am
	MesaLib-dfbsd/patches/patch-src_gbm_backends_dri_gbm__dri.c
	MesaLib-dfbsd/patches/patch-src_glx_Makefile.am
	MesaLib-dfbsd/patches/patch-src_intel_Makefile.tools.am
	MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c
	MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_brw__performance__query.c
	MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c
	MesaLib-dfbsd/patches/patch-src_mesa_drivers_x11_Makefile.am
	MesaLib-dfbsd/patches/patch-src_util_Makefile.am
	MesaLib-dfbsd/patches/patch-src_util_futex.h
	MesaLib-dfbsd/patches/patch-src_util_u__math.h
Removed Files:
	MesaLib-dfbsd/patches/patch-src_gallium_drivers_iris_meson.build
	MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_meson.build
	MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__buffer.c
	MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__dma__cs.c
	MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__gfx__cs.c
	MesaLib-dfbsd/patches/patch-src_intel_isl_isl__tiled__memcpy.c
	MesaLib-dfbsd/patches/patch-src_intel_perf_gen__perf.h
	MesaLib-dfbsd/patches/patch-src_mapi_entry__x86__tsd.h
	MesaLib-dfbsd/patches/patch-src_util_ralloc.h

Log Message:
MesaLib-dfbsd: Update wip/MesaLib-dfbsd to 18.3.6

Changes:
* Knobs for NetBSD xsrc patches
* Knobs for MesaLib18 pkgsrc
* Idea is to figure out exactly what is still needed on NetBSD
  to merge xsrc and pkgsrc

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=ecafd1a58aca6a26b297141f81ca263ec7d522e1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 MesaLib-dfbsd/Makefile                             |  78 ++-----------
 MesaLib-dfbsd/PLIST                                |   7 +-
 MesaLib-dfbsd/TODO                                 |  16 ++-
 MesaLib-dfbsd/builtin.mk                           |   4 +-
 MesaLib-dfbsd/distinfo                             |  55 +++++----
 MesaLib-dfbsd/options.mk                           |  63 ++++------
 MesaLib-dfbsd/patches/patch-configure.ac           | 127 +++++++++++++++++++++
 .../patch-include_GL_internal_dri__interface.h     |   6 +-
 MesaLib-dfbsd/patches/patch-meson.build            |  16 ++-
 .../patches/patch-src_amd_common_ac__llvm__util.c  |  20 ++++
 .../patches/patch-src_amd_vulkan_radv__device.c    |   8 +-
 ...h-src_gallium_auxiliary_util_u__format__tests.c |   4 +-
 .../patch-src_gallium_auxiliary_util_u__helpers.c  |  34 ++++++
 ...c_gallium_drivers_freedreno_freedreno__screen.c |   6 +-
 .../patch-src_gallium_drivers_iris_meson.build     |  22 ----
 .../patch-src_gallium_drivers_nouveau_meson.build  |  13 ---
 ...patch-src_gallium_drivers_radeonsi_si__buffer.c |  65 -----------
 ...rc_gallium_drivers_radeonsi_si__compute__blit.c |  42 ++++---
 ...atch-src_gallium_drivers_radeonsi_si__dma__cs.c |  22 ----
 ...atch-src_gallium_drivers_radeonsi_si__gfx__cs.c |  38 ------
 .../patch-src_gallium_drivers_radeonsi_si__pipe.c  |  64 ++++-------
 MesaLib-dfbsd/patches/patch-src_gbm_Makefile.am    |  12 ++
 .../patches/patch-src_gbm_backends_dri_gbm__dri.c  |  21 ++++
 MesaLib-dfbsd/patches/patch-src_glx_Makefile.am    |  49 ++++++++
 MesaLib-dfbsd/patches/patch-src_glx_glxext.c       |   2 +-
 .../patches/patch-src_intel_Makefile.tools.am      |  14 +++
 .../patch-src_intel_isl_isl__tiled__memcpy.c       |  26 -----
 .../patches/patch-src_intel_perf_gen__perf.h       |  14 ---
 .../patches/patch-src_intel_vulkan_anv__device.c   |  14 +--
 .../patches/patch-src_mapi_entry__x86__tsd.h       |  86 --------------
 ...ch-src_mesa_drivers_dri_i965_brw__oa__metrics.c |  13 +++
 ...mesa_drivers_dri_i965_brw__performance__query.c |  72 ++++++++++++
 ...rc_mesa_drivers_dri_i965_intel__tiled__memcpy.c |  26 +++++
 .../patches/patch-src_mesa_drivers_x11_Makefile.am |  15 +++
 .../patches/patch-src_mesa_main_context.c          |   8 +-
 MesaLib-dfbsd/patches/patch-src_util_Makefile.am   |  15 +++
 MesaLib-dfbsd/patches/patch-src_util_futex.h       |  53 +++++++++
 MesaLib-dfbsd/patches/patch-src_util_ralloc.h      |  51 ---------
 MesaLib-dfbsd/patches/patch-src_util_u__math.h     |  25 ++++
 MesaLib-dfbsd/patches/patch-src_util_u__thread.h   |  18 +--
 MesaLib-dfbsd/patches/patch-src_util_xmlconfig.c   |  11 +-
 41 files changed, 672 insertions(+), 583 deletions(-)

diffs:
diff --git a/MesaLib-dfbsd/Makefile b/MesaLib-dfbsd/Makefile
index 70df10a91a..3c54a12490 100644
--- a/MesaLib-dfbsd/Makefile
+++ b/MesaLib-dfbsd/Makefile
@@ -1,70 +1,10 @@
 # $NetBSD: Makefile,v 1.20 2019/04/25 07:32:56 maya Exp $
 
-# 2019-05-11	nir: Fix wrong sign in lower_rcp
-# COMMIT_ID=	974c4d679c23373dbed386c696e3e3bc1bfa23ae
-
-# 2019-05-10	intel: drop misleading driver name from gen_get_device_info()
-# COMMIT_ID=	7b2468bf6e58b0b178f8f498fca92c9cc0a71edb
-
-# 2019-05-10	radv: clear vertex bindings while resetting command buffer
-# COMMIT_ID=	24af0f1318967e20a8c5d7f3559389c341a0a11c
-
-# 2019-05-09	lima: fix tile buffer reloading
-# COMMIT_ID=	e44a4bae52f8d835bd7d4b740cb688f59d03cced
-
-# 2019-05-08	iris: Reorganise execbuf to have a single point of failure
-# COMMIT_ID=	8b8125646991fb7e923821bafea9bec3ba355b42
-
-# 2019-05-08	kmsro: add _dri.so to two of the kmsro drivers.
-# COMMIT_ID=	0a42d5b98bc3083e20475eb1ecea20f9b876269d
-
-# 2019-05-07	Revert "glx: Fix synthetic error generation in __glXSendError"
-# COMMIT_ID=	a01b393c397c846345f03f76f1167dd667e0ee96
-
-# 2019-05-04	panfrost/midgard: iabs cannot run on mul
-# COMMIT_ID=	68238732462bb044282ffbeb6cb08b96c7ff7805
-
-# 2019-05-03	st/va: check resource_get_info nullity in vlVaDeriveImage
-# COMMIT_ID=	8cd71f399e73c5d87e9162cc74da76e317a9f41f
-
-# 2019-05-03	radv: apply the indexing workaround for atomic buffer operations on GFX9
-# COMMIT_ID=	4f18c43d1df64135e8968a7d4fbfd2c9918b76ae
-
-# 2019-05-03	anv: fix crash when application does not provide push constants
-# COMMIT_ID=	80dc78407d0d1e03ceddf8889b217e8fd113568d
-
-# 2019-05-02	anv: Stop including POS in FS input limits
-# COMMIT_ID=	be7e9870d620460a91e8fbdbb8bf39b5c462aed3
-
-# 2019-05-02	docs: fixup mistake in contents
-# COMMIT_ID=	96924aa92ecf16cd2145b1a881df37d9162c6ba7
-
-# 2019-05-02	panfrost/midgard: Skip liveness analysis for instructions without dest
-# COMMIT_ID=	ad7c9ba0ecb349763ab7fad7bce74f1d47c139e3
-
-# 2019-05-01	util/bitset: Return an actual bool from test macros
-# COMMIT_ID=	bf774b56be46d5812868d9f6e7e63437d36754e0
-
-# 2019-05-01	panfrost: Fix blend shader upload
-# COMMIT_ID=	09c669260f6d311d0d99f2c63ebd0ec5b68853f8
-
-# 2019-05-01	util: move #include out of #if linux
-# COMMIT_ID=	70da00ffd65e56c8c8cc6ecfcec462fb52ee5102
-
-# 2019-05-01	gitlab-ci: build vulkan drivers in clang build
-# COMMIT_ID=	47f419d0b37721776785a54005783ef6fe836d66
-
-PORTNAME=	mesa
-
-# DISTNAME=	${PORTNAME}-${COMMIT_ID}
-# PKGNAME=	MesaLib-19.1.0
+DISTNAME=	mesa-18.3.6
+PKGNAME=	${DISTNAME:S/mesa/MesaLib/}
+# DISTNAME=	mesa-18.2.0-rc6
+# PKGNAME=	MesaLib-18.2.0
 # PKGREVISION=	1
-# CATEGORIES=	graphics x11
-# MASTER_SITES=	http://cgit.freedesktop.org/mesa/${PORTNAME}/snapshot/
-
-DISTNAME=	mesa-19.1.0-rc3
-# PKGNAME=	${DISTNAME:S/mesa/MesaLib/}
-PKGNAME=	MesaLib-19.1.0
 CATEGORIES=	graphics x11
 MASTER_SITES=	ftp://ftp.freedesktop.org/pub/mesa/
 # MASTER_SITES=	ftp://ftp.freedesktop.org/pub/mesa/${PKGVERSION_NOREV}/
@@ -116,11 +56,11 @@ SUBST_SED.wrapper-bug+=		-e 's,libglapi_tmp_rename\.la,libglapi.la,g'
 SUBST_SED.wrapper-bug+=		-e 's,libglapi_tmp_rename_la,libglapi_la,g'
 
 # Replace /etc/drirc.d with ${PREFIX}/etc/drirc.d
-SUBST_CLASSES+=		drirc
-SUBST_STAGE.drirc=	pre-configure
-SUBST_MESSAGE.drirc=	Fixing hardcoded /etc/drirc.d references
-SUBST_FILES.drirc+=	src/util/xmlconfig.c
-SUBST_SED.drirc+=	-e 's|/etc|${PREFIX}/etc|g'
+SUBST_CLASSES+=			drirc
+SUBST_STAGE.drirc=		pre-configure
+SUBST_MESSAGE.drirc=		Fixing hardcoded /etc/drirc.d references
+SUBST_FILES.drirc+=		src/util/xmlconfig.c
+SUBST_SED.drirc+=		 -e 's|/etc|${PREFIX}/etc|g'
 
 CFLAGS.SunOS+=		-D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS
 CXXFLAGS.SunOS+=	-Drestrict=__restrict__
diff --git a/MesaLib-dfbsd/PLIST b/MesaLib-dfbsd/PLIST
index db0e7a81b0..117247be07 100644
--- a/MesaLib-dfbsd/PLIST
+++ b/MesaLib-dfbsd/PLIST
@@ -35,7 +35,6 @@ ${PLIST.xatracker}include/xa_tracker.h
 @comment ${PLIST.vaapi}lib/dri/gallium_drv_video.so
 ${PLIST.i915}lib/dri/i915_dri.so
 ${PLIST.i965}lib/dri/i965_dri.so
-${PLIST.iris}lib/dri/iris_dri.so
 @comment ${PLIST.ilo}lib/dri/ilo_dri.so
 ${PLIST.freedreno}lib/dri/kgsl_dri.so
 ${PLIST.swrast}lib/dri/kms_swrast_dri.so
@@ -61,7 +60,7 @@ lib/libGL.so.1.2.0
 @comment ${PLIST.glesv1}lib/libGLESv1_CM.la
 ${PLIST.glesv1}lib/libGLESv1_CM.so
 ${PLIST.glesv1}lib/libGLESv1_CM.so.1
-${PLIST.glesv1}lib/libGLESv1_CM.so.1.1.0
+${PLIST.glesv1}lib/libGLESv1_CM.so.1.0.0
 @comment ${PLIST.glesv2}lib/libGLESv2.la
 ${PLIST.glesv2}lib/libGLESv2.so
 ${PLIST.glesv2}lib/libGLESv2.so.2
@@ -90,7 +89,7 @@ lib/libglapi.so.0.0.0
 @comment ${PLIST.xatracker}lib/libxatracker.la
 ${PLIST.xatracker}lib/libxatracker.so
 ${PLIST.xatracker}lib/libxatracker.so.2
-${PLIST.xatracker}lib/libxatracker.so.2.5.0
+${PLIST.xatracker}lib/libxatracker.so.2.4.0
 ${PLIST.dri}lib/pkgconfig/dri.pc
 ${PLIST.egl}lib/pkgconfig/egl.pc
 ${PLIST.gbm}lib/pkgconfig/gbm.pc
@@ -100,7 +99,7 @@ ${PLIST.glesv1}lib/pkgconfig/glesv1_cm.pc
 ${PLIST.glesv2}lib/pkgconfig/glesv2.pc
 ${PLIST.wayland}lib/pkgconfig/wayland-egl.pc
 ${PLIST.xatracker}lib/pkgconfig/xatracker.pc
-@comment ${PLIST.vdpau}lib/vdpau/libvdpau_gallium.so
+${PLIST.vdpau}lib/vdpau/libvdpau_gallium.so
 ${PLIST.nouveau}${PLIST.vdpau}lib/vdpau/libvdpau_nouveau.so
 ${PLIST.nouveau}${PLIST.vdpau}lib/vdpau/libvdpau_nouveau.so.1
 ${PLIST.nouveau}${PLIST.vdpau}lib/vdpau/libvdpau_nouveau.so.1.0
diff --git a/MesaLib-dfbsd/TODO b/MesaLib-dfbsd/TODO
index 06da5abeee..e780c72e57 100644
--- a/MesaLib-dfbsd/TODO
+++ b/MesaLib-dfbsd/TODO
@@ -6,6 +6,18 @@ Copy port to graphics/MesaLib, do not install from wip.
 * Test Solaris
 * Test Linux
 * Fully port Vulkan support from FreeBSD ports.
-* Figure out if there really is a problem with atomic_add_unless
-  inverting the Linux definition
 * See what can be ported from latest OpenBSD xenocara and NetBSD xsrc
+
+* Is HAVE_NOATEXIT required even for NetBSD
+* Does static EGLBoolean registered = EGL_FALSE; in function
+  _eglAddAtExitCall() of src/egl/main/eglglobals.c make a difference.
+* Should NetBSD pkgsrc pthread_setaffinity_np() fixes be ported to xsrc
+* Are no_cs_queue, revert_threaded_context, and revert_copy_clear
+  needed for NetBSD radeon(si)?
+* Should !defined(_NETBSD_SOURCE) #if for p_compiler.h be ported
+  from NetBSD xsrc
+* Is extra env_var_as_boolean("LIBGL_DRI3_ENABLE", false) test
+  required for NetBSD
+* Should memfd_create fix using mkostemp(3) be ported for NetBSD
+* Is HW_PHYSMEM64 fix in pkgsrc still needed for NetBSD
+* Port NetBSD xsrc tests for 64-bit atomic ops
diff --git a/MesaLib-dfbsd/builtin.mk b/MesaLib-dfbsd/builtin.mk
index 71884e4b32..f9bab9d959 100644
--- a/MesaLib-dfbsd/builtin.mk
+++ b/MesaLib-dfbsd/builtin.mk
@@ -22,7 +22,7 @@ IS_BUILTIN.MesaLib=	yes
 IS_BUILTIN.MesaLib=	no
 .  endif
 .endif
-MAKEVARS+=		IS_BUILTIN.MesaLib
+MAKEVARS+=	IS_BUILTIN.MesaLib
 
 ###
 ### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
@@ -67,7 +67,7 @@ USE_BUILTIN.MesaLib!=							\
 .    endif
 .  endif  # PREFER.MesaLib
 .endif
-MAKEVARS+=		USE_BUILTIN.MesaLib
+MAKEVARS+=	USE_BUILTIN.MesaLib
 
 ###
 ### The section below only applies if we are not including this file
diff --git a/MesaLib-dfbsd/distinfo b/MesaLib-dfbsd/distinfo
index 64f9af7a63..c74133af20 100644
--- a/MesaLib-dfbsd/distinfo
+++ b/MesaLib-dfbsd/distinfo
@@ -1,14 +1,16 @@
 $NetBSD: distinfo,v 1.17 2019/05/01 19:31:45 maya Exp $
 
-SHA1 (mesa-19.1.0-rc3.tar.xz) = c1e984fbeb7e86c8cd8b21f40b81372e0147d720
-RMD160 (mesa-19.1.0-rc3.tar.xz) = 20897eba53a23fe7efa5370b1cdbfe32e8e01b68
-SHA512 (mesa-19.1.0-rc3.tar.xz) = 740d5d13458b54e1942bfe7165938ec414aa7949aa60109ba872236f3b483c7305ac76b1b48c38dc6fd7691748106447757ac081f364952cc9e00f45fa9e2ea5
-Size (mesa-19.1.0-rc3.tar.xz) = 10878280 bytes
-SHA1 (patch-include_GL_internal_dri__interface.h) = ed567949ae44f7477738138347cf9648b9a8d634
-SHA1 (patch-meson.build) = 3cd30902cd5af7bc860dd2984a51d9ebf051662e
+SHA1 (mesa-18.3.6.tar.xz) = cc7cb8cef999bc89142eaf5e162fcb24f6569645
+RMD160 (mesa-18.3.6.tar.xz) = f4e2812c27f7bffcc1e3a28d721752aad5330f2b
+SHA512 (mesa-18.3.6.tar.xz) = 3a6dcaba99185e28d162b130bbd760fe87e6072065958189b28f41ea287ef041397897e098d93218a64802cf11c73806f7400a866bd8e5ed69694fa15c147487
+Size (mesa-18.3.6.tar.xz) = 11882744 bytes
+SHA1 (patch-configure.ac) = ba9ded10c5a87275db29c9d008d917041b2e0c78
+SHA1 (patch-include_GL_internal_dri__interface.h) = a0e26ce759a8eaf170b3401c763ff76686b0e011
+SHA1 (patch-meson.build) = ec2d164cfaaec526b3d063ade1a7bea941a90c49
 SHA1 (patch-meson__options.txt) = 171ac109444b0ce8ea37e53b72f529a4b5e5c6f6
 SHA1 (patch-src_amd_common_ac__debug.c) = 8233367c3b5bc344442ea8d19488fdd1e3791ae9
-SHA1 (patch-src_amd_vulkan_radv__device.c) = 2eef90c3139ffa8349f5960eb328b7df3071a45c
+SHA1 (patch-src_amd_common_ac__llvm__util.c) = 311a329c4bd26aa3de4012a4ea513e6857c116d4
+SHA1 (patch-src_amd_vulkan_radv__device.c) = a029ba89311fe62e3712573993fabf38910e9838
 SHA1 (patch-src_amd_vulkan_winsys_amdgpu_radv__amdgpu__cs.c) = 1fe81a7b16e36dc9125400c20543271216a33a45
 SHA1 (patch-src_compiler_builtin__type__macros.h) = 128030d0c532e5f3982dc6ebde1957fc0ca7f5d5
 SHA1 (patch-src_compiler_glsl_glsl__parser__extras.cpp) = ef114d6e288e6d212fce9d1c0606f7d454a171c4
@@ -17,17 +19,13 @@ SHA1 (patch-src_egl_drivers_dri2_platform__x11.c) = 1b8c7689b18643777d494bbb4918
 SHA1 (patch-src_egl_main_eglglobals.c) = c8db1469859d448635f96a0eac1a936104cd0fdd
 SHA1 (patch-src_gallium_auxiliary_drivers_trace_tr__dump.c) = 360e1608508a7bbb41acecd58930781038e2309e
 SHA1 (patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c) = 14f0511191ef468a39e3248d44f7dbdffa554547
-SHA1 (patch-src_gallium_auxiliary_util_u__format__tests.c) = d878e6f3e9a0a37d4903c0d0551f9fa535635d40
-SHA1 (patch-src_gallium_drivers_freedreno_freedreno__screen.c) = b19e93b1612d6eacccf35260110db9402eb4edca
-SHA1 (patch-src_gallium_drivers_iris_meson.build) = 31f0afab5212860917fe78e2b282a730187502ef
-SHA1 (patch-src_gallium_drivers_nouveau_meson.build) = 59de3f012f604ae185d90c5c64521f35580eaa00
+SHA1 (patch-src_gallium_auxiliary_util_u__format__tests.c) = 4d5e4677c2825778c43440ab131b8807f6840975
+SHA1 (patch-src_gallium_auxiliary_util_u__helpers.c) = 0489047a1f245bb317d6e22fd26d955ac77d33c7
+SHA1 (patch-src_gallium_drivers_freedreno_freedreno__screen.c) = d76bf52c25609d641dbf4021e81282cbdc925976
 SHA1 (patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c) = 04f95784c3270c9bb7e95377982e217962481525
 SHA1 (patch-src_gallium_drivers_nouveau_nv50_nv84__video.c) = 1b4239fe053523835ecac006894bdb0cde0ee626
-SHA1 (patch-src_gallium_drivers_radeonsi_si__buffer.c) = dc2dcb0f87a01ae0162a8c5746911c53e669cd2e
-SHA1 (patch-src_gallium_drivers_radeonsi_si__compute__blit.c) = 86ba535e10a1d692877782cef6a1ec4aafeec4c7
-SHA1 (patch-src_gallium_drivers_radeonsi_si__dma__cs.c) = 3c6a2a49e40dd8f99f5f393ad6e03345111cdeb1
-SHA1 (patch-src_gallium_drivers_radeonsi_si__gfx__cs.c) = 98ca07e2cc518125e5ec8924cbadc19f4c13de56
-SHA1 (patch-src_gallium_drivers_radeonsi_si__pipe.c) = de016f03468ff7607543cb1587180b7e9893e560
+SHA1 (patch-src_gallium_drivers_radeonsi_si__compute__blit.c) = 284d5a55c676acf4a13caef5d5b6d27243c7dc06
+SHA1 (patch-src_gallium_drivers_radeonsi_si__pipe.c) = bfc362eba103273c6c8633e8841f0c818dd7d2af
 SHA1 (patch-src_gallium_drivers_radeonsi_si__state__shaders.c) = ed51a57765f2349bc91fd509dc03e709241bd899
 SHA1 (patch-src_gallium_drivers_vc4_vc4__bufmgr.c) = 1d591d346486fdf58893f69ab92a272e6a31a987
 SHA1 (patch-src_gallium_include_pipe_p__config.h) = f4e38eac66167b619c30076bb0144dd716310967
@@ -35,46 +33,53 @@ SHA1 (patch-src_gallium_state__trackers_clover_llvm_invocation.cpp) = 3053db09fb
 SHA1 (patch-src_gallium_state__trackers_clover_llvm_metadata.hpp) = c97d38098ea03658bc193a50e445b87f1c020839
 SHA1 (patch-src_gallium_state__trackers_clover_util_range.hpp) = cdc78067986c1b92818472c4201c58ef1b42c4f4
 SHA1 (patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c) = 8c73f29a93e4e7ae8c0acd6f5f345047dc8a8541
+SHA1 (patch-src_gbm_Makefile.am) = 5f3107afbf64b97f7d21ce427cecc4fb78974db3
+SHA1 (patch-src_gbm_backends_dri_gbm__dri.c) = f21690d9c2d11f353aa4f9662c98b12fae78becf
+SHA1 (patch-src_glx_Makefile.am) = 869c4f2388f835b9b296b3c84c2a03ef7717f17d
 SHA1 (patch-src_glx_apple_apple__glapi.c) = c4eea8dabf74eb03d22da4eb834b18ae3384c63b
 SHA1 (patch-src_glx_dri__common.h) = 0274877f8c65a4bb729536a897df4704897a4c6e
 SHA1 (patch-src_glx_dri__glx.c) = 8fd48776e9953b18bd17ba130d90ae2935e67242
 SHA1 (patch-src_glx_glxclient.h) = 5e597362c3839f26118fe98983701f33d6047cfd
 SHA1 (patch-src_glx_glxcurrent.c) = 67142b977aadf23b0b0d3a06db3d9450e0b7f892
-SHA1 (patch-src_glx_glxext.c) = 15c2c5e0c6b5095ce849fb86ad148aa05d7d907a
+SHA1 (patch-src_glx_glxext.c) = 1c044d38faebc310f49248a6b937b1bbc5a16870
+SHA1 (patch-src_intel_Makefile.tools.am) = 5253d5972b48ae3bc8d648bb9f479dcf6cbd3fab
 SHA1 (patch-src_intel_compiler_brw__fs__bank__conflicts.cpp) = 6276d2c6846bb4dd08699921bec4e20202a17478
-SHA1 (patch-src_intel_isl_isl__tiled__memcpy.c) = f019e47e535e2c2ab8d324937362a4c7965311f1
-SHA1 (patch-src_intel_perf_gen__perf.h) = 2915eb9dc7161d74d73b8e238dc1f0d0d9b82935
 SHA1 (patch-src_intel_tools_aub__mem.c) = fe7f8315515618e2becfa5279de613bca200dbf8
 SHA1 (patch-src_intel_tools_aubinator__error__decode.c) = 159b57f9a3c1fd37ab1e5b49ff911073e2e9ff9b
 SHA1 (patch-src_intel_tools_error2aub.c) = e38395e3889f6e3af645f312a429ce2a7d285231
 SHA1 (patch-src_intel_vulkan_anv__allocator.c) = da5a11c95d17d6476e7141572264a215807b8cd7
-SHA1 (patch-src_intel_vulkan_anv__device.c) = 1f6ac5bcd6bf31275b93b805ee5fe6213e6dbb7e
+SHA1 (patch-src_intel_vulkan_anv__device.c) = 996f64d3524fb644ab063b1b075718f0d098b4ab
 SHA1 (patch-src_intel_vulkan_anv__gem.c) = b8eb487fa704151e7c3c3b1d23973b2b0aa5922e
 SHA1 (patch-src_intel_vulkan_anv__gem__stubs.c) = ad5a4bd9fe521cf73faf2f0cf0f493a0b40f4c20
 SHA1 (patch-src_intel_vulkan_anv__queue.c) = 2dbf7dfd0c77f74f510032bf8d12109f58c50a30
 SHA1 (patch-src_mapi_entry__x86-64__tls.h) = a0cbe5c8412fa626926ade0c72c6bc13b1ab4f36
 SHA1 (patch-src_mapi_entry__x86__tls.h) = 740312f64e4848164482f44642859aecc7025853
-SHA1 (patch-src_mapi_entry__x86__tsd.h) = 52d0197fb7b84382147aca98f8cccf24892a9df3
 SHA1 (patch-src_mapi_glapi_gen_gl__gentable.py) = 0b1d4ef3f78a9b3726ef7f9921608a48a5e4ac56
 SHA1 (patch-src_mapi_u__current.c) = bee667c667bb1bd6e3b0f774d6ad6da5b7f0546d
 SHA1 (patch-src_mapi_u__current.h) = 13e91936db8d468c4f4744eb5cc01ad879b53539
 SHA1 (patch-src_mesa_drivers_dri_i915_intel__screen.c) = fb9324dcbc8ffbc00bee6aedcc38db2e94b24f9d
 SHA1 (patch-src_mesa_drivers_dri_i965_brw__bufmgr.c) = ad0fc0cacf59dde38d18f9ceb93411105cdd6c89
+SHA1 (patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c) = bb7ca6a8b9e42c1dc4e59a3cf78d063699f7b66e
+SHA1 (patch-src_mesa_drivers_dri_i965_brw__performance__query.c) = 1250b3477c4b8013b928772b7dc7f24e8c4b67aa
 SHA1 (patch-src_mesa_drivers_dri_i965_intel__screen.c) = 1b5de370add6984fb44968c055b7d8d5a54417dd
+SHA1 (patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c) = ca311036c3d7fb63d817faa3c61348a821f7af5d
 SHA1 (patch-src_mesa_drivers_dri_swrast_swrast.c) = 4c0ca7dec2398a15f77b643d0f86af41ca202be3
-SHA1 (patch-src_mesa_main_context.c) = 441026b8f073fd90f2586dfb306482feed6c6834
+SHA1 (patch-src_mesa_drivers_x11_Makefile.am) = 172a8da11a620edce790f64338a0390cd1e93188
+SHA1 (patch-src_mesa_main_context.c) = 74226013b56ad6c9678f1970458538b35967678f
 SHA1 (patch-src_mesa_main_extensions.c) = 2f48bdb1176c2878bb33bcfab7556172b50a987e
 SHA1 (patch-src_mesa_main_macros.h) = c5dceaa8dc02a58e5b2273d82e3fe1cc12e327d3
 SHA1 (patch-src_mesa_main_shader__query.cpp) = 3f9c31645d87855759def11344dee16af23c7be3
 SHA1 (patch-src_mesa_x86_common__x86.c) = f8c4b93443ef66d017f6aa114b877565b30f2598
+SHA1 (patch-src_util_Makefile.am) = e390cd47b784ad08987b81fdbce537968ad4a624
 SHA1 (patch-src_util_build__id.c) = fee28ddf5c91208492efcfdebf32e0cfef35502d
 SHA1 (patch-src_util_disk__cache.c) = cc0b29780dba5d5b5e43c0798336f16a1f0008de
+SHA1 (patch-src_util_futex.h) = 35097c3b8baf8b969c6ec5ec1feb6f4e0a48237e
 SHA1 (patch-src_util_os__time.c) = d33f0cbdfc5a09661f906aab5feda0b0c70f2f48
 SHA1 (patch-src_util_ralloc.c) = d311bfd9ed7e673d72e050668d351c1e6552cdc8
-SHA1 (patch-src_util_ralloc.h) = 56ff594c3f5aa450de14363735f4318864102214
 SHA1 (patch-src_util_strndup.h) = 73f49694ca48ad6b9a9d8346c5b84fddec2463bd
 SHA1 (patch-src_util_u__atomic.h) = 31d4514538ef5ee53012695eb5c66134aaec981e
+SHA1 (patch-src_util_u__math.h) = 4ed32b818bd29428e4c1ede6d31460bd6ca0fff6
 SHA1 (patch-src_util_u__process.c) = 4f905ab7c812ac3f48165857dbc40455879c9f4b
 SHA1 (patch-src_util_u__queue.c) = 17fb475e139d29ae27a54e6f6104d274e50226f7
-SHA1 (patch-src_util_u__thread.h) = 9155dc93d4401aae279e0134b7cd0dc1b53e39fd
-SHA1 (patch-src_util_xmlconfig.c) = fa0cfe2e1348dfb5e91f9c20aae3c43eee1998b5
+SHA1 (patch-src_util_u__thread.h) = c2f276a9577dfea8d22fce2143d5cb65b043aa74
+SHA1 (patch-src_util_xmlconfig.c) = ad5619e067957b120a70c1c63421c92b356e16ac
diff --git a/MesaLib-dfbsd/options.mk b/MesaLib-dfbsd/options.mk
index 29a514f926..ad0df190d1 100644
--- a/MesaLib-dfbsd/options.mk
+++ b/MesaLib-dfbsd/options.mk
@@ -11,8 +11,8 @@ PKG_SUPPORTED_OPTIONS+=		glesv1 glesv2
 PKG_SUPPORTED_OPTIONS+=		xa
 PKG_SUPPORTED_OPTIONS+=		asm
 PKG_SUPPORTED_OPTIONS+=		noatexit
-PKG_SUPPORTED_OPTIONS+=		iris
-PKG_SUGGESTED_OPTIONS+=		iris
+# PKG_SUPPORTED_OPTIONS+=		iris
+# PKG_SUGGESTED_OPTIONS+=		iris
 PKG_SUPPORTED_OPTIONS+=		vulkan
 
 PKG_SUPPORTED_OPTIONS+=		test_dri3_enable
@@ -35,9 +35,6 @@ PKG_SUPPORTED_OPTIONS+=		revert_copy_clear
 PKG_SUPPORTED_OPTIONS+=		no_getprogramname
 PKG_SUPPORTED_OPTIONS+=		strict_xsrc_netbsd
 
-PKG_SUPPORTED_OPTIONS+=		x86_tsd_openbsd
-PKG_SUPPORTED_OPTIONS+=		no_linear_alloc_destructor
-
 PKG_SUGGESTED_OPTIONS+=		xvmc
 PKG_SUGGESTED_OPTIONS+=		vdpau vaapi
 
@@ -89,17 +86,17 @@ PKG_SUGGESTED_OPTIONS+=		test_dri3_enable
 .endif
 
 # Revert patch removing support for no dedicated render nodes
-.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly" || ${OPSYS} == "NetBSD"
+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
 PKG_SUGGESTED_OPTIONS+=		no_render_node
 .endif
 
 # Use clock_nanosleep() in os_time.c
-.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly" || ${OPSYS} == "NetBSD"
+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
 PKG_SUGGESTED_OPTIONS+=		use_clock_nanosleep_os_time
 .endif
 
 # pthread_getcpuclockid only in NetBSD 8+
-.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly" || ${OPSYS} == "NetBSD"
+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly"
 PKG_SUGGESTED_OPTIONS+=		use_pthread_getcpuclockid
 .endif
 
@@ -113,9 +110,10 @@ PKG_SUGGESTED_OPTIONS+=		revert_sdma_uploader
 PKG_SUGGESTED_OPTIONS+=		require_36_gen4
 .endif
 
-.if ${OPSYS} == "NetBSD"
-PKG_SUGGESTED_OPTIONS+=		physmem_netbsd
-.endif
+# Option used in pkgsrc NetBSD but not xsrc
+# .if ${OPSYS} == "NetBSD"
+# PKG_SUGGESTED_OPTIONS+=		physmem_netbsd
+# .endif
 
 .if ${OPSYS} == "NetBSD"
 PKG_SUGGESTED_OPTIONS+=		setaffinity_np_netbsd
@@ -131,21 +129,12 @@ PKG_SUGGESTED_OPTIONS+=		revert_threaded_context
 PKG_SUGGESTED_OPTIONS+=		revert_copy_clear
 .endif
 
-# .if ${OPSYS} == "NetBSD"
-# PKG_SUGGESTED_OPTIONS+=		no_getprogramname
-# .endif
-
-# .if ${OPSYS} == "NetBSD"
-# PKG_SUGGESTED_OPTIONS+=		strict_xsrc_netbsd
-# .endif
-
-# OpenBSD xenocara tsd dispatch assembly for entry_x86_tsd.h
-.if ${OPSYS} == "OpenBSD"
-PKG_SUGGESTED_OPTIONS+=		x86_tsd_openbsd
+.if ${OPSYS} == "NetBSD"
+PKG_SUGGESTED_OPTIONS+=		no_getprogramname
 .endif
 
-.if ${OPSYS} == "OpenBSD"
-PKG_SUGGESTED_OPTIONS+=		no_linear_alloc_destructor
+.if ${OPSYS} == "NetBSD"
+PKG_SUGGESTED_OPTIONS+=		strict_xsrc_netbsd
 .endif
 
 .include "../../mk/bsd.options.mk"
@@ -268,16 +257,16 @@ DRI_DRIVERS+=		i965
 .endif
 
 # Intel Iris support
-.if !empty(PKG_OPTIONS:Miris)
-GALLIUM_DRIVERS+=	iris
-PLIST.iris=		yes
-.endif
+# .if !empty(PKG_OPTIONS:Miris)
+# GALLIUM_DRIVERS+=	iris
+# PLIST.iris=		yes
+# .endif
 
 # Vulkan support
 .if !empty(PKG_OPTIONS:Mvulkan)
 # VULKAN_DRIVERS+=	intel
 # VULKAN_DRIVERS+=	radeon
-VULKAN_DRIVERS+=	auto
+VULKAN_DRIVERS+=	auto	
 PLIST.vulkan=		yes
 .endif
 
@@ -336,14 +325,14 @@ DRI_DRIVERS+=		nouveau
 
 .if ${OPSYS} == "Darwin"
 CONFIGURE_ARGS+=	--with-platforms=x11
-MESON_ARGS+=		-Dplatforms=x11
+MESON_ARGS+=	-Dplatforms=x11
 #.elif ${OPSYS} == "Linux"
 #.include "../../wip/wayland/buildlink3.mk"
 #CONFIGURE_ARGS+=	--with-platforms=x11,drm,wayland
 #PLIST.wayland=		yes
 .else
 CONFIGURE_ARGS+=	--with-platforms=x11,drm
-MESON_ARGS+=		-Dplatforms=x11,drm
+MESON_ARGS+=	-Dplatforms=x11,drm
 .endif
 
 .if !empty(PKG_OPTIONS:Mllvm)
@@ -372,10 +361,10 @@ MESON_ARGS+=	-Dgallium-vdpau=false
 # XA is useful for accelerating xf86-video-vmware
 .if !empty(PKG_OPTIONS:Mxa)
 CONFIGURE_ARGS+=	--enable-xa
-MESON_ARGS+=		-Dgallium-xa=true
+MESON_ARGS+=	-Dgallium-xa=true
 PLIST.xatracker=	yes
 .else
-MESON_ARGS+=		-Dgallium-xa=false
+MESON_ARGS+=	-Dgallium-xa=false
 .endif
 
 # AMD Radeon r300
@@ -523,11 +512,3 @@ CPPFLAGS+=	-DNO_GETPROGRAMNAME
 .if !empty(PKG_OPTIONS:Mstrict_xsrc_netbsd)
 CPPFLAGS+=	-DSTRICT_XSRC_NETBSD
 .endif
-
-.if !empty(PKG_OPTIONS:Mx86_tsd_openbsd)
-CPPFLAGS+=	-DX86_TSD_OPENBSD
-.endif
-
-.if !empty(PKG_OPTIONS:Mno_linear_alloc_destructor)
-CPPFLAGS+=	-DNO_LINEAR_ALLOC_DESTRUCTOR
-.endif
diff --git a/MesaLib-dfbsd/patches/patch-configure.ac b/MesaLib-dfbsd/patches/patch-configure.ac
new file mode 100644
index 0000000000..5f64f7cb08
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-configure.ac
@@ -0,0 +1,127 @@
+$NetBSD: patch-configure.ac,v 1.5 2019/01/20 09:50:28 tnn Exp $
+
+Don't check for pthread stubs anywhere, as we don't provide it.
+
+From FreeBSD ports graphics/mesa-dri 18.0.0,
+DragonFly dports graphics/mesa-dri 17.3.1,
+files/patch-configure
+
+For FreeBSD 11.2-RELEASE
+  CXXLD    mesa_dri_drivers.la
+/usr/bin/ld: unrecognized option '--build-id=sha1'
+
+* But do NOT extend to FreeBSD, instead use binutils ld to link.
+osx: ld does not support --build-ld
+
+* For FreeBSD: Use monotonic clock for timeouts.
+
+* For FreeBSD: Implement futex_wake() and futex_wait() via _umtx_op() 
+
+* dri3: Mon Apr 10 19:14:48 2017 UTC
+DRI3 remains enabled at compile time, but it is now disabled at
+runtime for stock FreeBSD.  Set LIBGL_DRI3_ENABLE in the
+environment to enable DRI3.
+This change was made to work around a problem in libEGL,
+which fails to fall back to using DRI2 when run on a system
+without DRI3 support.
+
+--- configure.ac.orig	2019-01-17 11:26:22.000000000 +0000
++++ configure.ac
+@@ -726,7 +726,7 @@ dnl
+ dnl OSX linker does not support build-id
+ dnl
+ case "$host_os" in
+-darwin*)
++darwin* | solaris*)
+     LD_BUILD_ID=""
+     ;;
+ *)
+@@ -931,7 +931,7 @@ case "$host_os" in
+ darwin*)
+     ;;
+ *)
+-    AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
++    AC_CHECK_FUNCS([clock_gettime clock_nanosleep], [CLOCK_LIB=],
+                    [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
+                                  [AC_MSG_ERROR([Could not find clock_gettime])])])
+     AC_SUBST([CLOCK_LIB])
+@@ -941,6 +941,9 @@ esac
+ dnl See if posix_memalign is available
+ AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
+ 
++dnl See if open_memstream is available
++AC_CHECK_FUNC([open_memstream], [DEFINES="$DEFINES -DHAVE_OPEN_MEMSTREAM"])
++
+ dnl Check for zlib
+ PKG_CHECK_MODULES([ZLIB], [zlib >= $ZLIB_REQUIRED])
+ DEFINES="$DEFINES -DHAVE_ZLIB"
+@@ -966,7 +969,7 @@ PTHREAD_LIBS="$PTHREAD_LIBS -pthread"
+ dnl pthread-stubs is mandatory on some BSD platforms, due to the nature of the
+ dnl project. Even then there's a notable issue as described in the project README
+ case "$host_os" in
+-linux* | cygwin* | darwin* | solaris* | *-gnu* | gnu* | openbsd*)
++*)
+     pthread_stubs_possible="no"
+     ;;
+ * )
+@@ -982,8 +985,12 @@ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS"
+ AC_MSG_CHECKING(whether pthread_setaffinity_np is supported)
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[
++    #if  defined(__DragonFly__) || defined(__FreeBSD__)
++    #include <pthread_np.h>
++    #else
+     #define _GNU_SOURCE
+     #include <pthread.h>
++    #endif
+     int main() {
+        void *a = (void*) &pthread_setaffinity_np;
+        long b = (long) a;
+@@ -995,7 +1002,10 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([[
+ LIBS="$save_LIBS"
+ 
+ dnl Check for futex for fast inline simple_mtx_t.
+-AC_CHECK_HEADER([linux/futex.h], [DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"])
++AC_CHECK_HEADERS([linux/futex.h sys/umtx.h],
++    [DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"],,
++    [#include <errno.h>
++     #include <sys/types.h>])
+ 
+ dnl SELinux awareness.
+ AC_ARG_ENABLE([selinux],
+@@ -1278,7 +1288,7 @@ fi
+ AC_SUBST(LIBSENSORS_LIBS)
+ 
+ case "$host_os" in
+-linux*)
++linux* | freebsd* | dragonfly*)
+     dri3_default=yes
+     ;;
+ *)
+@@ -1908,7 +1918,7 @@ if test x"$enable_dri3" = xyes; then
+     dri3_modifier_modules="xcb-dri3 >= $XCBDRI3_MODIFIERS_REQUIRED xcb-present >= $XCBPRESENT_MODIFIERS_REQUIRED"
+     PKG_CHECK_MODULES([XCB_DRI3_MODIFIERS], [$dri3_modifier_modules], [have_dri3_modifiers=yes], [have_dri3_modifiers=no])
+ 
+-    if test "x$have_dri3_modifiers" == xyes; then
++    if test "x$have_dri3_modifiers" = xyes; then
+         DEFINES="$DEFINES -DHAVE_DRI3_MODIFIERS"
+     fi
+ fi
+@@ -2505,8 +2515,6 @@ if test "x$enable_opencl" = xyes; then
+         CLANG_LIBDIR=${LLVM_LIBDIR}
+     fi
+     CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
+-    AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
+-        [AC_MSG_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.])])
+ fi
+ AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
+ AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)
+@@ -2941,7 +2949,7 @@ if test "x$enable_llvm" = xyes; then
+     dnl the LLVM library propagated in the Libs.private of the respective .pc
+     dnl file which ensures complete dependency information when statically
+     dnl linking.
+-    if test "x$enable_glx" == xgallium-xlib; then
++    if test "x$enable_glx" = xgallium-xlib; then
+         GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $LLVM_LIBS"
+     fi
+     if test "x$enable_gallium_osmesa" = xyes; then
diff --git a/MesaLib-dfbsd/patches/patch-include_GL_internal_dri__interface.h b/MesaLib-dfbsd/patches/patch-include_GL_internal_dri__interface.h
index 11359697e9..dfbf75750e 100644
--- a/MesaLib-dfbsd/patches/patch-include_GL_internal_dri__interface.h
+++ b/MesaLib-dfbsd/patches/patch-include_GL_internal_dri__interface.h
@@ -7,7 +7,7 @@ in drm.h also, which causes build issues in xorg-server.
 
 From NetBSD xsrc: prevent re-definitions from drm.h
 
---- include/GL/internal/dri_interface.h.orig	2019-04-17 22:16:19.000000000 +0000
+--- include/GL/internal/dri_interface.h.orig	2019-02-18 18:28:15.000000000 +0000
 +++ include/GL/internal/dri_interface.h
 @@ -40,13 +40,19 @@
  #ifndef DRI_INTERFACE_H
@@ -19,7 +19,7 @@ From NetBSD xsrc: prevent re-definitions from drm.h
  #ifdef HAVE_LIBDRM
  #include <drm.h>
  #else
-+#if !defined(_DRM_H_) || !defined(STRICT_XSRC_NETBSD)
++#if !defined(_DRM_H_) || !defined(__NetBSD__)
  typedef unsigned int drm_context_t;
  typedef unsigned int drm_drawable_t;
  typedef struct drm_clip_rect drm_clip_rect_t;
@@ -27,5 +27,5 @@ From NetBSD xsrc: prevent re-definitions from drm.h
 +#endif
 +#endif /* __FreeBSD__ || __DragonFly__ */
  
- #include <GL/gl.h>
+ #include <stdint.h>
  
diff --git a/MesaLib-dfbsd/patches/patch-meson.build b/MesaLib-dfbsd/patches/patch-meson.build
index 9c28e59102..7dfc0555ab 100644
--- a/MesaLib-dfbsd/patches/patch-meson.build
+++ b/MesaLib-dfbsd/patches/patch-meson.build
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- meson.build.orig	2019-03-15 01:02:19.000000000 +0000
+--- meson.build.orig	2019-04-05 10:53:23.000000000 +0000
 +++ meson.build
-@@ -50,6 +50,7 @@ with_tests = get_option('build-tests')
+@@ -53,6 +53,7 @@ with_tests = get_option('build-tests')
  with_valgrind = get_option('valgrind')
  with_libunwind = get_option('libunwind')
  with_asm = get_option('asm')
@@ -22,7 +22,7 @@ $NetBSD$
  if with_glx != 'disabled'
    if not (with_platform_x11 and with_any_opengl)
      error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
-@@ -1011,7 +1015,7 @@ foreach h : ['xlocale.h', 'sys/sysctl.h'
+@@ -1008,7 +1012,7 @@ foreach h : ['xlocale.h', 'sys/sysctl.h'
    endif
  endforeach
  
@@ -31,7 +31,7 @@ $NetBSD$
    if cc.has_function(f)
      pre_args += '-DHAVE_@0@'.format(f.to_upper())
    endif
-@@ -1094,11 +1098,28 @@ else
+@@ -1091,11 +1095,28 @@ else
    dep_clock = cc.find_library('rt')
  endif
  
@@ -61,3 +61,11 @@ $NetBSD$
    pre_args += '-DHAVE_PTHREAD'
    if cc.has_function(
        'pthread_setaffinity_np',
+@@ -1220,6 +1241,7 @@ if _llvm != 'false'
+       with_gallium_opencl or _llvm == 'true'
+     ),
+     static : not _shared_llvm,
++    method : 'config-tool',
+   )
+   with_llvm = dep_llvm.found()
+ endif
diff --git a/MesaLib-dfbsd/patches/patch-src_amd_common_ac__llvm__util.c b/MesaLib-dfbsd/patches/patch-src_amd_common_ac__llvm__util.c
new file mode 100644
index 0000000000..9acbe5817a
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_amd_common_ac__llvm__util.c
@@ -0,0 +1,20 @@
+$NetBSD$
+
+From FreeBSD ports graphics/mesa-dri 18.3.2:
+
+amd: Make vgpr-spilling depend on llvm version 
+
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230789#c14
+
+--- src/amd/common/ac_llvm_util.c.orig	2019-04-05 10:53:23.000000000 +0000
++++ src/amd/common/ac_llvm_util.c
+@@ -153,7 +153,8 @@ static LLVMTargetMachineRef ac_create_ta
+ 	LLVMTargetRef target = ac_get_llvm_target(triple);
+ 
+ 	snprintf(features, sizeof(features),
+-		 "+DumpCode,+vgpr-spilling,-fp32-denormals,+fp64-denormals%s%s%s%s",
++		 "+DumpCode,-fp32-denormals,+fp64-denormals%s%s%s%s%s",
++		 HAVE_LLVM >= 0x0800 ? "" : ",+vgpr-spilling",
+ 		 tm_options & AC_TM_SISCHED ? ",+si-scheduler" : "",
+ 		 tm_options & AC_TM_FORCE_ENABLE_XNACK ? ",+xnack" : "",
+ 		 tm_options & AC_TM_FORCE_DISABLE_XNACK ? ",-xnack" : "",
diff --git a/MesaLib-dfbsd/patches/patch-src_amd_vulkan_radv__device.c b/MesaLib-dfbsd/patches/patch-src_amd_vulkan_radv__device.c
index f0ec6ea1be..024fc9d848 100644
--- a/MesaLib-dfbsd/patches/patch-src_amd_vulkan_radv__device.c
+++ b/MesaLib-dfbsd/patches/patch-src_amd_vulkan_radv__device.c
@@ -4,11 +4,11 @@ From graphics/mesa-dri: update to 18.3.1
 
 https://reviews.freebsd.org/D17872
 
---- src/amd/vulkan/radv_device.c.orig	2019-04-23 23:49:39.000000000 +0000
+--- src/amd/vulkan/radv_device.c.orig	2018-12-11 21:13:57.000000000 +0000
 +++ src/amd/vulkan/radv_device.c
-@@ -51,6 +51,14 @@
- #include "compiler/glsl_types.h"
- #include "util/xmlpool.h"
+@@ -50,6 +50,14 @@
+ #include "util/debug.h"
+ #include "util/mesa-sha1.h"
  
 +#ifndef CLOCK_MONOTONIC_RAW
 +# ifdef CLOCK_MONOTONIC_FAST
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__format__tests.c b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__format__tests.c
index cb05bb04c2..fb56a9855f 100644
--- a/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__format__tests.c
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__format__tests.c
@@ -2,7 +2,7 @@ $NetBSD: patch-src_gallium_auxiliary_util_u__format__tests.c,v 1.1 2018/10/07 23
 
 On old NetBSD, NAN in math.h is __nanf.__val. Which is not constant.
 
---- src/gallium/auxiliary/util/u_format_tests.c.orig	2019-01-04 23:59:59.000000000 +0000
+--- src/gallium/auxiliary/util/u_format_tests.c.orig	2014-09-12 21:30:32.000000000 +0000
 +++ src/gallium/auxiliary/util/u_format_tests.c
 @@ -28,6 +28,10 @@
  
@@ -14,4 +14,4 @@ On old NetBSD, NAN in math.h is __nanf.__val. Which is not constant.
 +#endif
  
  #include "pipe/p_config.h"
- #include "util/u_memory.h"
+ #include "u_memory.h"
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__helpers.c b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__helpers.c
new file mode 100644
index 0000000000..c26caa59b2
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_auxiliary_util_u__helpers.c
@@ -0,0 +1,34 @@
+$NetBSD: patch-src_gallium_auxiliary_util_u__helpers.c,v 1.2 2019/01/20 09:50:28 tnn Exp $
+
+handle NetBSD-style pthread_setaffinity_np(3)
+
+--- src/gallium/auxiliary/util/u_helpers.c.orig	2018-12-11 21:13:57.000000000 +0000
++++ src/gallium/auxiliary/util/u_helpers.c
+@@ -129,6 +129,19 @@ static once_flag thread_pinning_once_fla
+ static void
+ util_set_full_cpu_affinity(void)
+ {
++#if defined(__NetBSD__) && defined(SETAFFINITY_NP_NETBSD)
++   cpuset_t *cpuset;
++
++   cpuset = cpuset_create();
++   if (cpuset != NULL) {
++      cpuset_zero(cpuset);
++      for (unsigned i = 0; i < cpuset_size(cpuset); i++)
++         cpuset_set(i, cpuset);
++
++      pthread_setaffinity_np(pthread_self(), cpuset_size(cpuset), cpuset);
++      cpuset_destroy(cpuset);
++   }
++#else
+    cpu_set_t cpuset;
+ 
+    CPU_ZERO(&cpuset);
+@@ -136,6 +149,7 @@ util_set_full_cpu_affinity(void)
+       CPU_SET(i, &cpuset);
+ 
+    pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset);
++#endif
+ }
+ 
+ static void
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_freedreno_freedreno__screen.c b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_freedreno_freedreno__screen.c
index 29b0d5d436..8732e9e5dc 100644
--- a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_freedreno_freedreno__screen.c
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_freedreno_freedreno__screen.c
@@ -4,7 +4,7 @@ From FreeBSD ports graphics/mesa-dri 18.1.4.
 
 - Without sysinfo() fall back to sysconf()
 
---- src/gallium/drivers/freedreno/freedreno_screen.c.orig	2019-04-25 21:13:31.000000000 +0000
+--- src/gallium/drivers/freedreno/freedreno_screen.c.orig	2018-07-13 18:41:27.000000000 +0000
 +++ src/gallium/drivers/freedreno/freedreno_screen.c
 @@ -43,7 +43,11 @@
  #include <errno.h>
@@ -18,8 +18,8 @@ From FreeBSD ports graphics/mesa-dri 18.1.4.
  
  #include "freedreno_screen.h"
  #include "freedreno_resource.h"
-@@ -832,9 +836,13 @@ fd_screen_create(struct fd_device *dev,
- 		screen->has_robustness = val;
+@@ -837,9 +841,13 @@ fd_screen_create(struct fd_device *dev)
+ 		screen->priority_mask = (1 << val) - 1;
  	}
  
 +#ifdef __GLIBC__
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_iris_meson.build b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_iris_meson.build
deleted file mode 100644
index 77b553cd06..0000000000
--- a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_iris_meson.build
+++ /dev/null
@@ -1,22 +0,0 @@
-$NetBSD$
-
---- src/gallium/drivers/iris/meson.build.orig	2019-04-23 07:24:08.000000000 +0000
-+++ src/gallium/drivers/iris/meson.build
-@@ -62,7 +62,7 @@ iris_gen_libs = []
- foreach v : ['80', '90', '100', '110']
-   iris_gen_libs += static_library(
-     'libiris_gen@0@'.format(v),
--    ['iris_blorp.c', 'iris_state.c', gen_xml_pack],
-+    ['iris_blorp.c', 'iris_state.c', gen_xml_pack, nir_opcodes_h, nir_builder_opcodes_h, nir_intrinsics_h],
-     include_directories : [inc_common, inc_intel, inc_nir],
-     c_args : [
-       c_vis_args, no_override_init_args, c_sse2_args,
-@@ -74,7 +74,7 @@ endforeach
- 
- libiris = static_library(
-   'iris',
--  [files_libiris, gen_xml_pack, nir_opcodes_h, nir_builder_opcodes_h,
-+  [files_libiris, gen_xml_pack, nir_opcodes_h, nir_builder_opcodes_h, nir_intrinsics_h,
-    iris_driinfo_h],
-   include_directories : [
-     inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_intel, inc_nir,
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_meson.build b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_meson.build
deleted file mode 100644
index 609315ceb6..0000000000
--- a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_nouveau_meson.build
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD$
-
---- src/gallium/drivers/nouveau/meson.build.orig	2019-03-21 00:58:06.000000000 +0000
-+++ src/gallium/drivers/nouveau/meson.build
-@@ -211,7 +211,7 @@ files_libnouveau = files(
- 
- libnouveau = static_library(
-   'nouveau',
--  [files_libnouveau, nir_opcodes_h],
-+  [files_libnouveau, nir_opcodes_h, nir_intrinsics_h],
-   include_directories : [
-     inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_common,
-   ],
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__buffer.c b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__buffer.c
deleted file mode 100644
index fdbe253ae1..0000000000
--- a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__buffer.c
+++ /dev/null
@@ -1,65 +0,0 @@
-$NetBSD$
-
-Option to revert:
-2019-02-20
-radeonsi: use SDMA for uploading data through const_uploader
-
-https://cgit.freedesktop.org/mesa/mesa/commit/?id=edbd2c1ff559cde1d9e22a9fb9059747782a72a7
-
---- src/gallium/drivers/radeonsi/si_buffer.c.orig	2019-02-21 02:04:29.000000000 +0000
-+++ src/gallium/drivers/radeonsi/si_buffer.c
-@@ -440,6 +440,9 @@ static void *si_buffer_transfer_map(stru
- 		}
- 	}
- 
-+#if defined(REVERT_SDMA_UPLOADER)
-+	if ((usage & PIPE_TRANSFER_DISCARD_RANGE) &&
-+#else
- 	if (usage & PIPE_TRANSFER_FLUSH_EXPLICIT &&
- 	    buf->b.b.flags & SI_RESOURCE_FLAG_UPLOAD_FLUSH_EXPLICIT_VIA_SDMA) {
- 		usage &= ~(PIPE_TRANSFER_UNSYNCHRONIZED |
-@@ -449,6 +452,7 @@ static void *si_buffer_transfer_map(stru
- 	}
- 
- 	if (usage & PIPE_TRANSFER_DISCARD_RANGE &&
-+#endif
- 	    ((!(usage & (PIPE_TRANSFER_UNSYNCHRONIZED |
- 			 PIPE_TRANSFER_PERSISTENT))) ||
- 	     (buf->flags & RADEON_FLAG_SPARSE))) {
-@@ -461,6 +465,12 @@ static void *si_buffer_transfer_map(stru
- 		    si_rings_is_buffer_referenced(sctx, buf->buf, RADEON_USAGE_READWRITE) ||
- 		    !sctx->ws->buffer_wait(buf->buf, 0, RADEON_USAGE_READWRITE)) {
- 			/* Do a wait-free write-only transfer using a temporary buffer. */
-+#if defined(REVERT_SDMA_UPLOADER)
-+			unsigned offset;
-+			struct si_resource *staging = NULL;
-+
-+			u_upload_alloc(ctx->stream_uploader, 0,
-+#else
- 			struct u_upload_mgr *uploader;
- 			struct si_resource *staging = NULL;
- 			unsigned offset;
-@@ -475,6 +485,7 @@ static void *si_buffer_transfer_map(stru
- 				uploader = sctx->b.stream_uploader;
- 
- 			u_upload_alloc(uploader, 0,
-+#endif
-                                        box->width + (box->x % SI_MAP_BUFFER_ALIGNMENT),
- 				       sctx->screen->info.tcc_cache_line_size,
- 				       &offset, (struct pipe_resource**)&staging,
-@@ -548,6 +559,7 @@ static void si_buffer_do_flush_region(st
- 				      transfer->box.x % SI_MAP_BUFFER_ALIGNMENT +
- 				      (box->x - transfer->box.x);
- 
-+#if !defined(REVERT_SDMA_UPLOADER)
- 		if (buf->b.b.flags & SI_RESOURCE_FLAG_UPLOAD_FLUSH_EXPLICIT_VIA_SDMA) {
- 			/* This should be true for all uploaders. */
- 			assert(transfer->box.x == 0);
-@@ -587,6 +599,7 @@ static void si_buffer_do_flush_region(st
- 			up->size = box->width;
- 			return;
- 		}
-+#endif
- 
- 		/* Copy the staging buffer into the original one. */
- 		si_copy_buffer(sctx, transfer->resource, &stransfer->staging->b.b,
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__compute__blit.c b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__compute__blit.c
index 7368fde31e..ebbbeb87b0 100644
--- a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__compute__blit.c
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__compute__blit.c
@@ -5,9 +5,9 @@ Commit: 9b331e462e5021d994859756d46cd2519d9c9c6e
 
 https://cgit.freedesktop.org/mesa/mesa/commit/?id=9b331e462e5021d994859756d46cd2519d9c9c6e
 
---- src/gallium/drivers/radeonsi/si_compute_blit.c.orig	2019-04-23 07:24:08.000000000 +0000
+--- src/gallium/drivers/radeonsi/si_compute_blit.c.orig	2018-11-01 17:49:16.000000000 +0000
 +++ src/gallium/drivers/radeonsi/si_compute_blit.c
-@@ -34,10 +34,17 @@ static enum si_cache_policy get_cache_po
+@@ -32,10 +32,17 @@ static enum si_cache_policy get_cache_po
  					     enum si_coherency coher,
  					     uint64_t size)
  {
@@ -25,9 +25,9 @@ https://cgit.freedesktop.org/mesa/mesa/commit/?id=9b331e462e5021d994859756d46cd2
  
  	return L2_BYPASS;
  }
-@@ -189,6 +196,52 @@ void si_clear_buffer(struct si_context *
- 		     uint32_t clear_value_size, enum si_coherency coher,
- 		     bool force_cpdma)
+@@ -149,6 +156,51 @@ void si_clear_buffer(struct si_context *
+ 		     uint64_t offset, uint64_t size, uint32_t *clear_value,
+ 		     uint32_t clear_value_size, enum si_coherency coher)
  {
 +#if defined(REVERT_COPY_CLEAR)
 +
@@ -38,7 +38,7 @@ https://cgit.freedesktop.org/mesa/mesa/commit/?id=9b331e462e5021d994859756d46cd2
 +#define CP_DMA_CLEAR_PERF_THRESHOLD	(32 * 1024) /* guess (clear is much slower) */
 +
 +	struct radeon_winsys *ws = sctx->ws;
-+	struct si_resource *rdst = si_resource(dst);
++	struct r600_resource *rdst = r600_resource(dst);
 +	enum si_cache_policy cache_policy = get_cache_policy(sctx, coher, size);
 +
 +	if (!size)
@@ -67,9 +67,8 @@ https://cgit.freedesktop.org/mesa/mesa/commit/?id=9b331e462e5021d994859756d46cd2
 +		offset += aligned_size;
 +		size -= aligned_size;
 +	} else if (aligned_size >= 4) {
-+		si_cp_dma_clear_buffer(sctx, sctx->gfx_cs, dst, offset,
-+				       aligned_size, *clear_value, 0, coher,
-+				       get_cache_policy(sctx, coher, size));
++		si_cp_dma_clear_buffer(sctx, dst, offset, aligned_size, *clear_value,
++				       coher, get_cache_policy(sctx, coher, size));
 +
 +		offset += aligned_size;
 +		size -= aligned_size;
@@ -78,7 +77,7 @@ https://cgit.freedesktop.org/mesa/mesa/commit/?id=9b331e462e5021d994859756d46cd2
  	if (!size)
  		return;
  
-@@ -268,6 +321,7 @@ void si_clear_buffer(struct si_context *
+@@ -227,6 +279,7 @@ void si_clear_buffer(struct si_context *
  		offset += aligned_size;
  		size -= aligned_size;
  	}
@@ -86,7 +85,7 @@ https://cgit.freedesktop.org/mesa/mesa/commit/?id=9b331e462e5021d994859756d46cd2
  
  	/* Handle non-dword alignment. */
  	if (size) {
-@@ -285,8 +339,61 @@ static void si_pipe_clear_buffer(struct 
+@@ -244,6 +297,58 @@ static void si_pipe_clear_buffer(struct 
  				 const void *clear_value,
  				 int clear_value_size)
  {
@@ -140,15 +139,20 @@ https://cgit.freedesktop.org/mesa/mesa/commit/?id=9b331e462e5021d994859756d46cd2
 +	}
 +
 +	si_clear_buffer(sctx, dst, offset, size, &dword_value,
-+			clear_value_size, SI_COHERENCY_SHADER, false);
++			clear_value_size, SI_COHERENCY_SHADER);
 +#else
+ 	enum si_coherency coher;
+ 
+ 	if (dst->flags & SI_RESOURCE_FLAG_SO_FILLED_SIZE)
+@@ -253,6 +358,7 @@ static void si_pipe_clear_buffer(struct 
+ 
  	si_clear_buffer((struct si_context*)ctx, dst, offset, size, (uint32_t*)clear_value,
- 			clear_value_size, SI_COHERENCY_SHADER, false);
+ 			clear_value_size, coher);
 +#endif
  }
  
  void si_copy_buffer(struct si_context *sctx,
-@@ -299,6 +406,17 @@ void si_copy_buffer(struct si_context *s
+@@ -265,6 +371,17 @@ void si_copy_buffer(struct si_context *s
  	enum si_coherency coher = SI_COHERENCY_SHADER;
  	enum si_cache_policy cache_policy = get_cache_policy(sctx, coher, size);
  
@@ -157,20 +161,20 @@ https://cgit.freedesktop.org/mesa/mesa/commit/?id=9b331e462e5021d994859756d46cd2
 +			      0, coher, cache_policy);
 + 
 +	if (cache_policy != L2_BYPASS)
-+ 		si_resource(dst)->TC_L2_dirty = true;
++ 		r600_resource(dst)->TC_L2_dirty = true;
 + 
 +	/* If it's not a prefetch... */
 +	if (dst_offset != src_offset)
-+		sctx->num_cp_dma_calls++;
++ 		sctx->num_cp_dma_calls++;
 +#else
  	/* Only use compute for VRAM copies on dGPUs. */
  	if (sctx->screen->info.has_dedicated_vram &&
- 	    si_resource(dst)->domains & RADEON_DOMAIN_VRAM &&
-@@ -311,6 +429,7 @@ void si_copy_buffer(struct si_context *s
+ 	    r600_resource(dst)->domains & RADEON_DOMAIN_VRAM &&
+@@ -277,6 +394,7 @@ void si_copy_buffer(struct si_context *s
  		si_cp_dma_copy_buffer(sctx, dst, src, dst_offset, src_offset, size,
  				      0, coher, cache_policy);
  	}
 +#endif
  }
  
- void si_compute_copy_image(struct si_context *sctx,
+ void si_init_compute_blit_functions(struct si_context *sctx)
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__dma__cs.c b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__dma__cs.c
deleted file mode 100644
index d28481f13d..0000000000
--- a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__dma__cs.c
+++ /dev/null
@@ -1,22 +0,0 @@
-$NetBSD$
-
-Option to revert:
-2019-02-20
-radeonsi: use SDMA for uploading data through const_uploader
-
-https://cgit.freedesktop.org/mesa/mesa/commit/?id=edbd2c1ff559cde1d9e22a9fb9059747782a72a7
-
---- src/gallium/drivers/radeonsi/si_dma_cs.c.orig	2019-02-21 02:04:29.000000000 +0000
-+++ src/gallium/drivers/radeonsi/si_dma_cs.c
-@@ -182,7 +182,11 @@ void si_need_dma_space(struct si_context
- 					 RADEON_USAGE_WRITE)))
- 		si_dma_emit_wait_idle(ctx);
- 
-+#if defined(REVERT_SDMA_UPLOADER)
-+	unsigned sync = 0;
-+#else
- 	unsigned sync = ctx->sdma_uploads_in_progress ? 0 : RADEON_USAGE_SYNCHRONIZED;
-+#endif
- 	if (dst) {
- 		ws->cs_add_buffer(ctx->dma_cs, dst->buf, RADEON_USAGE_WRITE | sync,
- 				  dst->domains, 0);
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__gfx__cs.c b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__gfx__cs.c
deleted file mode 100644
index 0a475fe31b..0000000000
--- a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__gfx__cs.c
+++ /dev/null
@@ -1,38 +0,0 @@
-$NetBSD$
-
-Option to revert:
-2019-02-20
-radeonsi: use SDMA for uploading data through const_uploader
-
-https://cgit.freedesktop.org/mesa/mesa/commit/?id=edbd2c1ff559cde1d9e22a9fb9059747782a72a7
-
---- src/gallium/drivers/radeonsi/si_gfx_cs.c.orig	2019-02-28 21:26:15.000000000 +0000
-+++ src/gallium/drivers/radeonsi/si_gfx_cs.c
-@@ -108,6 +108,19 @@ void si_flush_gfx_cs(struct si_context *
- 	if (ctx->screen->debug_flags & DBG(CHECK_VM))
- 		flags &= ~PIPE_FLUSH_ASYNC;
- 
-+#if defined(REVERT_SDMA_UPLOADER)
-+	/* If the state tracker is flushing the GFX IB, si_flush_from_st is
-+	 * responsible for flushing the DMA IB and merging the fences from both.
-+	 * This code is only needed when the driver flushes the GFX IB
-+	 * internally, and it never asks for a fence handle.
-+	 */
-+	if (radeon_emitted(ctx->dma_cs, 0)) {
-+		assert(fence == NULL); /* internal flushes only */
-+		si_flush_dma_cs(ctx, flags, NULL);
-+	}
-+
-+	ctx->gfx_flush_in_progress = true;
-+#else
- 	ctx->gfx_flush_in_progress = true;
- 
- 	/* If the state tracker is flushing the GFX IB, si_flush_from_st is
-@@ -139,6 +152,7 @@ void si_flush_gfx_cs(struct si_context *
- 	/* Flush SDMA (preamble IB). */
- 	if (radeon_emitted(ctx->dma_cs, 0))
- 		si_flush_dma_cs(ctx, flags, NULL);
-+#endif
- 
- 	if (ctx->has_graphics) {
- 		if (!LIST_IS_EMPTY(&ctx->active_queries))
diff --git a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__pipe.c b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__pipe.c
index 8f8c2e0273..f38071be44 100644
--- a/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__pipe.c
+++ b/MesaLib-dfbsd/patches/patch-src_gallium_drivers_radeonsi_si__pipe.c
@@ -12,15 +12,9 @@ Commit: 9b331e462e5021d994859756d46cd2519d9c9c6e
 
 https://cgit.freedesktop.org/mesa/mesa/commit/?id=9b331e462e5021d994859756d46cd2519d9c9c6e
 
-Option to revert:
-2019-02-20
-radeonsi: use SDMA for uploading data through const_uploader
-
-https://cgit.freedesktop.org/mesa/mesa/commit/?id=edbd2c1ff559cde1d9e22a9fb9059747782a72a7
-
---- src/gallium/drivers/radeonsi/si_pipe.c.orig	2019-04-25 21:13:31.000000000 +0000
+--- src/gallium/drivers/radeonsi/si_pipe.c.orig	2019-03-18 15:52:18.000000000 +0000
 +++ src/gallium/drivers/radeonsi/si_pipe.c
-@@ -200,10 +200,12 @@ static void si_destroy_context(struct pi
+@@ -195,10 +195,12 @@ static void si_destroy_context(struct pi
  		sctx->b.delete_vs_state(&sctx->b, sctx->vs_blit_color_layered);
  	if (sctx->vs_blit_texcoord)
  		sctx->b.delete_vs_state(&sctx->b, sctx->vs_blit_texcoord);
@@ -30,10 +24,10 @@ https://cgit.freedesktop.org/mesa/mesa/commit/?id=edbd2c1ff559cde1d9e22a9fb90597
  	if (sctx->cs_copy_buffer)
  		sctx->b.delete_compute_state(&sctx->b, sctx->cs_copy_buffer);
 +#endif
- 	if (sctx->cs_copy_image)
- 		sctx->b.delete_compute_state(&sctx->b, sctx->cs_copy_image);
- 	if (sctx->cs_copy_image_1d_array)
-@@ -383,7 +385,11 @@ static void si_set_context_param(struct
+ 
+ 	if (sctx->blitter)
+ 		util_blitter_destroy(sctx->blitter);
+@@ -367,7 +369,11 @@ static void si_set_context_param(struct 
  }
  
  static struct pipe_context *si_create_context(struct pipe_screen *screen,
@@ -45,7 +39,7 @@ https://cgit.freedesktop.org/mesa/mesa/commit/?id=edbd2c1ff559cde1d9e22a9fb90597
  {
  	struct si_context *sctx = CALLOC_STRUCT(si_context);
  	struct si_screen* sscreen = (struct si_screen *)screen;
-@@ -401,7 +407,11 @@ static struct pipe_context *si_create_co
+@@ -381,7 +387,11 @@ static struct pipe_context *si_create_co
  		sscreen->record_llvm_ir = true; /* racy but not critical */
  
  	sctx->b.screen = screen; /* this must be set first */
@@ -55,23 +49,9 @@ https://cgit.freedesktop.org/mesa/mesa/commit/?id=edbd2c1ff559cde1d9e22a9fb90597
  	sctx->b.priv = NULL;
 +#endif
  	sctx->b.destroy = si_destroy_context;
- 	sctx->screen = sscreen; /* Easy accessing of screen/winsys. */
- 	sctx->is_debug = (flags & PIPE_CONTEXT_DEBUG) != 0;
-@@ -459,8 +469,13 @@ static struct pipe_context *si_create_co
- 						   sctx, stop_exec_on_failure);
- 	}
- 
-+#if defined(REVERT_SDMA_UPLOADER)
-+	bool use_sdma_upload = false;
-+	sctx->b.const_uploader = u_upload_create(&sctx->b, 128 * 1024,
-+#else
- 	bool use_sdma_upload = sscreen->info.has_dedicated_vram && sctx->dma_cs;
- 	sctx->b.const_uploader = u_upload_create(&sctx->b, 256 * 1024,
-+#endif
- 						 0, PIPE_USAGE_DEFAULT,
- 						 SI_RESOURCE_FLAG_32BIT |
- 						 (use_sdma_upload ?
-@@ -655,6 +670,7 @@ fail:
+ 	sctx->b.emit_string_marker = si_emit_string_marker;
+ 	sctx->b.set_debug_callback = si_set_debug_callback;
+@@ -623,6 +633,7 @@ fail:
  	return NULL;
  }
  
@@ -79,7 +59,7 @@ https://cgit.freedesktop.org/mesa/mesa/commit/?id=edbd2c1ff559cde1d9e22a9fb90597
  static struct pipe_context *si_pipe_create_context(struct pipe_screen *screen,
  						   void *priv, unsigned flags)
  {
-@@ -685,6 +701,7 @@ static struct pipe_context *si_pipe_crea
+@@ -653,6 +664,7 @@ static struct pipe_context *si_pipe_crea
  				       sscreen->info.drm_major >= 3 ? si_create_fence : NULL,
  				       &((struct si_context*)ctx)->tc);
  }
@@ -87,8 +67,8 @@ https://cgit.freedesktop.org/mesa/mesa/commit/?id=edbd2c1ff559cde1d9e22a9fb90597
  
  /*
   * pipe_screen
-@@ -920,7 +937,11 @@ struct pipe_screen *radeonsi_screen_crea
- 						       debug_options, 0);
+@@ -847,7 +859,11 @@ struct pipe_screen *radeonsi_screen_crea
+ 							debug_options, 0);
  
  	/* Set functions first. */
 +#if defined(REVERT_THREADED_CONTEXT)
@@ -97,19 +77,17 @@ https://cgit.freedesktop.org/mesa/mesa/commit/?id=edbd2c1ff559cde1d9e22a9fb90597
  	sscreen->b.context_create = si_pipe_create_context;
 +#endif
  	sscreen->b.destroy = si_destroy_screen;
- 	sscreen->b.set_max_shader_compiler_threads =
- 		si_set_max_shader_compiler_threads;
-@@ -1200,8 +1221,13 @@ struct pipe_screen *radeonsi_screen_crea
+ 
+ 	si_init_screen_get_functions(sscreen);
+@@ -1111,7 +1127,11 @@ struct pipe_screen *radeonsi_screen_crea
  		si_init_compiler(sscreen, &sscreen->compiler_lowp[i]);
  
  	/* Create the auxiliary context. This must be done last. */
 +#if defined(REVERT_THREADED_CONTEXT)
-+	sscreen->aux_context = sscreen->b.context_create(
-+		&sscreen->b, NULL, sscreen->options.aux_debug ? PIPE_CONTEXT_DEBUG : 0);
++	sscreen->aux_context = sscreen->b.context_create(&sscreen->b, NULL, 0);
 +#else
- 	sscreen->aux_context = si_create_context(
- 		&sscreen->b, sscreen->options.aux_debug ? PIPE_CONTEXT_DEBUG : 0);
+ 	sscreen->aux_context = si_create_context(&sscreen->b, 0);
 +#endif
- 	if (sscreen->options.aux_debug) {
- 		struct u_log_context *log = CALLOC_STRUCT(u_log_context);
- 		u_log_context_init(log);
+ 
+ 	if (sscreen->debug_flags & DBG(TEST_DMA))
+ 		si_test_dma(sscreen);
diff --git a/MesaLib-dfbsd/patches/patch-src_gbm_Makefile.am b/MesaLib-dfbsd/patches/patch-src_gbm_Makefile.am
new file mode 100644
index 0000000000..bc09de51da
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gbm_Makefile.am
@@ -0,0 +1,12 @@
+$NetBSD: patch-src_gbm_Makefile.am,v 1.1 2018/10/07 23:49:31 ryoon Exp $
+
+--- src/gbm/Makefile.am.orig	2017-11-20 14:25:47.000000000 +0000
++++ src/gbm/Makefile.am
+@@ -28,6 +28,7 @@ libgbm_la_LIBADD = \
+ 	$(top_builddir)/src/loader/libloader.la \
+ 	$(top_builddir)/src/util/libmesautil.la \
+ 	$(top_builddir)/src/util/libxmlconfig.la \
++	$(PTHREAD_LIBS) \
+ 	$(DLOPEN_LIBS)
+ 
+ if HAVE_PLATFORM_WAYLAND
diff --git a/MesaLib-dfbsd/patches/patch-src_gbm_backends_dri_gbm__dri.c b/MesaLib-dfbsd/patches/patch-src_gbm_backends_dri_gbm__dri.c
new file mode 100644
index 0000000000..9fdaaa6c40
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_gbm_backends_dri_gbm__dri.c
@@ -0,0 +1,21 @@
+$NetBSD$
+
+Patch from NetBSD xsrc:
+don't return void
+
+--- src/gbm/backends/dri/gbm_dri.c.orig	2019-04-05 10:53:23.000000000 +0000
++++ src/gbm/backends/dri/gbm_dri.c
+@@ -182,8 +182,13 @@ swrast_put_image(__DRIdrawable *driDrawa
+                  char          *data,
+                  void          *loaderPrivate)
+ {
++#if defined(STRICT_XSRC_NETBSD)
++   swrast_put_image2(driDrawable, op, x, y, width, height,
++                     width * 4, data, loaderPrivate);
++#else
+    return swrast_put_image2(driDrawable, op, x, y, width, height,
+                             width * 4, data, loaderPrivate);
++#endif
+ }
+ 
+ static void
diff --git a/MesaLib-dfbsd/patches/patch-src_glx_Makefile.am b/MesaLib-dfbsd/patches/patch-src_glx_Makefile.am
new file mode 100644
index 0000000000..8b397f010e
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_glx_Makefile.am
@@ -0,0 +1,49 @@
+$NetBSD: patch-src_glx_Makefile.am,v 1.3 2019/01/19 23:21:43 tnn Exp $
+
+- We don't need libmesautil.la here. Those symbols seem to already be
+  included in libmesa.la.
+- force libtool to use clang++ to link libGL on OSX.
+  Otherwise we get:
+  Undefined symbols for architecture x86_64:
+  "std::terminate()", referenced from:
+      ___clang_call_terminate in libglx.a(glsl_parser.o)
+      ...
+
+--- src/glx/Makefile.am.orig	2019-01-17 11:26:23.000000000 +0000
++++ src/glx/Makefile.am
+@@ -89,10 +89,16 @@ libglx_la_SOURCES = \
+ 	singlepix.c \
+ 	vertarr.c
+ 
++if HAVE_APPLEDRI
++libglx_la_LIBADD = \
++	$(top_builddir)/src/loader/libloader.la \
++	$(top_builddir)/src/util/libxmlconfig.la
++else
+ libglx_la_LIBADD = \
+ 	$(top_builddir)/src/loader/libloader.la \
+ 	$(top_builddir)/src/util/libmesautil.la \
+ 	$(top_builddir)/src/util/libxmlconfig.la
++endif
+ 
+ if HAVE_DRISW
+ libglx_la_SOURCES += \
+@@ -136,6 +142,7 @@ libglx_la_SOURCES += \
+ 
+ SUBDIRS += apple
+ libglx_la_LIBADD += $(builddir)/apple/libappleglx.la
++libglx_la_LIBADD += $(top_builddir)/src/mesa/libmesa.la
+ endif
+ 
+ if HAVE_WINDOWSDRI
+@@ -187,6 +194,10 @@ lib@GL_LIB@_la_SOURCES =
+ lib@GL_LIB@_la_LIBADD = $(GL_LIBS)
+ lib@GL_LIB@_la_LDFLAGS = $(GL_LDFLAGS)
+ 
++if HAVE_APPLEDRI
++lib@GL_LIB@_la_SOURCES += apple_dummy.cpp
++endif
++
+ if HAVE_WINDOWSDRI
+ lib@GL_LIB@_la_LDFLAGS += -lgdi32 -lopengl32 -Wl,--disable-stdcall-fixup
+ endif
diff --git a/MesaLib-dfbsd/patches/patch-src_glx_glxext.c b/MesaLib-dfbsd/patches/patch-src_glx_glxext.c
index 1ce9e9b86e..af8f679e4d 100644
--- a/MesaLib-dfbsd/patches/patch-src_glx_glxext.c
+++ b/MesaLib-dfbsd/patches/patch-src_glx_glxext.c
@@ -35,7 +35,7 @@ $NetBSD: patch-src_glx_glxext.c,v 1.1 2018/10/07 23:49:31 ryoon Exp $
     if (glx_direct && glx_accel) {
  #if defined(HAVE_DRI3)
 -      if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
-+#if ((defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)) || defined(__DragonFly__) || defined(__NetBSD__)
++#if ((defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !defined(__DRM_NEXT__)) || defined(TEST_DRI3_ENABLE)
 +      if (env_var_as_boolean("LIBGL_DRI3_ENABLE", false))
 +#endif
 +      if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false)) {
diff --git a/MesaLib-dfbsd/patches/patch-src_intel_Makefile.tools.am b/MesaLib-dfbsd/patches/patch-src_intel_Makefile.tools.am
new file mode 100644
index 0000000000..cc2f67a2dc
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_intel_Makefile.tools.am
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_intel_Makefile.tools.am,v 1.1 2018/10/07 23:49:31 ryoon Exp $
+
+-lrt for shm_open in aubinator.c, a more portable alternative to memfd_create
+
+--- src/intel/Makefile.tools.am.orig	2018-09-07 21:18:07.000000000 +0000
++++ src/intel/Makefile.tools.am
+@@ -43,6 +43,7 @@ tools_aubinator_LDADD = \
+ 	$(PTHREAD_LIBS) \
+ 	$(DLOPEN_LIBS) \
+ 	$(ZLIB_LIBS) \
++	-lrt \
+ 	-lm
+ 
+ 
diff --git a/MesaLib-dfbsd/patches/patch-src_intel_isl_isl__tiled__memcpy.c b/MesaLib-dfbsd/patches/patch-src_intel_isl_isl__tiled__memcpy.c
deleted file mode 100644
index 0342ae9cac..0000000000
--- a/MesaLib-dfbsd/patches/patch-src_intel_isl_isl__tiled__memcpy.c
+++ /dev/null
@@ -1,26 +0,0 @@
-$NetBSD: patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c,v 1.1 2018/10/07 23:49:31 ryoon Exp $
-
-From wip/MesaLib 13.0.1.
-
---- src/intel/isl/isl_tiled_memcpy.c.orig	2019-04-12 23:16:58.000000000 +0000
-+++ src/intel/isl/isl_tiled_memcpy.c
-@@ -64,6 +64,11 @@ ror(uint32_t n, uint32_t d)
-    return (n >> d) | (n << (32 - d));
- }
- 
-+#if defined(__NetBSD__)
-+/* Handle conflicting declaration and conflicting macro in netbsd */
-+#undef bswap32
-+#define bswap32(n) __builtin_bswap32(n)
-+#else /* !__NetBSD__ */
- static inline uint32_t
- bswap32(uint32_t n)
- {
-@@ -76,6 +81,7 @@ bswap32(uint32_t n)
-           (n << 24);
- #endif
- }
-+#endif /* NetBSD */
- 
- /**
-  * Copy RGBA to BGRA - swap R and B.
diff --git a/MesaLib-dfbsd/patches/patch-src_intel_perf_gen__perf.h b/MesaLib-dfbsd/patches/patch-src_intel_perf_gen__perf.h
deleted file mode 100644
index b01d65e18f..0000000000
--- a/MesaLib-dfbsd/patches/patch-src_intel_perf_gen__perf.h
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
---- src/intel/perf/gen_perf.h.orig	2019-04-17 15:42:13.000000000 +0000
-+++ src/intel/perf/gen_perf.h
-@@ -28,7 +28,9 @@
- #include <stdint.h>
- #include <string.h>
- 
-+#ifdef MAJOR_IN_SYSMACROS
- #include <sys/sysmacros.h>
-+#endif
- 
- #include "util/hash_table.h"
- #include "util/ralloc.h"
diff --git a/MesaLib-dfbsd/patches/patch-src_intel_vulkan_anv__device.c b/MesaLib-dfbsd/patches/patch-src_intel_vulkan_anv__device.c
index 0a31d5c8d0..8b05296a0b 100644
--- a/MesaLib-dfbsd/patches/patch-src_intel_vulkan_anv__device.c
+++ b/MesaLib-dfbsd/patches/patch-src_intel_vulkan_anv__device.c
@@ -10,7 +10,7 @@ https://reviews.freebsd.org/D17872
 
 * Define CLOCK_MONOTONIC_RAW if missing
 
---- src/intel/vulkan/anv_device.c.orig	2019-03-13 03:11:55.000000000 +0000
+--- src/intel/vulkan/anv_device.c.orig	2018-12-11 21:13:57.000000000 +0000
 +++ src/intel/vulkan/anv_device.c
 @@ -25,7 +25,9 @@
  #include <stdbool.h>
@@ -22,9 +22,9 @@ https://reviews.freebsd.org/D17872
  #include <unistd.h>
  #include <fcntl.h>
  #include <xf86drm.h>
-@@ -49,6 +51,17 @@
-  */
- #define MAX_DEBUG_MESSAGE_LENGTH    4096
+@@ -44,6 +46,17 @@
+ 
+ #include "genxml/gen7_pack.h"
  
 +#ifndef ETIME
 +#define ETIME ETIMEDOUT
@@ -39,9 +39,9 @@ https://reviews.freebsd.org/D17872
 +
  static void
  compiler_debug_log(void *data, const char *fmt, ...)
- {
-@@ -85,10 +98,18 @@ static uint64_t
- anv_compute_heap_size(int fd, uint64_t gtt_size)
+ { }
+@@ -64,10 +77,18 @@ static VkResult
+ anv_compute_heap_size(int fd, uint64_t gtt_size, uint64_t *heap_size)
  {
     /* Query the total ram from the system */
 +#ifdef __GLIBC__
diff --git a/MesaLib-dfbsd/patches/patch-src_mapi_entry__x86__tsd.h b/MesaLib-dfbsd/patches/patch-src_mapi_entry__x86__tsd.h
deleted file mode 100644
index 96e0232156..0000000000
--- a/MesaLib-dfbsd/patches/patch-src_mapi_entry__x86__tsd.h
+++ /dev/null
@@ -1,86 +0,0 @@
-$NetBSD$
-
-From OpenBSD xenocara
-
-Make similiar changes to the i386 tsd dispatch assembly as libglvnd to
-avoid a text relocation fixing the build with lld.
-
-This time store the address of the GOT in ebx as required before calling
-the PLT stub and change .balign value to match X86_ENTRY_SIZE as suggested
-by naddy.
-
---- src/mapi/entry_x86_tsd.h.orig	2019-03-06 23:05:20.000000000 +0000
-+++ src/mapi/entry_x86_tsd.h
-@@ -31,18 +31,51 @@
- #define HIDDEN
- #endif
- 
-+#if defined(X86_TSD_OPENBSD)
-+#define X86_ENTRY_SIZE 64
-+#else
- #define X86_ENTRY_SIZE 32
-+#endif
- 
- __asm__(".text\n"
-+#if defined(X86_TSD_OPENBSD)
-+        ".balign " U_STRINGIFY(X86_ENTRY_SIZE) "\n"
-+#else
-         ".balign 32\n"
-+#endif
-         "x86_entry_start:");
- 
-+
-+#if defined(X86_TSD_OPENBSD)
-+#define STUB_ASM_ENTRY(func)        \
-+   ".globl " func "\n"              \
-+   ".type " func ", @function\n"    \
-+   ".balign " U_STRINGIFY(X86_ENTRY_SIZE) "\n" \
-+   func ":"
-+#else
- #define STUB_ASM_ENTRY(func)        \
-    ".globl " func "\n"              \
-    ".type " func ", @function\n"    \
-    ".balign 32\n"                   \
-    func ":"
-+#endif
- 
-+#if defined(X86_TSD_OPENBSD)
-+#define STUB_ASM_CODE(slot)         \
-+   "push %ebx\n\t"                  \
-+   "call 1f\n"                      \
-+   "1:\n\t"                         \
-+   "popl %ebx\n\t"                  \
-+   "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx\n\t" \
-+   "movl " ENTRY_CURRENT_TABLE "@GOT(%ebx), %eax\n\t" \
-+   "mov (%eax), %eax\n\t"           \
-+   "testl %eax, %eax\n\t"           \
-+   "jne 1f\n\t"                     \
-+   "call " ENTRY_CURRENT_TABLE_GET "@PLT\n" \
-+   "1:\n\t"                         \
-+   "pop %ebx\n\t"                   \
-+   "jmp *(4 * " slot ")(%eax)"
-+#else
- #define STUB_ASM_CODE(slot)         \
-    "movl " ENTRY_CURRENT_TABLE ", %eax\n\t" \
-    "testl %eax, %eax\n\t"           \
-@@ -51,14 +84,20 @@ __asm__(".text\n"
-    "1:\n\t"                         \
-    "call " ENTRY_CURRENT_TABLE_GET "\n\t" \
-    "jmp *(4 * " slot ")(%eax)"
-+#endif
- 
- #define MAPI_TMP_STUB_ASM_GCC
- #include "mapi_tmp.h"
- 
- #ifndef MAPI_MODE_BRIDGE
- 
-+#if defined(X86_TSD_OPENBSD)
-+__asm__(".balign " U_STRINGIFY(X86_ENTRY_SIZE) "\n"
-+        "x86_entry_end:");
-+#else
- __asm__(".balign 32\n"
-         "x86_entry_end:");
-+#endif
- 
- #include <string.h>
- #include "u_execmem.h"
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c
new file mode 100644
index 0000000000..7ce4a377cc
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-src_mesa_drivers_dri_i965_brw__oa__metrics.c,v 1.1 2019/01/10 22:30:11 tnn Exp $
+
+XXX compilation takes forever with clang 7.0
+
+--- src/mesa/drivers/dri/i965/brw_oa_metrics.c.orig	2018-12-11 21:14:35.000000000 +0000
++++ src/mesa/drivers/dri/i965/brw_oa_metrics.c
+@@ -1,3 +1,6 @@
++#if defined(__clang__)
++#pragma clang optimize off
++#endif
+ /* Autogenerated file, DO NOT EDIT manually! generated by brw_oa.py
+  *
+  * Copyright (c) 2015 Intel Corporation
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_brw__performance__query.c b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_brw__performance__query.c
new file mode 100644
index 0000000000..2511b9da14
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_brw__performance__query.c
@@ -0,0 +1,72 @@
+$NetBSD: patch-src_mesa_drivers_dri_i965_brw__performance__query.c,v 1.2 2018/10/16 15:21:20 jperkin Exp $
+
+Prevents libdrm i915_drm.h header from being used.
+libdrm 2.4.88 does not have certain symbols defined in its i915_drm.h.
+
+--- src/mesa/drivers/dri/i965/brw_performance_query.c.orig	2018-09-07 21:18:07.000000000 +0000
++++ src/mesa/drivers/dri/i965/brw_performance_query.c
+@@ -56,7 +56,7 @@
+ #include <sys/ioctl.h>
+ 
+ #include <xf86drm.h>
+-#include <i915_drm.h>
++#include "drm-uapi/i915_drm.h"
+ 
+ #include "main/hash.h"
+ #include "main/macros.h"
+@@ -1796,6 +1796,9 @@ enumerate_sysfs_metrics(struct brw_conte
+    DIR *metricsdir = NULL;
+    struct dirent *metric_entry;
+    int len;
++#ifdef __sun
++   struct stat s;
++#endif
+ 
+    len = snprintf(buf, sizeof(buf), "%s/metrics", brw->perfquery.sysfs_dev_dir);
+    if (len < 0 || len >= sizeof(buf)) {
+@@ -1812,10 +1815,18 @@ enumerate_sysfs_metrics(struct brw_conte
+    while ((metric_entry = readdir(metricsdir))) {
+       struct hash_entry *entry;
+ 
++#if defined(__sun)
++      stat(metric_entry->d_name, &s);
++      if ((s.st_mode != S_IFDIR &&
++           s.st_mode != S_IFLNK) ||
++          metric_entry->d_name[0] == '.')
++         continue;
++#else
+       if ((metric_entry->d_type != DT_DIR &&
+            metric_entry->d_type != DT_LNK) ||
+           metric_entry->d_name[0] == '.')
+          continue;
++#endif
+ 
+       DBG("metric set: %s\n", metric_entry->d_name);
+       entry = _mesa_hash_table_search(brw->perfquery.oa_metrics_table,
+@@ -2057,6 +2068,9 @@ get_sysfs_dev_dir(struct brw_context *br
+    DIR *drmdir;
+    struct dirent *drm_entry;
+    int len;
++#ifdef __sun
++   struct stat s;
++#endif
+ 
+    brw->perfquery.sysfs_dev_dir[0] = '\0';
+ 
+@@ -2088,9 +2102,16 @@ get_sysfs_dev_dir(struct brw_context *br
+    }
+ 
+    while ((drm_entry = readdir(drmdir))) {
++#if defined(__sun)
++      stat(drm_entry->d_name, &s);
++      if ((s.st_mode == S_IFDIR ||
++           s.st_mode == S_IFLNK) &&
++          strncmp(drm_entry->d_name, "card", 4) == 0)
++#else
+       if ((drm_entry->d_type == DT_DIR ||
+            drm_entry->d_type == DT_LNK) &&
+           strncmp(drm_entry->d_name, "card", 4) == 0)
++#endif
+       {
+          len = snprintf(brw->perfquery.sysfs_dev_dir,
+                         sizeof(brw->perfquery.sysfs_dev_dir),
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c
new file mode 100644
index 0000000000..c89b564bca
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c
@@ -0,0 +1,26 @@
+$NetBSD: patch-src_mesa_drivers_dri_i965_intel__tiled__memcpy.c,v 1.1 2018/10/07 23:49:31 ryoon Exp $
+
+From wip/MesaLib 13.0.1.
+
+--- src/mesa/drivers/dri/i965/intel_tiled_memcpy.c.orig	2019-02-18 18:28:16.000000000 +0000
++++ src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
+@@ -64,6 +64,11 @@ ror(uint32_t n, uint32_t d)
+    return (n >> d) | (n << (32 - d));
+ }
+ 
++#if defined(__NetBSD__)
++/* Handle conflicting declaration and conflicting macro in netbsd */
++#undef bswap32
++#define bswap32(n) __builtin_bswap32(n)
++#else /* !__NetBSD__ */
+ static inline uint32_t
+ bswap32(uint32_t n)
+ {
+@@ -76,6 +81,7 @@ bswap32(uint32_t n)
+           (n << 24);
+ #endif
+ }
++#endif /* NetBSD */
+ 
+ /**
+  * Copy RGBA to BGRA - swap R and B.
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_drivers_x11_Makefile.am b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_x11_Makefile.am
new file mode 100644
index 0000000000..6e9b38bd41
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_drivers_x11_Makefile.am
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_mesa_drivers_x11_Makefile.am,v 1.1 2019/01/19 21:54:03 tnn Exp $
+
+We don't need libmesautil.la here. Those symbols seem to already be
+included in libmesa.la.
+
+--- src/mesa/drivers/x11/Makefile.am.orig	2019-01-17 11:26:23.000000000 +0000
++++ src/mesa/drivers/x11/Makefile.am
+@@ -68,7 +68,6 @@ GL_PATCH = 0
+ lib@GL_LIB@_la_LIBADD = \
+ 	$(top_builddir)/src/mesa/libmesa.la \
+ 	$(top_builddir)/src/mapi/glapi/libglapi.la \
+-	$(top_builddir)/src/util/libmesautil.la \
+ 	$(SHARED_GLAPI_LIB) \
+ 	$(GL_LIB_DEPS)
+ 
diff --git a/MesaLib-dfbsd/patches/patch-src_mesa_main_context.c b/MesaLib-dfbsd/patches/patch-src_mesa_main_context.c
index 7c32f870db..255f0c83ca 100644
--- a/MesaLib-dfbsd/patches/patch-src_mesa_main_context.c
+++ b/MesaLib-dfbsd/patches/patch-src_mesa_main_context.c
@@ -9,9 +9,9 @@ https://bugs.freedesktop.org/show_bug.cgi?id=82246
 FreeBSD reported atexit bug for 10.6:
 https://bugs.freedesktop.org/show_bug.cgi?id=91869
 
---- src/mesa/main/context.c.orig	2019-05-03 15:59:12.000000000 +0000
+--- src/mesa/main/context.c.orig	2017-11-20 14:25:47.000000000 +0000
 +++ src/mesa/main/context.c
-@@ -357,11 +357,23 @@ mtx_t OneTimeLock = _MTX_INITIALIZER_NP;
+@@ -354,11 +354,23 @@ mtx_t OneTimeLock = _MTX_INITIALIZER_NP;
   * Calls all the various one-time-fini functions in Mesa
   */
  
@@ -35,7 +35,7 @@ https://bugs.freedesktop.org/show_bug.cgi?id=91869
  }
  
  /**
-@@ -376,7 +388,9 @@ one_time_fini(void)
+@@ -373,7 +385,9 @@ one_time_fini(void)
  static void
  one_time_init( struct gl_context *ctx )
  {
@@ -45,7 +45,7 @@ https://bugs.freedesktop.org/show_bug.cgi?id=91869
  
     mtx_lock(&OneTimeLock);
  
-@@ -401,7 +415,9 @@ one_time_init( struct gl_context *ctx )
+@@ -398,7 +412,9 @@ one_time_init( struct gl_context *ctx )
           _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
        }
  
diff --git a/MesaLib-dfbsd/patches/patch-src_util_Makefile.am b/MesaLib-dfbsd/patches/patch-src_util_Makefile.am
new file mode 100644
index 0000000000..48facf1ec6
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_util_Makefile.am
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_util_Makefile.am,v 1.1 2019/01/10 22:30:11 tnn Exp $
+
+handled with CONF_FILES
+
+--- src/util/Makefile.am.orig	2018-12-11 21:13:57.000000000 +0000
++++ src/util/Makefile.am
+@@ -75,7 +75,7 @@ libxmlconfig_la_CFLAGS = \
+ libxmlconfig_la_LIBADD = $(EXPAT_LIBS) -lm
+ 
+ drircdir = $(datadir)/drirc.d
+-drirc_DATA = 00-mesa-defaults.conf
++drirc_DATA = # 00-mesa-defaults.conf
+ 
+ u_atomic_test_LDADD = libmesautil.la
+ roundeven_test_LDADD = -lm
diff --git a/MesaLib-dfbsd/patches/patch-src_util_futex.h b/MesaLib-dfbsd/patches/patch-src_util_futex.h
new file mode 100644
index 0000000000..5120686726
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_util_futex.h
@@ -0,0 +1,53 @@
+$NetBSD: patch-src_util_futex.h,v 1.1 2018/10/07 23:49:31 ryoon Exp $
+
+Implement futex_wake() and futex_wait() via _umtx_op()
+
+FreeBSD Bugzilla - Bug 225415: graphics/mesa-dri: update to 18.0.0
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225415
+
+--- src/util/futex.h.orig	2018-02-09 02:18:00.000000000 +0000
++++ src/util/futex.h
+@@ -29,10 +29,35 @@
+ #include <limits.h>
+ #include <stdint.h>
+ #include <unistd.h>
++#if defined(__FreeBSD__)
++#include <errno.h>
++# if __FreeBSD__ < 11
++#  include <machine/atomic.h>
++# endif
++#include <sys/umtx.h>
++#else
+ #include <linux/futex.h>
+ #include <sys/syscall.h>
++#endif
+ #include <sys/time.h>
+ 
++#if defined(__FreeBSD__)
++static inline int futex_wake(uint32_t *addr, int count)
++{
++   return _umtx_op(addr, UMTX_OP_WAKE, (uint32_t)count, NULL, NULL) == -1 ? errno : 0;
++}
++
++static inline int futex_wait(uint32_t *addr, int32_t value, struct timespec *timeout)
++{
++   void *uaddr = NULL, *uaddr2 = NULL;
++   if (timeout != NULL) {
++      const struct _umtx_time tmo = { ._timeout = *timeout, ._flags = UMTX_ABSTIME, ._clockid = CLOCK_MONOTONIC };
++      uaddr = (void *)(uintptr_t)sizeof(tmo);
++      uaddr2 = (void *)&tmo;
++   }
++   return _umtx_op(addr, UMTX_OP_WAIT_UINT, (uint32_t)value, uaddr, uaddr2) == -1 ? errno : 0;
++}
++#else
+ static inline long sys_futex(void *addr1, int op, int val1, const struct timespec *timeout, void *addr2, int val3)
+ {
+    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
+@@ -50,6 +75,7 @@ static inline int futex_wait(uint32_t *a
+    return sys_futex(addr, FUTEX_WAIT_BITSET, value, timeout, NULL,
+                     FUTEX_BITSET_MATCH_ANY);
+ }
++#endif
+ 
+ #endif
+ 
diff --git a/MesaLib-dfbsd/patches/patch-src_util_ralloc.h b/MesaLib-dfbsd/patches/patch-src_util_ralloc.h
deleted file mode 100644
index 12125d2ef1..0000000000
--- a/MesaLib-dfbsd/patches/patch-src_util_ralloc.h
+++ /dev/null
@@ -1,51 +0,0 @@
-$NetBSD$
-
---- src/util/ralloc.h.orig	2019-03-23 16:29:21.000000000 +0000
-+++ src/util/ralloc.h
-@@ -426,7 +426,7 @@ bool ralloc_vasprintf_append(char **str,
-  *
-  * which is more idiomatic in C++ than calling ralloc.
-  */
--#define DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(TYPE, ALLOC_FUNC)           \
-+#define DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(TYPE, ALLOC_FUNC, USE_DESTRUCTOR) \
- private:                                                                 \
-    static void _ralloc_destructor(void *p)                               \
-    {                                                                     \
-@@ -437,7 +437,7 @@ public:                                 
-    {                                                                     \
-       void *p = ALLOC_FUNC(mem_ctx, size);                               \
-       assert(p != NULL);                                                 \
--      if (!HAS_TRIVIAL_DESTRUCTOR(TYPE))                                 \
-+      if (USE_DESTRUCTOR && !HAS_TRIVIAL_DESTRUCTOR(TYPE))               \
-          ralloc_set_destructor(p, _ralloc_destructor);                   \
-       return p;                                                          \
-    }                                                                     \
-@@ -454,16 +454,24 @@ public:                                 
-    }
- 
- #define DECLARE_RALLOC_CXX_OPERATORS(type) \
--   DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, ralloc_size)
-+   DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, ralloc_size, true)
- 
- #define DECLARE_RZALLOC_CXX_OPERATORS(type) \
--   DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, rzalloc_size)
-+   DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, rzalloc_size, true)
- 
-+#if defined(NO_LINEAR_ALLOC_DESTRUCTOR)
- #define DECLARE_LINEAR_ALLOC_CXX_OPERATORS(type) \
--   DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, linear_alloc_child)
-+   DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, linear_alloc_child, false)
- 
- #define DECLARE_LINEAR_ZALLOC_CXX_OPERATORS(type) \
--   DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, linear_zalloc_child)
-+   DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, linear_zalloc_child, false)
-+#else
-+#define DECLARE_LINEAR_ALLOC_CXX_OPERATORS(type) \
-+   DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, linear_alloc_child, true)
-+
-+#define DECLARE_LINEAR_ZALLOC_CXX_OPERATORS(type) \
-+   DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, linear_zalloc_child, true)
-+#endif
- 
- 
- /**
diff --git a/MesaLib-dfbsd/patches/patch-src_util_u__math.h b/MesaLib-dfbsd/patches/patch-src_util_u__math.h
new file mode 100644
index 0000000000..4f46b5d92b
--- /dev/null
+++ b/MesaLib-dfbsd/patches/patch-src_util_u__math.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+From NetBSD xsrc:
+
+Use a name for the largest representable float
+
+Actually intended to appease vax which has a floating point format
+that doesn't match the same range as IEEE754 float.
+
+(why not exp2f?)
+
+--- src/util/u_math.h.orig	2019-04-05 10:53:23.000000000 +0000
++++ src/util/u_math.h
+@@ -117,7 +117,11 @@ util_fast_exp2(float x)
+    union fi epart;
+ 
+    if(x > 129.00000f)
++#if defined(__NetBSD__)
++      return FLT_MAX;
++#else
+       return 3.402823466e+38f;
++#endif
+ 
+    if (x < -126.99999f)
+       return 0.0f;
diff --git a/MesaLib-dfbsd/patches/patch-src_util_u__thread.h b/MesaLib-dfbsd/patches/patch-src_util_u__thread.h
index 8f27f91a28..4d32d7d34f 100644
--- a/MesaLib-dfbsd/patches/patch-src_util_u__thread.h
+++ b/MesaLib-dfbsd/patches/patch-src_util_u__thread.h
@@ -7,7 +7,9 @@ From FreeBSD ports / DragonFly dports
 - Implement setting thread name
 - Use monotonic clock for timeouts
 
---- src/util/u_thread.h.orig	2019-03-15 01:02:19.000000000 +0000
+https://reviews.freebsd.org/D17872
+
+--- src/util/u_thread.h.orig	2019-04-05 10:53:23.000000000 +0000
 +++ src/util/u_thread.h
 @@ -34,6 +34,13 @@
  
@@ -23,16 +25,18 @@ From FreeBSD ports / DragonFly dports
  #endif
  
  static inline thrd_t u_thread_create(int (*routine)(void *), void *param)
-@@ -65,6 +72,8 @@ static inline void u_thread_setname( con
+@@ -64,6 +71,10 @@ static inline void u_thread_setname( con
        (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) && \
        defined(__linux__)
     pthread_setname_np(pthread_self(), name);
 +#  elif defined(__DragonFly__) || defined(__FreeBSD__)
 +   pthread_set_name_np(pthread_self(), name);
++#  elif defined(__NetBSD__)
++   pthread_setname_np(pthread_self(), "%s", (void*)name);
  #  endif
  #endif
     (void)name;
-@@ -84,6 +93,17 @@ static inline void
+@@ -83,6 +94,17 @@ static inline void
  util_pin_thread_to_L3(thrd_t thread, unsigned L3_index, unsigned cores_per_L3)
  {
  #if defined(HAVE_PTHREAD_SETAFFINITY)
@@ -50,7 +54,7 @@ From FreeBSD ports / DragonFly dports
     cpu_set_t cpuset;
  
     CPU_ZERO(&cpuset);
-@@ -91,6 +111,7 @@ util_pin_thread_to_L3(thrd_t thread, uns
+@@ -90,6 +112,7 @@ util_pin_thread_to_L3(thrd_t thread, uns
        CPU_SET(L3_index * cores_per_L3 + i, &cpuset);
     pthread_setaffinity_np(thread, sizeof(cpuset), &cpuset);
  #endif
@@ -58,7 +62,7 @@ From FreeBSD ports / DragonFly dports
  }
  
  /**
-@@ -104,6 +125,35 @@ static inline int
+@@ -103,6 +126,35 @@ static inline int
  util_get_L3_for_pinned_thread(thrd_t thread, unsigned cores_per_L3)
  {
  #if defined(HAVE_PTHREAD_SETAFFINITY)
@@ -94,7 +98,7 @@ From FreeBSD ports / DragonFly dports
     cpu_set_t cpuset;
  
     if (pthread_getaffinity_np(thread, sizeof(cpuset), &cpuset) == 0) {
-@@ -124,6 +174,7 @@ util_get_L3_for_pinned_thread(thrd_t thr
+@@ -123,6 +175,7 @@ util_get_L3_for_pinned_thread(thrd_t thr
        return L3_index;
     }
  #endif
@@ -102,7 +106,7 @@ From FreeBSD ports / DragonFly dports
     return -1;
  }
  
-@@ -135,7 +186,7 @@ util_get_L3_for_pinned_thread(thrd_t thr
+@@ -134,7 +187,7 @@ util_get_L3_for_pinned_thread(thrd_t thr
  static inline int64_t
  u_thread_get_time_nano(thrd_t thread)
  {
diff --git a/MesaLib-dfbsd/patches/patch-src_util_xmlconfig.c b/MesaLib-dfbsd/patches/patch-src_util_xmlconfig.c
index 87def19ed9..b429692fea 100644
--- a/MesaLib-dfbsd/patches/patch-src_util_xmlconfig.c
+++ b/MesaLib-dfbsd/patches/patch-src_util_xmlconfig.c
@@ -3,11 +3,11 @@ $NetBSD: patch-src_util_xmlconfig.c,v 1.1 2018/10/07 23:49:31 ryoon Exp $
 PR pkg/50202.
 Provide compat strndup for older Darwin.
 
---- src/util/xmlconfig.c.orig	2019-03-05 18:53:12.177053000 +0000
+--- src/util/xmlconfig.c.orig	2018-09-07 21:18:07.000000000 +0000
 +++ src/util/xmlconfig.c
-@@ -47,6 +47,24 @@
- #define PATH_MAX 4096
- #endif
+@@ -39,6 +39,23 @@
+ #include "xmlconfig.h"
+ #include "u_process.h"
  
 +#if (defined(__APPLE__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 < 1070)
 +static char *
@@ -26,7 +26,6 @@ Provide compat strndup for older Darwin.
 +    return (copy);
 +}
 +#endif
-+
+ 
  /** \brief Find an option in an option cache with the name as key */
  static uint32_t
- findOption(const driOptionCache *cache, const char *name)


Home | Main Index | Thread Index | Old Index