summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2023-01-22 20:12:11 +0100
committerMatthieu Herrb <matthieu@herrb.eu>2023-01-22 20:12:11 +0100
commit6e3ebfdd4d9f19c40a1c119e9ff7bccfaff088c5 (patch)
tree7a6edc23d267ac58d2f46593d108f98868aeec9d
parentd7cfe0e419a2d828a82ba27efd4766ba3b75a9c8 (diff)
graphics/mesa: update to 22.3.3. OpenBSD patches by jsg@
-rw-r--r--graphics/mesa/Makefile10
-rw-r--r--graphics/mesa/distinfo4
-rw-r--r--graphics/mesa/patches/patch-_gitignore9
-rw-r--r--graphics/mesa/patches/patch-meson_build38
-rw-r--r--graphics/mesa/patches/patch-src_amd_addrlib_src_chip_gfx10_gfx10_gb_reg_h20
-rw-r--r--graphics/mesa/patches/patch-src_amd_addrlib_src_chip_gfx11_gfx11_gb_reg_h20
-rw-r--r--graphics/mesa/patches/patch-src_amd_addrlib_src_chip_gfx9_gfx9_gb_reg_h20
-rw-r--r--graphics/mesa/patches/patch-src_amd_addrlib_src_chip_r800_si_gb_reg_h20
-rw-r--r--graphics/mesa/patches/patch-src_egl_drivers_dri2_egl_dri2_c21
-rw-r--r--graphics/mesa/patches/patch-src_gallium_auxiliary_rtasm_rtasm_execmem_c14
-rw-r--r--graphics/mesa/patches/patch-src_gallium_frontends_lavapipe_meson_build12
-rw-r--r--graphics/mesa/patches/patch-src_glx_meson_build6
-rw-r--r--graphics/mesa/patches/patch-src_loader_loader_c10
-rw-r--r--graphics/mesa/patches/patch-src_mapi_u_execmem_c6
-rw-r--r--graphics/mesa/patches/patch-src_mesa_main_execmem_c172
-rw-r--r--graphics/mesa/patches/patch-src_util_build_id_c1
-rw-r--r--graphics/mesa/patches/patch-src_util_build_id_h1
-rw-r--r--graphics/mesa/patches/patch-src_util_compiler_h37
-rw-r--r--graphics/mesa/patches/patch-src_util_disk_cache_c15
-rw-r--r--graphics/mesa/patches/patch-src_util_disk_cache_h3
-rw-r--r--graphics/mesa/patches/patch-src_util_disk_cache_os_c15
-rw-r--r--graphics/mesa/patches/patch-src_util_os_file_c34
-rw-r--r--graphics/mesa/patches/patch-src_util_rand_xor_c3
-rw-r--r--graphics/mesa/patches/patch-src_util_u_atomic_c58
-rw-r--r--graphics/mesa/patches/patch-src_util_u_cpu_detect_c2
-rw-r--r--graphics/mesa/patches/patch-src_util_xmlconfig_h17
-rw-r--r--graphics/mesa/patches/patch-src_vulkan_wsi_wsi_common_drm_c19
-rw-r--r--graphics/mesa/pkg/PLIST2
28 files changed, 415 insertions, 174 deletions
diff --git a/graphics/mesa/Makefile b/graphics/mesa/Makefile
index abd23fc..b13a177 100644
--- a/graphics/mesa/Makefile
+++ b/graphics/mesa/Makefile
@@ -6,10 +6,10 @@ COMMENT = the Mesa 3D Graphics Library
DPB_PROPERTIES = parallel
-DISTNAME = mesa-22.1.7
+DISTNAME = mesa-22.3.3
-SHARED_LIBS = EGL 1.1 gbm 0.4 glapi 0.2 GL 17.1 GLESv1_CM 2.0 GLESv2 2.0 \
- OSMesa 11.0
+SHARED_LIBS = EGL 1.2 gbm 0.4 glapi 0.4 GL 17.2 GLESv1_CM 2.0 GLESv2 2.0 \
+ OSMesa 12.1
CATEGORIES = graphics
@@ -22,7 +22,7 @@ PERMIT_PACKAGE = Yes
MODULES = devel/meson xenocara
-WANTLIB = drm drm_intel drm_radeon m pthread z expat \
+WANTLIB = drm drm_radeon m pthread z expat \
xcb xcb-shm X11-xcb X11 \
xcb-dri3 xcb-xfixes xcb-present xcb-sync \
xshmfence Xext Xfixes xcb-glx xcb-dri2 \
@@ -34,6 +34,7 @@ EXTRACT_SUFX = .tar.xz
BUILD_DEPENDS = sysutils/libdrm \
devel/xorgproto \
+ graphics/glslang \
www/py-mako,python3 \
devel/bison
@@ -43,7 +44,6 @@ LIB_DEPENDS = archivers/zstd \
x11/libxcb \
x11/libXext \
x11/libXfixes \
- x11/libXrandr \
x11/libXxf86vm \
x11/libxshmfence \
diff --git a/graphics/mesa/distinfo b/graphics/mesa/distinfo
index 58ad5fc..f4c0db1 100644
--- a/graphics/mesa/distinfo
+++ b/graphics/mesa/distinfo
@@ -1,2 +1,2 @@
-SHA256 (mesa-22.1.7.tar.xz) = 2oOOss8R0OCNDplE9r1Nlph/3FnqKFb4xwoxqCs1XYk=
-SIZE (mesa-22.1.7.tar.xz) = 16109944
+SHA256 (mesa-22.3.3.tar.xz) = vteZeIvyvZ7wedl82OCTSL9TywhoGFeOQHc7KxeBKSI=
+SIZE (mesa-22.3.3.tar.xz) = 17009624
diff --git a/graphics/mesa/patches/patch-_gitignore b/graphics/mesa/patches/patch-_gitignore
new file mode 100644
index 0000000..8b49dba
--- /dev/null
+++ b/graphics/mesa/patches/patch-_gitignore
@@ -0,0 +1,9 @@
+Index: .gitignore
+--- .gitignore.orig
++++ .gitignore
+@@ -1,4 +1,5 @@
+ *.pyc
+ *.pyo
+ *.out
++**/obj
+ /build
diff --git a/graphics/mesa/patches/patch-meson_build b/graphics/mesa/patches/patch-meson_build
index 83ae18f..cf6b5a0 100644
--- a/graphics/mesa/patches/patch-meson_build
+++ b/graphics/mesa/patches/patch-meson_build
@@ -1,27 +1,23 @@
Index: meson.build
--- meson.build.orig
+++ meson.build
-@@ -60,6 +60,10 @@ pre_args = [
- c_args = []
- cpp_args = []
-
-+if host_machine.system() == 'openbsd'
-+ pre_args += '-D_ISOC11_SOURCE'
-+endif
-+
- with_moltenvk_dir = get_option('moltenvk-dir')
- with_vulkan_icd_dir = get_option('vulkan-icd-dir')
- with_tests = get_option('build-tests')
-@@ -1411,7 +1415,7 @@ foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h',
- endforeach
-
- foreach f : ['strtof', 'mkostemp', 'timespec_get', 'memfd_create', 'random_r',
-- 'flock', 'strtok_r', 'getrandom', 'qsort_r', 'qsort_s']
-+ 'flock', 'strtok_r', 'getrandom', 'arc4random_buf', 'qsort_r', 'qsort_s']
- if cc.has_function(f)
- pre_args += '-DHAVE_@0@'.format(f.to_upper())
- endif
-@@ -1487,6 +1491,9 @@ if cc.links('int main() { return 0; }',
+@@ -1151,7 +1151,6 @@ else
+ '-Werror=empty-body',
+ '-Werror=incompatible-pointer-types',
+ '-Werror=int-conversion',
+- '-Wimplicit-fallthrough',
+ '-Wno-missing-field-initializers',
+ '-Wno-format-truncation',
+ '-fno-math-errno',
+@@ -1418,6 +1417,7 @@ functions_to_detect = {
+ 'timespec_get': '#include <time.h>',
+ 'memfd_create': '',
+ 'random_r': '',
++ 'arc4random_buf': '',
+ 'flock': '',
+ 'strtok_r': '',
+ 'getrandom': '',
+@@ -1549,6 +1549,9 @@ if cc.links('int main() { return 0; }',
endif
ld_args_build_id = cc.get_supported_link_arguments('-Wl,--build-id=sha1')
diff --git a/graphics/mesa/patches/patch-src_amd_addrlib_src_chip_gfx10_gfx10_gb_reg_h b/graphics/mesa/patches/patch-src_amd_addrlib_src_chip_gfx10_gfx10_gb_reg_h
new file mode 100644
index 0000000..bb79d84
--- /dev/null
+++ b/graphics/mesa/patches/patch-src_amd_addrlib_src_chip_gfx10_gfx10_gb_reg_h
@@ -0,0 +1,20 @@
+Index: src/amd/addrlib/src/chip/gfx10/gfx10_gb_reg.h
+--- src/amd/addrlib/src/chip/gfx10/gfx10_gb_reg.h.orig
++++ src/amd/addrlib/src/chip/gfx10/gfx10_gb_reg.h
+@@ -36,10 +36,12 @@
+ //
+ // Make sure the necessary endian defines are there.
+ //
+-#if defined(LITTLEENDIAN_CPU)
+-#elif defined(BIGENDIAN_CPU)
+-#else
+-#error "BIGENDIAN_CPU or LITTLEENDIAN_CPU must be defined"
++#include "util/u_endian.h"
++
++#if UTIL_ARCH_LITTLE_ENDIAN
++#define LITTLEENDIAN_CPU
++#elif UTIL_ARCH_BIG_ENDIAN
++#define BIGENDIAN_CPU
+ #endif
+
+ union GB_ADDR_CONFIG_GFX10
diff --git a/graphics/mesa/patches/patch-src_amd_addrlib_src_chip_gfx11_gfx11_gb_reg_h b/graphics/mesa/patches/patch-src_amd_addrlib_src_chip_gfx11_gfx11_gb_reg_h
new file mode 100644
index 0000000..3e9d794
--- /dev/null
+++ b/graphics/mesa/patches/patch-src_amd_addrlib_src_chip_gfx11_gfx11_gb_reg_h
@@ -0,0 +1,20 @@
+Index: src/amd/addrlib/src/chip/gfx11/gfx11_gb_reg.h
+--- src/amd/addrlib/src/chip/gfx11/gfx11_gb_reg.h.orig
++++ src/amd/addrlib/src/chip/gfx11/gfx11_gb_reg.h
+@@ -36,10 +36,12 @@
+ //
+ // Make sure the necessary endian defines are there.
+ //
+-#if defined(LITTLEENDIAN_CPU)
+-#elif defined(BIGENDIAN_CPU)
+-#else
+-#error "BIGENDIAN_CPU or LITTLEENDIAN_CPU must be defined"
++#include "util/u_endian.h"
++
++#if UTIL_ARCH_LITTLE_ENDIAN
++#define LITTLEENDIAN_CPU
++#elif UTIL_ARCH_BIG_ENDIAN
++#define BIGENDIAN_CPU
+ #endif
+
+ union GB_ADDR_CONFIG_GFX11
diff --git a/graphics/mesa/patches/patch-src_amd_addrlib_src_chip_gfx9_gfx9_gb_reg_h b/graphics/mesa/patches/patch-src_amd_addrlib_src_chip_gfx9_gfx9_gb_reg_h
new file mode 100644
index 0000000..e63d4d1
--- /dev/null
+++ b/graphics/mesa/patches/patch-src_amd_addrlib_src_chip_gfx9_gfx9_gb_reg_h
@@ -0,0 +1,20 @@
+Index: src/amd/addrlib/src/chip/gfx9/gfx9_gb_reg.h
+--- src/amd/addrlib/src/chip/gfx9/gfx9_gb_reg.h.orig
++++ src/amd/addrlib/src/chip/gfx9/gfx9_gb_reg.h
+@@ -36,10 +36,12 @@
+ //
+ // Make sure the necessary endian defines are there.
+ //
+-#if defined(LITTLEENDIAN_CPU)
+-#elif defined(BIGENDIAN_CPU)
+-#else
+-#error "BIGENDIAN_CPU or LITTLEENDIAN_CPU must be defined"
++#include "util/u_endian.h"
++
++#if UTIL_ARCH_LITTLE_ENDIAN
++#define LITTLEENDIAN_CPU
++#elif UTIL_ARCH_BIG_ENDIAN
++#define BIGENDIAN_CPU
+ #endif
+
+ union GB_ADDR_CONFIG_GFX9 {
diff --git a/graphics/mesa/patches/patch-src_amd_addrlib_src_chip_r800_si_gb_reg_h b/graphics/mesa/patches/patch-src_amd_addrlib_src_chip_r800_si_gb_reg_h
new file mode 100644
index 0000000..1634f6e
--- /dev/null
+++ b/graphics/mesa/patches/patch-src_amd_addrlib_src_chip_r800_si_gb_reg_h
@@ -0,0 +1,20 @@
+Index: src/amd/addrlib/src/chip/r800/si_gb_reg.h
+--- src/amd/addrlib/src/chip/r800/si_gb_reg.h.orig
++++ src/amd/addrlib/src/chip/r800/si_gb_reg.h
+@@ -37,10 +37,12 @@
+ //
+ // Make sure the necessary endian defines are there.
+ //
+-#if defined(LITTLEENDIAN_CPU)
+-#elif defined(BIGENDIAN_CPU)
+-#else
+-#error "BIGENDIAN_CPU or LITTLEENDIAN_CPU must be defined"
++#include "util/u_endian.h"
++
++#if UTIL_ARCH_LITTLE_ENDIAN
++#define LITTLEENDIAN_CPU
++#elif UTIL_ARCH_BIG_ENDIAN
++#define BIGENDIAN_CPU
+ #endif
+
+ /*
diff --git a/graphics/mesa/patches/patch-src_egl_drivers_dri2_egl_dri2_c b/graphics/mesa/patches/patch-src_egl_drivers_dri2_egl_dri2_c
new file mode 100644
index 0000000..4045846
--- /dev/null
+++ b/graphics/mesa/patches/patch-src_egl_drivers_dri2_egl_dri2_c
@@ -0,0 +1,21 @@
+Index: src/egl/drivers/dri2/egl_dri2.c
+--- src/egl/drivers/dri2/egl_dri2.c.orig
++++ src/egl/drivers/dri2/egl_dri2.c
+@@ -2452,8 +2452,6 @@ dri2_get_sync_values_chromium(_EGLDisplay *disp, _EGLS
+ if (dri2_dpy->vtbl->get_sync_values)
+ ret = dri2_dpy->vtbl->get_sync_values(disp, surf, ust, msc, sbc);
+
+- mtx_unlock(&dri2_dpy->lock);
+-
+ return ret;
+ }
+
+@@ -2577,8 +2575,6 @@ dri2_query_surface(_EGLDisplay *disp, _EGLSurface *sur
+ } else {
+ ret = dri2_dpy->vtbl->query_surface(disp, surf, attribute, value);
+ }
+-
+- mtx_unlock(&dri2_dpy->lock);
+
+ return ret;
+ }
diff --git a/graphics/mesa/patches/patch-src_gallium_auxiliary_rtasm_rtasm_execmem_c b/graphics/mesa/patches/patch-src_gallium_auxiliary_rtasm_rtasm_execmem_c
index c148eab..db2f222 100644
--- a/graphics/mesa/patches/patch-src_gallium_auxiliary_rtasm_rtasm_execmem_c
+++ b/graphics/mesa/patches/patch-src_gallium_auxiliary_rtasm_rtasm_execmem_c
@@ -1,13 +1,12 @@
-
Index: src/gallium/auxiliary/rtasm/rtasm_execmem.c
--- src/gallium/auxiliary/rtasm/rtasm_execmem.c.orig
+++ src/gallium/auxiliary/rtasm/rtasm_execmem.c
-@@ -68,10 +68,19 @@ static mtx_t exec_mutex = _MTX_INITIALIZER_NP;
- static struct mem_block *exec_heap = NULL;
+@@ -66,9 +66,19 @@ static struct mem_block *exec_heap = NULL;
static unsigned char *exec_mem = NULL;
-+#ifdef __OpenBSD__
++#ifdef __OpenBSD__
++
static int
init_heap(void)
{
@@ -22,11 +21,12 @@ Index: src/gallium/auxiliary/rtasm/rtasm_execmem.c
if (!exec_heap)
exec_heap = u_mmInit( 0, EXEC_HEAP_SIZE );
-@@ -83,6 +92,7 @@ init_heap(void)
+@@ -79,6 +89,8 @@ init_heap(void)
+
return (exec_mem != MAP_FAILED);
}
-
++
+#endif
+
void *
- rtasm_exec_malloc(size_t size)
diff --git a/graphics/mesa/patches/patch-src_gallium_frontends_lavapipe_meson_build b/graphics/mesa/patches/patch-src_gallium_frontends_lavapipe_meson_build
deleted file mode 100644
index 0f370d7..0000000
--- a/graphics/mesa/patches/patch-src_gallium_frontends_lavapipe_meson_build
+++ /dev/null
@@ -1,12 +0,0 @@
-Index: src/gallium/frontends/lavapipe/meson.build
---- src/gallium/frontends/lavapipe/meson.build.orig
-+++ src/gallium/frontends/lavapipe/meson.build
-@@ -44,6 +44,6 @@ liblavapipe_st = static_library(
- c_args : [ c_msvc_compat_args, lvp_flags ],
- gnu_symbol_visibility : 'hidden',
- include_directories : [ inc_include, inc_src, inc_util, inc_gallium, inc_compiler, inc_gallium_aux ],
-- dependencies : [ dep_llvm, idep_nir, idep_mesautil, idep_vulkan_util, idep_vulkan_wsi,
-- idep_vulkan_runtime, lvp_deps ]
-+ dependencies : [ dep_xcb, dep_llvm, idep_nir, idep_mesautil, idep_vulkan_util, idep_vulkan_wsi,
-+ idep_vulkan_runtime ]
- )
diff --git a/graphics/mesa/patches/patch-src_glx_meson_build b/graphics/mesa/patches/patch-src_glx_meson_build
index 7e02501..437f498 100644
--- a/graphics/mesa/patches/patch-src_glx_meson_build
+++ b/graphics/mesa/patches/patch-src_glx_meson_build
@@ -1,8 +1,7 @@
-
Index: src/glx/meson.build
--- src/glx/meson.build.orig
+++ src/glx/meson.build
-@@ -122,12 +122,23 @@ else
+@@ -122,12 +122,22 @@ else
)
endif
@@ -12,11 +11,10 @@ Index: src/glx/meson.build
+ ]
+else
+ gl_lib_define = [
-+ '-DGL_LIB_NAME="lib@0@.so"'.format(gl_lib_name),
++ '-DGL_LIB_NAME="lib@0@.so"'.format(gl_lib_name )
+ ]
+endif
+
-+
libglx = static_library(
'glx',
[files_libglx, glx_generated],
diff --git a/graphics/mesa/patches/patch-src_loader_loader_c b/graphics/mesa/patches/patch-src_loader_loader_c
index f2839e3..c917f92 100644
--- a/graphics/mesa/patches/patch-src_loader_loader_c
+++ b/graphics/mesa/patches/patch-src_loader_loader_c
@@ -1,16 +1,16 @@
Index: src/loader/loader.c
--- src/loader/loader.c.orig
+++ src/loader/loader.c
-@@ -543,7 +543,7 @@ loader_get_driver_for_fd(int fd)
+@@ -561,7 +561,7 @@ loader_get_driver_for_fd(int fd)
* user's problem, but this allows vc4 simulator to run on an i965 host,
* and may be useful for some touch testing of i915 on an i965 host.
*/
- if (geteuid() == getuid()) {
+ if (issetugid() == 0 && geteuid() == getuid()) {
- driver = getenv("MESA_LOADER_DRIVER_OVERRIDE");
- if (driver)
- return strdup(driver);
-@@ -607,7 +607,7 @@ loader_open_driver_lib(const char *driver_name,
+ const char *override = os_get_option("MESA_LOADER_DRIVER_OVERRIDE");
+ if (override)
+ return strdup(override);
+@@ -625,7 +625,7 @@ loader_open_driver_lib(const char *driver_name,
const char *search_paths, *next, *end;
search_paths = NULL;
diff --git a/graphics/mesa/patches/patch-src_mapi_u_execmem_c b/graphics/mesa/patches/patch-src_mapi_u_execmem_c
index c6cad33..c2466f0 100644
--- a/graphics/mesa/patches/patch-src_mapi_u_execmem_c
+++ b/graphics/mesa/patches/patch-src_mapi_u_execmem_c
@@ -1,13 +1,13 @@
-
Index: src/mapi/u_execmem.c
--- src/mapi/u_execmem.c.orig
+++ src/mapi/u_execmem.c
-@@ -46,7 +46,14 @@ static unsigned int head = 0;
+@@ -45,8 +45,15 @@ static unsigned int head = 0;
+
static unsigned char *exec_mem = (unsigned char *)0;
++#if defined(__OpenBSD__)
-#if defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__)
-+#if defined(__OpenBSD__)
+static int
+init_map(void)
+{
diff --git a/graphics/mesa/patches/patch-src_mesa_main_execmem_c b/graphics/mesa/patches/patch-src_mesa_main_execmem_c
new file mode 100644
index 0000000..d5f8f17
--- /dev/null
+++ b/graphics/mesa/patches/patch-src_mesa_main_execmem_c
@@ -0,0 +1,172 @@
+Index: src/mesa/main/execmem.c
+--- src/mesa/main/execmem.c.orig
++++ src/mesa/main/execmem.c
+@@ -0,0 +1,168 @@
++/*
++ * Mesa 3-D graphics library
++ *
++ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this software and associated documentation files (the "Software"),
++ * to deal in the Software without restriction, including without limitation
++ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
++ * and/or sell copies of the Software, and to permit persons to whom the
++ * Software is furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be included
++ * in all copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
++ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
++ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
++ * OTHER DEALINGS IN THE SOFTWARE.
++ */
++
++
++/**
++ * \file execmem.c
++ * Functions for allocating executable memory.
++ *
++ * \author Keith Whitwell
++ */
++
++
++#include <stdio.h>
++#include "main/glheader.h"
++#include "execmem.h"
++#include "c11/threads.h"
++
++
++#if defined(__OpenBSD__)
++
++void *
++_mesa_exec_malloc(GLuint size)
++{
++ return NULL;
++}
++
++void
++_mesa_exec_free(void *addr)
++{
++}
++
++#elif defined(__linux__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__)
++
++/*
++ * Allocate a large block of memory which can hold code then dole it out
++ * in pieces by means of the generic memory manager code.
++*/
++
++#include <unistd.h>
++#include <sys/mman.h>
++#include "util/u_mm.h"
++
++#ifdef MESA_SELINUX
++#include <selinux/selinux.h>
++#endif
++
++
++#ifndef MAP_ANONYMOUS
++#define MAP_ANONYMOUS MAP_ANON
++#endif
++
++
++#define EXEC_HEAP_SIZE (10*1024*1024)
++
++static mtx_t exec_mutex = _MTX_INITIALIZER_NP;
++
++static struct mem_block *exec_heap = NULL;
++static unsigned char *exec_mem = NULL;
++
++
++static int
++init_heap(void)
++{
++#ifdef MESA_SELINUX
++ if (is_selinux_enabled()) {
++ if (!security_get_boolean_active("allow_execmem") ||
++ !security_get_boolean_pending("allow_execmem"))
++ return 0;
++ }
++#endif
++
++ if (!exec_heap)
++ exec_heap = u_mmInit( 0, EXEC_HEAP_SIZE );
++
++ if (!exec_mem)
++ exec_mem = mmap(NULL, EXEC_HEAP_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
++
++ return (exec_mem != MAP_FAILED);
++}
++
++
++void *
++_mesa_exec_malloc(unsigned size)
++{
++ struct mem_block *block = NULL;
++ void *addr = NULL;
++
++ mtx_lock(&exec_mutex);
++
++ if (!init_heap())
++ goto bail;
++
++ if (exec_heap) {
++ size = (size + 31) & ~31;
++ block = u_mmAllocMem(exec_heap, size, 5, 0);
++ }
++
++ if (block)
++ addr = exec_mem + block->ofs;
++ else
++ printf("_mesa_exec_malloc failed\n");
++
++bail:
++ mtx_unlock(&exec_mutex);
++
++ return addr;
++}
++
++
++void
++_mesa_exec_free(void *addr)
++{
++ mtx_lock(&exec_mutex);
++
++ if (exec_heap) {
++ struct mem_block *block = u_mmFindBlock(exec_heap, (unsigned char *)addr - exec_mem);
++
++ if (block)
++ u_mmFreeMem(block);
++ }
++
++ mtx_unlock(&exec_mutex);
++}
++
++
++#else
++
++/*
++ * Just use regular memory.
++ */
++
++void *
++_mesa_exec_malloc(unsigned size)
++{
++ return malloc( size );
++}
++
++
++void
++_mesa_exec_free(void *addr)
++{
++ free(addr);
++}
++
++
++#endif
diff --git a/graphics/mesa/patches/patch-src_util_build_id_c b/graphics/mesa/patches/patch-src_util_build_id_c
index c9a38ff..3c778b9 100644
--- a/graphics/mesa/patches/patch-src_util_build_id_c
+++ b/graphics/mesa/patches/patch-src_util_build_id_c
@@ -1,4 +1,3 @@
-
Index: src/util/build_id.c
--- src/util/build_id.c.orig
+++ src/util/build_id.c
diff --git a/graphics/mesa/patches/patch-src_util_build_id_h b/graphics/mesa/patches/patch-src_util_build_id_h
index 9275bbc..582ca9b 100644
--- a/graphics/mesa/patches/patch-src_util_build_id_h
+++ b/graphics/mesa/patches/patch-src_util_build_id_h
@@ -1,4 +1,3 @@
-
Index: src/util/build_id.h
--- src/util/build_id.h.orig
+++ src/util/build_id.h
diff --git a/graphics/mesa/patches/patch-src_util_compiler_h b/graphics/mesa/patches/patch-src_util_compiler_h
new file mode 100644
index 0000000..17385bc
--- /dev/null
+++ b/graphics/mesa/patches/patch-src_util_compiler_h
@@ -0,0 +1,37 @@
+Index: src/util/compiler.h
+--- src/util/compiler.h.orig
++++ src/util/compiler.h
+@@ -45,28 +45,16 @@
+ * Try to use a runtime test instead.
+ * For now, only used by some DRI hardware drivers for color/texel packing.
+ */
+-#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
+-#if defined(__linux__)
+-#include <byteswap.h>
+-#define CPU_TO_LE32( x ) bswap_32( x )
+-#elif defined(__APPLE__)
+-#include <CoreFoundation/CFByteOrder.h>
+-#define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x )
+-#elif defined(__OpenBSD__)
+-#include <sys/types.h>
++#ifdef __OpenBSD__
++#include <endian.h>
+ #define CPU_TO_LE32( x ) htole32( x )
+-#else /*__linux__ */
+-#include <sys/endian.h>
+-#define CPU_TO_LE32( x ) bswap32( x )
+-#endif /*__linux__*/
++#define LE32_TO_CPU( x ) letoh32( x )
++#if BYTE_ORDER == BIG_ENDIAN
+ #define MESA_BIG_ENDIAN 1
+ #else
+-#define CPU_TO_LE32( x ) ( x )
+ #define MESA_LITTLE_ENDIAN 1
+ #endif
+-#define LE32_TO_CPU( x ) CPU_TO_LE32( x )
+-
+-
++#endif /* __OpenBSD__ */
+
+ #define IEEE_ONE 0x3f800000
+
diff --git a/graphics/mesa/patches/patch-src_util_disk_cache_c b/graphics/mesa/patches/patch-src_util_disk_cache_c
new file mode 100644
index 0000000..785798e
--- /dev/null
+++ b/graphics/mesa/patches/patch-src_util_disk_cache_c
@@ -0,0 +1,15 @@
+Index: src/util/disk_cache.c
+--- src/util/disk_cache.c.orig
++++ src/util/disk_cache.c
+@@ -80,6 +80,11 @@ disk_cache_create(const char *gpu_name, const char *dr
+ uint8_t cache_version = CACHE_VERSION;
+ size_t cv_size = sizeof(cache_version);
+
++#ifdef __OpenBSD__
++ /* default to no disk shader cache to avoid pledge violations in chromium */
++ return NULL;
++#endif
++
+ if (!disk_cache_enabled())
+ return NULL;
+
diff --git a/graphics/mesa/patches/patch-src_util_disk_cache_h b/graphics/mesa/patches/patch-src_util_disk_cache_h
index 17f32e0..b4c437a 100644
--- a/graphics/mesa/patches/patch-src_util_disk_cache_h
+++ b/graphics/mesa/patches/patch-src_util_disk_cache_h
@@ -1,8 +1,7 @@
-
Index: src/util/disk_cache.h
--- src/util/disk_cache.h.orig
+++ src/util/disk_cache.h
-@@ -121,7 +121,7 @@ disk_cache_get_function_identifier(void *ptr, struct m
+@@ -123,7 +123,7 @@ disk_cache_get_function_identifier(void *ptr, struct m
{
uint32_t timestamp;
diff --git a/graphics/mesa/patches/patch-src_util_disk_cache_os_c b/graphics/mesa/patches/patch-src_util_disk_cache_os_c
deleted file mode 100644
index 3b2664d..0000000
--- a/graphics/mesa/patches/patch-src_util_disk_cache_os_c
+++ /dev/null
@@ -1,15 +0,0 @@
-Index: src/util/disk_cache_os.c
---- src/util/disk_cache_os.c.orig
-+++ src/util/disk_cache_os.c
-@@ -861,6 +861,11 @@ disk_cache_generate_cache_dir(void *mem_ctx, const cha
- bool
- disk_cache_enabled()
- {
-+#ifdef __OpenBSD__
-+ /* default to no disk shader cache to avoid pledge violations in chromium */
-+ return NULL;
-+#endif
-+
- /* If running as a users other than the real user disable cache */
- if (geteuid() != getuid())
- return false;
diff --git a/graphics/mesa/patches/patch-src_util_os_file_c b/graphics/mesa/patches/patch-src_util_os_file_c
deleted file mode 100644
index 3655191..0000000
--- a/graphics/mesa/patches/patch-src_util_os_file_c
+++ /dev/null
@@ -1,34 +0,0 @@
-Index: src/util/os_file.c
---- src/util/os_file.c.orig
-+++ src/util/os_file.c
-@@ -86,6 +86,8 @@ os_dupfd_cloexec(int fd)
- typedef ptrdiff_t ssize_t;
- #endif
-
-+#if DETECT_OS_LINUX
-+
- static ssize_t
- readN(int fd, char *buf, size_t len)
- {
-@@ -191,7 +193,6 @@ os_read_file(const char *filename, size_t *size)
- return buf;
- }
-
--#if DETECT_OS_LINUX
-
- #include <sys/syscall.h>
- #include <unistd.h>
-@@ -212,6 +213,13 @@ os_same_file_description(int fd1, int fd2)
- }
-
- #else
-+
-+char *
-+os_read_file(const char *filename, size_t *size)
-+{
-+ errno = -ENOSYS;
-+ return NULL;
-+}
-
- int
- os_same_file_description(int fd1, int fd2)
diff --git a/graphics/mesa/patches/patch-src_util_rand_xor_c b/graphics/mesa/patches/patch-src_util_rand_xor_c
index 59ac477..97480e8 100644
--- a/graphics/mesa/patches/patch-src_util_rand_xor_c
+++ b/graphics/mesa/patches/patch-src_util_rand_xor_c
@@ -1,4 +1,3 @@
-
Index: src/util/rand_xor.c
--- src/util/rand_xor.c.orig
+++ src/util/rand_xor.c
@@ -15,7 +14,7 @@ Index: src/util/rand_xor.c
size_t seed_size = sizeof(uint64_t) * 2;
-#if defined(HAVE_GETRANDOM)
-+#if defined(HAVE_ARC4RANDOM_BUF)
++#ifdef HAVE_ARC4RANDOM_BUF
+ arc4random_buf(seed, seed_size);
+ return;
+#elif defined(HAVE_GETRANDOM)
diff --git a/graphics/mesa/patches/patch-src_util_u_atomic_c b/graphics/mesa/patches/patch-src_util_u_atomic_c
deleted file mode 100644
index 8c1bb55..0000000
--- a/graphics/mesa/patches/patch-src_util_u_atomic_c
+++ /dev/null
@@ -1,58 +0,0 @@
-Index: src/util/u_atomic.c
---- src/util/u_atomic.c.orig
-+++ src/util/u_atomic.c
-@@ -32,6 +32,21 @@
- #define WEAK
- #endif
-
-+#ifdef __clang__
-+#pragma clang diagnostic ignored "-Wmissing-prototypes"
-+#pragma redefine_extname __sync_add_and_fetch_8_c __sync_add_and_fetch_8
-+#pragma redefine_extname __sync_sub_and_fetch_8_c __sync_sub_and_fetch_8
-+#pragma redefine_extname __sync_fetch_and_add_8_c __sync_fetch_and_add_8
-+#pragma redefine_extname __sync_fetch_and_sub_8_c __sync_fetch_and_sub_8
-+#pragma redefine_extname __sync_val_compare_and_swap_8_c \
-+ __sync_val_compare_and_swap_8
-+#define __sync_add_and_fetch_8 __sync_add_and_fetch_8_c
-+#define __sync_sub_and_fetch_8 __sync_sub_and_fetch_8_c
-+#define __sync_fetch_and_add_8 __sync_fetch_and_add_8_c
-+#define __sync_fetch_and_sub_8 __sync_fetch_and_sub_8_c
-+#define __sync_val_compare_and_swap_8 __sync_val_compare_and_swap_8_c
-+#endif
-+
- static pthread_mutex_t sync_mutex = PTHREAD_MUTEX_INITIALIZER;
-
- #ifdef __clang__
-@@ -70,6 +85,32 @@ __sync_sub_and_fetch_8(uint64_t *ptr, uint64_t val)
- pthread_mutex_lock(&sync_mutex);
- *ptr -= val;
- r = *ptr;
-+ pthread_mutex_unlock(&sync_mutex);
-+
-+ return r;
-+}
-+
-+WEAK uint64_t
-+__sync_fetch_and_add_8(uint64_t *ptr, uint64_t val)
-+{
-+ uint64_t r;
-+
-+ pthread_mutex_lock(&sync_mutex);
-+ r = *ptr;
-+ *ptr += val;
-+ pthread_mutex_unlock(&sync_mutex);
-+
-+ return r;
-+}
-+
-+WEAK uint64_t
-+__sync_fetch_and_sub_8(uint64_t *ptr, uint64_t val)
-+{
-+ uint64_t r;
-+
-+ pthread_mutex_lock(&sync_mutex);
-+ r = *ptr;
-+ *ptr -= val;
- pthread_mutex_unlock(&sync_mutex);
-
- return r;
diff --git a/graphics/mesa/patches/patch-src_util_u_cpu_detect_c b/graphics/mesa/patches/patch-src_util_u_cpu_detect_c
index d90c6fb..4eedf07 100644
--- a/graphics/mesa/patches/patch-src_util_u_cpu_detect_c
+++ b/graphics/mesa/patches/patch-src_util_u_cpu_detect_c
@@ -1,7 +1,7 @@
Index: src/util/u_cpu_detect.c
--- src/util/u_cpu_detect.c.orig
+++ src/util/u_cpu_detect.c
-@@ -215,10 +215,13 @@ check_os_altivec_support(void)
+@@ -224,10 +224,13 @@ check_os_altivec_support(void)
util_cpu_caps.has_altivec = 1;
diff --git a/graphics/mesa/patches/patch-src_util_xmlconfig_h b/graphics/mesa/patches/patch-src_util_xmlconfig_h
new file mode 100644
index 0000000..c67594b
--- /dev/null
+++ b/graphics/mesa/patches/patch-src_util_xmlconfig_h
@@ -0,0 +1,17 @@
+Index: src/util/xmlconfig.h
+--- src/util/xmlconfig.h.orig
++++ src/util/xmlconfig.h
+@@ -39,7 +39,12 @@
+ extern "C" {
+ #endif
+
+-#if defined(ANDROID) || defined(_WIN32)
++/*
++ * Opening drirc files is disabled by default so sandboxed
++ * browser processes with OpenGL contexts can drop the ability
++ * to read files.
++ */
++#if defined(ANDROID) || defined(_WIN32) || defined(__OpenBSD__)
+ #define WITH_XMLCONFIG 0
+ #else
+ #define WITH_XMLCONFIG 1
diff --git a/graphics/mesa/patches/patch-src_vulkan_wsi_wsi_common_drm_c b/graphics/mesa/patches/patch-src_vulkan_wsi_wsi_common_drm_c
new file mode 100644
index 0000000..21f1b3c
--- /dev/null
+++ b/graphics/mesa/patches/patch-src_vulkan_wsi_wsi_common_drm_c
@@ -0,0 +1,19 @@
+Index: src/vulkan/wsi/wsi_common_drm.c
+--- src/vulkan/wsi/wsi_common_drm.c.orig
++++ src/vulkan/wsi/wsi_common_drm.c
+@@ -32,8 +32,15 @@
+ #include "drm-uapi/drm_fourcc.h"
+
+ #include <errno.h>
++
++#ifdef __linux__
+ #include <linux/dma-buf.h>
+ #include <linux/sync_file.h>
++#else
++#define DMA_BUF_SYNC_RW 1
++#define DMA_BUF_BASE 'b'
++#endif
++
+ #include <time.h>
+ #include <unistd.h>
+ #include <stdlib.h>
diff --git a/graphics/mesa/pkg/PLIST b/graphics/mesa/pkg/PLIST
index 9c2d22c..ab784f3 100644
--- a/graphics/mesa/pkg/PLIST
+++ b/graphics/mesa/pkg/PLIST
@@ -1,6 +1,6 @@
include/EGL/egl.h
include/EGL/eglext.h
-include/EGL/eglextchromium.h
+include/EGL/eglext_angle.h
include/EGL/eglmesaext.h
include/EGL/eglplatform.h
include/GL/gl.h