summaryrefslogtreecommitdiff
path: root/graphics/mesa-devel/files
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/mesa-devel/files')
-rw-r--r--graphics/mesa-devel/files/libmap.conf.in26
-rw-r--r--graphics/mesa-devel/files/patch-freebsd1134
-rw-r--r--graphics/mesa-devel/files/patch-i38653
-rw-r--r--graphics/mesa-devel/files/patch-libdrm-2.4.99107
-rw-r--r--graphics/mesa-devel/files/patch-suffix179
5 files changed, 399 insertions, 0 deletions
diff --git a/graphics/mesa-devel/files/libmap.conf.in b/graphics/mesa-devel/files/libmap.conf.in
new file mode 100644
index 000000000000..2807add2fb05
--- /dev/null
+++ b/graphics/mesa-devel/files/libmap.conf.in
@@ -0,0 +1,26 @@
+# EGL/GLX built with -Dglvnd=false
+libEGL.so.1 libEGL%%PKGNAMESUFFIX%%.so.1
+libGL.so.1 libGL%%PKGNAMESUFFIX%%.so.1
+libGLESv1_CM.so.1 libGLESv1_CM%%PKGNAMESUFFIX%%.so.1
+libGLESv2.so.2 libGLESv2%%PKGNAMESUFFIX%%.so.2
+
+# EGL/GLX built with -Dglvnd=true
+# Xorg sets GLX_EXT_libglvnd to "mesa" by default
+libEGL_mesa.so.0 libEGL_mesa%%PKGNAMESUFFIX%%.so.0
+libGLX_mesa.so.0 libGLX_mesa%%PKGNAMESUFFIX%%.so.0
+
+# Fallback if GLX_EXT_libglvnd is missing or vendor library doesn't exist
+libGLX_indirect.so.0 libGLX_mesa%%PKGNAMESUFFIX%%.so.0
+
+# GBM clients like eglkms and wlroots fail otherwise
+libgbm.so.1 libgbm%%PKGNAMESUFFIX%%.so.1
+
+# Avoid different versions of the same driver showing up as multiple GPUs
+%%PREFIX%%/lib/libvulkan_intel.so libvulkan_intel%%PKGNAMESUFFIX%%.so
+%%PREFIX%%/lib/libvulkan_radeon.so libvulkan_radeon%%PKGNAMESUFFIX%%.so
+
+# VAAPI/VDPAU
+%%PREFIX%%/lib/dri/r600_drv_video.so %%PREFIX%%/lib/dri%%PKGNAMESUFFIX%%/r600_drv_video.so
+%%PREFIX%%/lib/dri/radeonsi_drv_video.so %%PREFIX%%/lib/dri%%PKGNAMESUFFIX%%/radeonsi_drv_video.so
+%%PREFIX%%/lib/vdpau/libvdpau_r600.so.1 %%PREFIX%%/lib/vdpau%%PKGNAMESUFFIX%%/libvdpau_r600.so.1
+%%PREFIX%%/lib/vdpau/libvdpau_radeonsi.so.1 %%PREFIX%%/lib/vdpau%%PKGNAMESUFFIX%%/libvdpau_radeonsi.so.1
diff --git a/graphics/mesa-devel/files/patch-freebsd11 b/graphics/mesa-devel/files/patch-freebsd11
new file mode 100644
index 000000000000..f5f626705c2a
--- /dev/null
+++ b/graphics/mesa-devel/files/patch-freebsd11
@@ -0,0 +1,34 @@
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225302
+
+../src/util/build_id.c:42:4: error: unknown type name 'Elf_Nhdr'
+ ElfW(Nhdr) nhdr;
+ ^
+../src/util/build_id.c:38:20: note: expanded from macro 'ElfW'
+#define ElfW(type) Elf_##type
+ ^
+<scratch space>:101:1: note: expanded from here
+Elf_Nhdr
+^
+../src/util/build_id.c:91:33: error: use of undeclared identifier 'Elf_Nhdr'
+ size_t offset = sizeof(ElfW(Nhdr)) +
+ ^
+../src/util/build_id.c:38:20: note: expanded from macro 'ElfW'
+#define ElfW(type) Elf_##type
+ ^
+<scratch space>:102:1: note: expanded from here
+Elf_Nhdr
+^
+
+--- src/util/build_id.c.orig 2020-05-30 21:28:01 UTC
++++ src/util/build_id.c
+@@ -38,6 +38,10 @@
+ #define ElfW(type) Elf_##type
+ #endif
+
++#if defined(__FreeBSD__) && __FreeBSD__ < 12
++typedef Elf_Note Elf_Nhdr;
++#endif
++
+ struct build_id_note {
+ ElfW(Nhdr) nhdr;
+
diff --git a/graphics/mesa-devel/files/patch-i386 b/graphics/mesa-devel/files/patch-i386
new file mode 100644
index 000000000000..eda3c160bcb5
--- /dev/null
+++ b/graphics/mesa-devel/files/patch-i386
@@ -0,0 +1,53 @@
+FreeBSD doesn't ship libatomic for Clang to use, so use __sync* atomics.
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230888
+
+Checking if "GCC atomic builtins" compiles: YES
+Checking if "GCC atomic builtins required -latomic" links: NO
+
+meson.build:1098:4: ERROR: C library 'atomic' not found
+
+ld.lld: error: undefined symbol: __atomic_load_8
+>>> referenced by testfile.c
+>>> /tmp/testfile-055958.o:(main)
+
+ld.lld: error: undefined symbol: __atomic_fetch_add_8
+>>> referenced by testfile.c
+>>> /tmp/testfile-055958.o:(main)
+cc: error: linker command failed with exit code 1 (use -v to see invocation)
+
+--- meson.build.orig 2020-05-30 21:28:01 UTC
++++ meson.build
+@@ -1068,7 +1068,7 @@ endif
+ # Check for GCC style atomics
+ dep_atomic = null_dep
+
+-if cc.compiles('''#include <stdint.h>
++if cc.links('''#include <stdint.h>
+ int main() {
+ struct {
+ uint64_t *v;
+@@ -1079,24 +1079,6 @@ if cc.compiles('''#include <stdint.h>
+ }''',
+ name : 'GCC atomic builtins')
+ pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
+-
+- # Not all atomic calls can be turned into lock-free instructions, in which
+- # GCC will make calls into the libatomic library. Check whether we need to
+- # link with -latomic.
+- #
+- # This can happen for 64-bit atomic operations on 32-bit architectures such
+- # as ARM.
+- if not cc.links('''#include <stdint.h>
+- int main() {
+- struct {
+- uint64_t *v;
+- } x;
+- return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
+- (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
+- }''',
+- name : 'GCC atomic builtins required -latomic')
+- dep_atomic = cc.find_library('atomic')
+- endif
+ endif
+ if not cc.links('''#include <stdint.h>
+ uint64_t v;
diff --git a/graphics/mesa-devel/files/patch-libdrm-2.4.99 b/graphics/mesa-devel/files/patch-libdrm-2.4.99
new file mode 100644
index 000000000000..978f154f6a43
--- /dev/null
+++ b/graphics/mesa-devel/files/patch-libdrm-2.4.99
@@ -0,0 +1,107 @@
+Revert libdrm 2.4.100 dependencies:
+https://gitlab.freedesktop.org/mesa/mesa/commit/9edcce2a32ed
+https://gitlab.freedesktop.org/mesa/mesa/commit/f9fe86e02ada
+
+--- meson.build.orig 2020-05-30 21:28:01 UTC
++++ meson.build
+@@ -1319,7 +1319,7 @@ dep_libdrm_radeon = null_dep
+ dep_libdrm_nouveau = null_dep
+ dep_libdrm_intel = null_dep
+
+-_drm_amdgpu_ver = '2.4.100'
++_drm_amdgpu_ver = '2.4.99'
+ _drm_radeon_ver = '2.4.71'
+ _drm_nouveau_ver = '2.4.66'
+ _drm_intel_ver = '2.4.75'
+--- src/amd/common/ac_gpu_info.c.orig 2020-05-30 21:28:01 UTC
++++ src/amd/common/ac_gpu_info.c
+@@ -516,14 +516,9 @@ bool ac_query_gpu_info(int fd, void *dev_p,
+ }
+ if (info->chip_class >= GFX10) {
+ info->tcc_cache_line_size = 128;
+-
+- if (info->drm_minor >= 35) {
+- info->tcc_harvested = device_info.tcc_disabled_mask != 0;
+- } else {
+- /* This is a hack, but it's all we can do without a kernel upgrade. */
+- info->tcc_harvested =
+- (info->vram_size / info->num_tcc_blocks) != 512*1024*1024;
+- }
++ /* This is a hack, but it's all we can do without a kernel upgrade. */
++ info->tcc_harvested =
++ (info->vram_size / info->num_tcc_blocks) != 512*1024*1024;
+ } else {
+ info->tcc_cache_line_size = 64;
+ }
+--- src/gallium/winsys/amdgpu/drm/amdgpu_cs.c.orig 2020-05-30 21:28:01 UTC
++++ src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+@@ -341,49 +341,32 @@ static enum pipe_reset_status
+ amdgpu_ctx_query_reset_status(struct radeon_winsys_ctx *rwctx)
+ {
+ struct amdgpu_ctx *ctx = (struct amdgpu_ctx*)rwctx;
++ uint32_t result, hangs;
+ int r;
+
+ /* Return a failure due to a GPU hang. */
+- if (ctx->ws->info.drm_minor >= 24) {
+- uint64_t flags;
++ r = amdgpu_cs_query_reset_state(ctx->ctx, &result, &hangs);
++ if (r) {
++ fprintf(stderr, "amdgpu: amdgpu_cs_query_reset_state failed. (%i)\n", r);
++ return PIPE_NO_RESET;
++ }
+
+- r = amdgpu_cs_query_reset_state2(ctx->ctx, &flags);
+- if (r) {
+- fprintf(stderr, "amdgpu: amdgpu_cs_query_reset_state failed. (%i)\n", r);
+- return PIPE_NO_RESET;
++ switch (result) {
++ case AMDGPU_CTX_GUILTY_RESET:
++ return PIPE_GUILTY_CONTEXT_RESET;
++ case AMDGPU_CTX_INNOCENT_RESET:
++ return PIPE_INNOCENT_CONTEXT_RESET;
++ case AMDGPU_CTX_UNKNOWN_RESET:
++ return PIPE_UNKNOWN_CONTEXT_RESET;
++ case AMDGPU_CTX_NO_RESET:
++ default:
++ /* Return a failure due to a rejected command submission. */
++ if (ctx->ws->num_total_rejected_cs > ctx->initial_num_total_rejected_cs) {
++ return ctx->num_rejected_cs ? PIPE_GUILTY_CONTEXT_RESET :
++ PIPE_INNOCENT_CONTEXT_RESET;
+ }
+-
+- if (flags & AMDGPU_CTX_QUERY2_FLAGS_RESET) {
+- if (flags & AMDGPU_CTX_QUERY2_FLAGS_GUILTY)
+- return PIPE_GUILTY_CONTEXT_RESET;
+- else
+- return PIPE_INNOCENT_CONTEXT_RESET;
+- }
+- } else {
+- uint32_t result, hangs;
+-
+- r = amdgpu_cs_query_reset_state(ctx->ctx, &result, &hangs);
+- if (r) {
+- fprintf(stderr, "amdgpu: amdgpu_cs_query_reset_state failed. (%i)\n", r);
+- return PIPE_NO_RESET;
+- }
+-
+- switch (result) {
+- case AMDGPU_CTX_GUILTY_RESET:
+- return PIPE_GUILTY_CONTEXT_RESET;
+- case AMDGPU_CTX_INNOCENT_RESET:
+- return PIPE_INNOCENT_CONTEXT_RESET;
+- case AMDGPU_CTX_UNKNOWN_RESET:
+- return PIPE_UNKNOWN_CONTEXT_RESET;
+- }
++ return PIPE_NO_RESET;
+ }
+-
+- /* Return a failure due to a rejected command submission. */
+- if (ctx->ws->num_total_rejected_cs > ctx->initial_num_total_rejected_cs) {
+- return ctx->num_rejected_cs ? PIPE_GUILTY_CONTEXT_RESET :
+- PIPE_INNOCENT_CONTEXT_RESET;
+- }
+- return PIPE_NO_RESET;
+ }
+
+ /* COMMAND SUBMISSION */
diff --git a/graphics/mesa-devel/files/patch-suffix b/graphics/mesa-devel/files/patch-suffix
new file mode 100644
index 000000000000..61d00a719e70
--- /dev/null
+++ b/graphics/mesa-devel/files/patch-suffix
@@ -0,0 +1,179 @@
+Add library suffix to avoid conflict with mesa-libs + mesa-dri.
+Library selection is handled by libglvnd and/or libmap.conf.
+
+--- meson.build.orig 2020-05-30 21:28:01 UTC
++++ meson.build
+@@ -79,7 +79,7 @@ with_imgui = with_intel_tools or with_vulkan_overlay_l
+
+ dri_drivers_path = get_option('dri-drivers-path')
+ if dri_drivers_path == ''
+- dri_drivers_path = join_paths(get_option('prefix'), get_option('libdir'), 'dri')
++ dri_drivers_path = join_paths(get_option('prefix'), get_option('libdir'), 'dri' + get_option('egl-lib-suffix'))
+ endif
+ dri_search_path = get_option('dri-search-path')
+ if dri_search_path == ''
+@@ -427,9 +427,6 @@ if with_glvnd
+ elif with_glx == 'disabled' and not with_egl
+ error('glvnd requires DRI based GLX and/or EGL')
+ endif
+- if get_option('egl-lib-suffix') != ''
+- error('''EGL lib suffix can't be used with libglvnd''')
+- endif
+ endif
+
+ if with_vulkan_icd_dir == ''
+@@ -491,7 +488,7 @@ if with_gallium_vdpau
+ endif
+ vdpau_drivers_path = get_option('vdpau-libs-path')
+ if vdpau_drivers_path == ''
+- vdpau_drivers_path = join_paths(get_option('libdir'), 'vdpau')
++ vdpau_drivers_path = join_paths(get_option('libdir'), 'vdpau' + get_option('egl-lib-suffix'))
+ endif
+
+ if with_gallium_zink
+@@ -638,7 +635,7 @@ endif
+
+ va_drivers_path = get_option('va-libs-path')
+ if va_drivers_path == ''
+- va_drivers_path = join_paths(get_option('libdir'), 'dri')
++ va_drivers_path = join_paths(get_option('libdir'), 'dri' + get_option('egl-lib-suffix'))
+ endif
+
+ _xa = get_option('gallium-xa')
+--- src/amd/vulkan/meson.build.orig 2020-05-30 21:28:01 UTC
++++ src/amd/vulkan/meson.build
+@@ -158,7 +158,7 @@ if with_platform_android
+ endif
+
+ libvulkan_radeon = shared_library(
+- 'vulkan_radeon',
++ 'vulkan_radeon' + get_option('egl-lib-suffix'),
+ [libradv_files, radv_entrypoints, radv_extensions_c, amd_vk_format_table_c, sha1_h, radv_gfx10_format_table_h],
+ include_directories : [
+ inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_amd, inc_amd_common, inc_amd_common_llvm, inc_compiler, inc_util, inc_vulkan_wsi,
+--- src/egl/main/50_mesa.json.orig 2020-05-30 21:28:01 UTC
++++ src/egl/main/50_mesa.json
+@@ -1,6 +1,6 @@
+ {
+ "file_format_version" : "1.0.0",
+ "ICD" : {
+- "library_path" : "libEGL_mesa.so.0"
++ "library_path" : "libEGL_mesa@0@.so.0".format(get_option('egl-lib-suffix'))
+ }
+ }
+--- src/egl/meson.build.orig 2020-05-30 21:28:01 UTC
++++ src/egl/meson.build
+@@ -147,13 +147,13 @@ if not with_glvnd
+ egl_lib_name = 'EGL' + get_option('egl-lib-suffix')
+ egl_lib_version = '1.0.0'
+ else
+- egl_lib_name = 'EGL_mesa'
++ egl_lib_name = 'EGL_mesa' + get_option('egl-lib-suffix')
+ egl_lib_version = '0.0.0'
+ deps_for_egl += dep_glvnd
+ files_egl += [g_egldispatchstubs_h, g_egldispatchstubs_c]
+ files_egl += files('main/eglglvnd.c', 'main/egldispatchstubs.c')
+ install_data(
+- 'main/50_mesa.json',
++ 'main/50_mesa@0@.json'.format(get_option('egl-lib-suffix')),
+ install_dir : join_paths(get_option('datadir'), 'glvnd', 'egl_vendor.d')
+ )
+ endif
+--- src/gbm/backends/dri/gbm_dri.c.orig 2020-05-30 21:28:01 UTC
++++ src/gbm/backends/dri/gbm_dri.c
+@@ -307,14 +307,6 @@ dri_bind_extensions(struct gbm_dri_device *dri,
+ static const __DRIextension **
+ dri_open_driver(struct gbm_dri_device *dri)
+ {
+- /* Temporarily work around dri driver libs that need symbols in libglapi
+- * but don't automatically link it in.
+- */
+- /* XXX: Library name differs on per platforms basis. Update this as
+- * osx/cygwin/windows/bsd gets support for GBM..
+- */
+- dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL);
+-
+ static const char *search_path_vars[] = {
+ /* Read GBM_DRIVERS_PATH first for compatibility, but LIBGL_DRIVERS_PATH
+ * is recommended over GBM_DRIVERS_PATH.
+--- src/gbm/meson.build.orig 2020-05-30 21:28:01 UTC
++++ src/gbm/meson.build
+@@ -44,7 +44,7 @@ if with_platform_wayland
+ endif
+
+ libgbm = shared_library(
+- 'gbm',
++ 'gbm' + get_option('egl-lib-suffix'),
+ files_gbm,
+ include_directories : incs_gbm,
+ c_args : [c_vis_args, args_gbm],
+--- src/glx/meson.build.orig 2020-05-30 21:28:01 UTC
++++ src/glx/meson.build
+@@ -113,10 +113,10 @@ elif with_dri_platform == 'windows'
+ endif
+
+ if not with_glvnd
+- gl_lib_name = 'GL'
++ gl_lib_name = 'GL' + get_option('egl-lib-suffix')
+ gl_lib_version = '1.2.0'
+ else
+- gl_lib_name = 'GLX_mesa'
++ gl_lib_name = 'GLX_mesa' + get_option('egl-lib-suffix')
+ gl_lib_version = '0.0.0'
+ files_libglx += files(
+ 'g_glxglvnddispatchfuncs.c',
+--- src/intel/vulkan/meson.build.orig 2020-05-30 21:28:01 UTC
++++ src/intel/vulkan/meson.build
+@@ -188,7 +188,7 @@ libanv_common = static_library(
+ )
+
+ libvulkan_intel = shared_library(
+- 'vulkan_intel',
++ 'vulkan_intel' + get_option('egl-lib-suffix'),
+ [files('anv_gem.c'), anv_entrypoints[0], anv_extensions_h],
+ include_directories : [
+ inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_intel, inc_compiler, inc_vulkan_wsi,
+--- src/mapi/es1api/meson.build.orig 2020-05-30 21:28:01 UTC
++++ src/mapi/es1api/meson.build
+@@ -33,7 +33,7 @@ if with_platform_windows
+ endif
+
+ libglesv1_cm = shared_library(
+- 'GLESv1_CM' + get_option('gles-lib-suffix'),
++ 'GLESv1_CM' + get_option('egl-lib-suffix') + get_option('gles-lib-suffix'),
+ ['../entry.c', es1_glapi_mapi_tmp_h],
+ c_args : [
+ c_msvc_compat_args,
+--- src/mapi/es2api/meson.build.orig 2020-05-30 21:28:01 UTC
++++ src/mapi/es2api/meson.build
+@@ -33,7 +33,7 @@ if with_platform_windows
+ endif
+
+ libgles2 = shared_library(
+- 'GLESv2' + get_option('gles-lib-suffix'),
++ 'GLESv2' + get_option('egl-lib-suffix') + get_option('gles-lib-suffix'),
+ ['../entry.c', es2_glapi_mapi_tmp_h],
+ c_args : [
+ c_msvc_compat_args,
+--- src/mapi/shared-glapi/meson.build.orig 2020-05-30 21:28:01 UTC
++++ src/mapi/shared-glapi/meson.build
+@@ -42,7 +42,7 @@ if with_platform_windows
+ endif
+
+ libglapi = shared_library(
+- 'glapi',
++ 'glapi' + get_option('egl-lib-suffix'),
+ [files_mapi_glapi, files_mapi_util, shared_glapi_mapi_tmp_h],
+ c_args : [
+ _glapi_c_args,
+--- src/util/meson.build.orig 2020-05-30 21:28:01 UTC
++++ src/util/meson.build
+@@ -122,7 +122,7 @@ files_mesa_util = files(
+ 'xxhash.h',
+ )
+
+-files_drirc = files('00-mesa-defaults.conf')
++files_drirc = files('00-mesa@0@-defaults.conf'.format(get_option('egl-lib-suffix')))
+
+ install_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d'))
+