pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/graphics/MesaLib Backport patches to handle an API cha...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/95527f6ef628
branches:  trunk
changeset: 360109:95527f6ef628
user:      markd <markd%pkgsrc.org@localhost>
date:      Wed Mar 22 20:22:31 2017 +0000

description:
Backport patches to handle an API change in llvm4. Bump PKGREVISION.

diffstat:

 graphics/MesaLib/Makefile                                                             |    4 +-
 graphics/MesaLib/distinfo                                                             |   12 +-
 graphics/MesaLib/options.mk                                                           |    3 +-
 graphics/MesaLib/patches/patch-src_gallium_auxiliary_draw_draw__llvm.c                |   27 +
 graphics/MesaLib/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c          |  105 +++++
 graphics/MesaLib/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h          |   44 ++
 graphics/MesaLib/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c   |   24 +
 graphics/MesaLib/patches/patch-src_gallium_drivers_llvmpipe_lp__state__fs.c           |   16 +
 graphics/MesaLib/patches/patch-src_gallium_drivers_llvmpipe_lp__state__setup.c        |   17 +
 graphics/MesaLib/patches/patch-src_gallium_drivers_r600_r600__llvm.c                  |   71 +++
 graphics/MesaLib/patches/patch-src_gallium_drivers_radeon_radeon__llvm__util.c        |   27 +
 graphics/MesaLib/patches/patch-src_gallium_drivers_radeon_radeon__setup__tgsi__llvm.c |   66 +++
 graphics/MesaLib/patches/patch-src_gallium_drivers_radeonsi_si__shader.c              |  204 ++++++++++
 13 files changed, 616 insertions(+), 4 deletions(-)

diffs (truncated from 705 to 300 lines):

diff -r eec9ca6c18d5 -r 95527f6ef628 graphics/MesaLib/Makefile
--- a/graphics/MesaLib/Makefile Wed Mar 22 12:27:31 2017 +0000
+++ b/graphics/MesaLib/Makefile Wed Mar 22 20:22:31 2017 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.136 2017/03/20 23:59:01 gdt Exp $
+# $NetBSD: Makefile,v 1.137 2017/03/22 20:22:31 markd Exp $
 
 DISTNAME=      mesa-11.2.2
 PKGNAME=       ${DISTNAME:S/mesa/MesaLib/}
-PKGREVISION=   4
+PKGREVISION=   5
 CATEGORIES=    graphics x11
 MASTER_SITES=  ftp://ftp.freedesktop.org/pub/mesa/${PKGVERSION_NOREV}/
 EXTRACT_SUFX=  .tar.xz
diff -r eec9ca6c18d5 -r 95527f6ef628 graphics/MesaLib/distinfo
--- a/graphics/MesaLib/distinfo Wed Mar 22 12:27:31 2017 +0000
+++ b/graphics/MesaLib/distinfo Wed Mar 22 20:22:31 2017 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.119 2017/01/15 00:14:21 wiz Exp $
+$NetBSD: distinfo,v 1.120 2017/03/22 20:22:31 markd Exp $
 
 SHA1 (mesa-11.2.2.tar.xz) = c3805020be6fef77d3b96a5ddf4ddc256dee16ff
 RMD160 (mesa-11.2.2.tar.xz) = 14bca7cc76015e53db2fafcebb8540f451be5aab
@@ -11,13 +11,23 @@
 SHA1 (patch-src_egl_drivers_dri2_platform__drm.c) = 99b6dd6739c29551ae2c885eabd7babd159fc3e5
 SHA1 (patch-src_egl_drivers_dri2_platform__x11.c) = 04b6ef8e755f226fbe3e6f2bea6c9e2a56a783ca
 SHA1 (patch-src_egl_main_eglglobals.c) = 2d81ae27f09162d23bc684456cc5fef48c042652
+SHA1 (patch-src_gallium_auxiliary_draw_draw__llvm.c) = fc1a313eed85042b7ac2db67c6fd1902074fb43a
+SHA1 (patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c) = 4c40981645675cfeb55bf28317158ebb6332268d
+SHA1 (patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h) = 07f2606d94b9af30df838206841cbcd8a198d799
+SHA1 (patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c) = e94692f8dbae1247e5780cebf24e4a333b1fcd0a
 SHA1 (patch-src_gallium_auxiliary_util_u__format__tests.c) = 4d5e4677c2825778c43440ab131b8807f6840975
 SHA1 (patch-src_gallium_auxiliary_util_u__math.h) = 812e4a5291aea47e06505f09891e0434c4d9c34d
 SHA1 (patch-src_gallium_auxiliary_util_u__network.c) = 283f505af780071dc9fd7914f8065e3fb7d8a4fd
 SHA1 (patch-src_gallium_auxiliary_util_u__network.h) = c6106d67b4fa9db0d790474182d6e0ce0c5da677
+SHA1 (patch-src_gallium_drivers_llvmpipe_lp__state__fs.c) = b14ca18ae1dc03901b197c86e67052bbb154a81f
+SHA1 (patch-src_gallium_drivers_llvmpipe_lp__state__setup.c) = 1d6c24bc598da9945ce75c1cc6a2334228d66b41
 SHA1 (patch-src_gallium_drivers_nouveau_codegen_nv50__ir__peephole.cpp) = 5fc2ef7eafac3006896af96bac8176c79b17cfdc
 SHA1 (patch-src_gallium_drivers_nouveau_nouveau__vp3__video.c) = ae1b6eb4df3e4db0f37e44118cdf69b16f3c471e
 SHA1 (patch-src_gallium_drivers_nouveau_nv50_nv84__video.c) = 1b4239fe053523835ecac006894bdb0cde0ee626
+SHA1 (patch-src_gallium_drivers_r600_r600__llvm.c) = 37ffa4df519df4b7a35b686448e823200d5144ae
+SHA1 (patch-src_gallium_drivers_radeon_radeon__llvm__util.c) = 63852f9abaa4d75d0043ae748bba718a35459a11
+SHA1 (patch-src_gallium_drivers_radeon_radeon__setup__tgsi__llvm.c) = 7957999b555c9c2e68a1d9b2eece5989e6612ff3
+SHA1 (patch-src_gallium_drivers_radeonsi_si__shader.c) = 44b790ee0d8b843421114b61ddae6a4d4ef2a099
 SHA1 (patch-src_gallium_targets_dri_Makefile.in) = a9a8265d97297040a3e3260b362ca920ec852280
 SHA1 (patch-src_gallium_winsys_radeon_drm_radeon__drm__winsys.c) = 2358b7d5ea89e28cb3ac07a408b18e8bf55e057a
 SHA1 (patch-src_gallium_winsys_svga_drm_vmw__screen.c) = 4b2ae565377b1a0396c8bf6b2663c261592b8e5e
diff -r eec9ca6c18d5 -r 95527f6ef628 graphics/MesaLib/options.mk
--- a/graphics/MesaLib/options.mk       Wed Mar 22 12:27:31 2017 +0000
+++ b/graphics/MesaLib/options.mk       Wed Mar 22 20:22:31 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: options.mk,v 1.54 2017/03/20 23:59:01 gdt Exp $
+# $NetBSD: options.mk,v 1.55 2017/03/22 20:22:31 markd Exp $
 
 PKG_OPTIONS_VAR=               PKG_OPTIONS.MesaLib
 PKG_SUPPORTED_OPTIONS=         llvm dri
@@ -178,6 +178,7 @@
 CONFIGURE_ARGS+=       --enable-r600-llvm-compiler
 .include "../../devel/libelf/buildlink3.mk"
 CPPFLAGS+=             -I${BUILDLINK_PREFIX.libelf}/include/libelf
+BUILDLINK_API_DEPENDS.libLLVM+= libLLVM>=4.0
 .include "../../lang/libLLVM/buildlink3.mk"
 CONFIGURE_ENV+=                ac_cv_path_ac_pt_LLVM_CONFIG=${LLVM_CONFIG_PATH}
 .else # !llvm
diff -r eec9ca6c18d5 -r 95527f6ef628 graphics/MesaLib/patches/patch-src_gallium_auxiliary_draw_draw__llvm.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_gallium_auxiliary_draw_draw__llvm.c    Wed Mar 22 20:22:31 2017 +0000
@@ -0,0 +1,27 @@
+$NetBSD: patch-src_gallium_auxiliary_draw_draw__llvm.c,v 1.1 2017/03/22 20:22:31 markd Exp $
+
+llvm api change
+commit  8bdd52c8f3595128cbc1da4f23cdb10ff861a6ef
+
+--- src/gallium/auxiliary/draw/draw_llvm.c.orig        2016-05-09 12:51:42.000000000 +0000
++++ src/gallium/auxiliary/draw/draw_llvm.c
+@@ -1612,8 +1612,7 @@ draw_llvm_generate(struct draw_llvm *llv
+    LLVMSetFunctionCallConv(variant_func, LLVMCCallConv);
+    for (i = 0; i < num_arg_types; ++i)
+       if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
+-         LLVMAddAttribute(LLVMGetParam(variant_func, i),
+-                          LLVMNoAliasAttribute);
++         lp_add_function_attr(variant_func, i + 1, LP_FUNC_ATTR_NOALIAS);
+ 
+    context_ptr               = LLVMGetParam(variant_func, 0);
+    io_ptr                    = LLVMGetParam(variant_func, 1);
+@@ -2158,8 +2157,7 @@ draw_gs_llvm_generate(struct draw_llvm *
+ 
+    for (i = 0; i < Elements(arg_types); ++i)
+       if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
+-         LLVMAddAttribute(LLVMGetParam(variant_func, i),
+-                          LLVMNoAliasAttribute);
++         lp_add_function_attr(variant_func, i + 1, LP_FUNC_ATTR_NOALIAS);
+ 
+    context_ptr               = LLVMGetParam(variant_func, 0);
+    input_array               = LLVMGetParam(variant_func, 1);
diff -r eec9ca6c18d5 -r 95527f6ef628 graphics/MesaLib/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c      Wed Mar 22 20:22:31 2017 +0000
@@ -0,0 +1,105 @@
+$NetBSD: patch-src_gallium_auxiliary_gallivm_lp__bld__intr.c,v 1.1 2017/03/22 20:22:31 markd Exp $
+
+llvm api change
+commit  8bdd52c8f3595128cbc1da4f23cdb10ff861a6ef
+
+--- src/gallium/auxiliary/gallivm/lp_bld_intr.c.orig   2016-05-09 12:20:52.000000000 +0000
++++ src/gallium/auxiliary/gallivm/lp_bld_intr.c
+@@ -45,6 +45,7 @@
+ 
+ 
+ #include "util/u_debug.h"
++#include "util/u_math.h"
+ 
+ #include "lp_bld_const.h"
+ #include "lp_bld_intr.h"
+@@ -75,6 +76,65 @@ lp_declare_intrinsic(LLVMModuleRef modul
+    return function;
+ }
+ 
++#if HAVE_LLVM < 0x0400
++static LLVMAttribute lp_attr_to_llvm_attr(enum lp_func_attr attr)
++{
++   switch (attr) {
++   case LP_FUNC_ATTR_ALWAYSINLINE: return LLVMAlwaysInlineAttribute;
++   case LP_FUNC_ATTR_BYVAL: return LLVMByValAttribute;
++   case LP_FUNC_ATTR_INREG: return LLVMInRegAttribute;
++   case LP_FUNC_ATTR_NOALIAS: return LLVMNoAliasAttribute;
++   case LP_FUNC_ATTR_NOUNWIND: return LLVMNoUnwindAttribute;
++   case LP_FUNC_ATTR_READNONE: return LLVMReadNoneAttribute;
++   case LP_FUNC_ATTR_READONLY: return LLVMReadOnlyAttribute;
++   default:
++      _debug_printf("Unhandled function attribute: %x\n", attr);
++      return 0;
++   }
++}
++
++#else
++
++static const char *attr_to_str(enum lp_func_attr attr)
++{
++   switch (attr) {
++   case LP_FUNC_ATTR_ALWAYSINLINE: return "alwaysinline";
++   case LP_FUNC_ATTR_BYVAL: return "byval";
++   case LP_FUNC_ATTR_INREG: return "inreg";
++   case LP_FUNC_ATTR_NOALIAS: return "noalias";
++   case LP_FUNC_ATTR_NOUNWIND: return "nounwind";
++   case LP_FUNC_ATTR_READNONE: return "readnone";
++   case LP_FUNC_ATTR_READONLY: return "readonly";
++   default:
++      _debug_printf("Unhandled function attribute: %x\n", attr);
++      return 0;
++   }
++}
++
++#endif
++
++void
++lp_add_function_attr(LLVMValueRef function,
++                     int attr_idx,
++                     enum lp_func_attr attr)
++{
++
++#if HAVE_LLVM < 0x0400
++   LLVMAttribute llvm_attr = lp_attr_to_llvm_attr(attr);
++   if (attr_idx == -1) {
++      LLVMAddFunctionAttr(function, llvm_attr);
++   } else {
++      LLVMAddAttribute(LLVMGetParam(function, attr_idx - 1), llvm_attr);
++   }
++#else
++   LLVMContextRef context = LLVMGetModuleContext(LLVMGetGlobalParent(function));
++   const char *attr_name = attr_to_str(attr);
++   unsigned kind_id = LLVMGetEnumAttributeKindForName(attr_name,
++                                                      strlen(attr_name));
++   LLVMAttributeRef llvm_attr = LLVMCreateEnumAttribute(context, kind_id, 0);
++   LLVMAddAttributeAtIndex(function, attr_idx, llvm_attr);
++#endif
++}
+ 
+ LLVMValueRef
+ lp_build_intrinsic(LLVMBuilderRef builder,
+@@ -82,7 +142,7 @@ lp_build_intrinsic(LLVMBuilderRef builde
+                    LLVMTypeRef ret_type,
+                    LLVMValueRef *args,
+                    unsigned num_args,
+-                   LLVMAttribute attr)
++                   unsigned attr_mask)
+ {
+    LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(LLVMGetInsertBlock(builder)));
+    LLVMValueRef function;
+@@ -101,8 +161,12 @@ lp_build_intrinsic(LLVMBuilderRef builde
+ 
+       function = lp_declare_intrinsic(module, name, ret_type, arg_types, num_args);
+ 
+-      if (attr)
+-          LLVMAddFunctionAttr(function, attr);
++      attr_mask |= LP_FUNC_ATTR_NOUNWIND;
++
++      while (attr_mask) {
++         enum lp_func_attr attr = 1 << u_bit_scan(&attr_mask);
++         lp_add_function_attr(function, -1, attr);
++      }
+    }
+ 
+    return LLVMBuildCall(builder, function, args, num_args, "");
diff -r eec9ca6c18d5 -r 95527f6ef628 graphics/MesaLib/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h      Wed Mar 22 20:22:31 2017 +0000
@@ -0,0 +1,44 @@
+$NetBSD: patch-src_gallium_auxiliary_gallivm_lp__bld__intr.h,v 1.1 2017/03/22 20:22:31 markd Exp $
+
+llvm api change
+commit  8bdd52c8f3595128cbc1da4f23cdb10ff861a6ef
+
+--- src/gallium/auxiliary/gallivm/lp_bld_intr.h.orig   2016-05-09 12:20:52.000000000 +0000
++++ src/gallium/auxiliary/gallivm/lp_bld_intr.h
+@@ -46,6 +46,16 @@
+  */
+ #define LP_MAX_FUNC_ARGS 32
+ 
++enum lp_func_attr {
++   LP_FUNC_ATTR_ALWAYSINLINE = (1 << 0),
++   LP_FUNC_ATTR_BYVAL        = (1 << 1),
++   LP_FUNC_ATTR_INREG        = (1 << 2),
++   LP_FUNC_ATTR_NOALIAS      = (1 << 3),
++   LP_FUNC_ATTR_NOUNWIND     = (1 << 4),
++   LP_FUNC_ATTR_READNONE     = (1 << 5),
++   LP_FUNC_ATTR_READONLY     = (1 << 6),
++   LP_FUNC_ATTR_LAST         = (1 << 7)
++};
+ 
+ LLVMValueRef
+ lp_declare_intrinsic(LLVMModuleRef module,
+@@ -54,13 +64,18 @@ lp_declare_intrinsic(LLVMModuleRef modul
+                      LLVMTypeRef *arg_types,
+                      unsigned num_args);
+ 
++void
++lp_add_function_attr(LLVMValueRef function,
++                     int attr_idx,
++                     enum lp_func_attr attr);
++
+ LLVMValueRef
+ lp_build_intrinsic(LLVMBuilderRef builder,
+                    const char *name,
+                    LLVMTypeRef ret_type,
+                    LLVMValueRef *args,
+                    unsigned num_args,
+-                   LLVMAttribute attr);
++                   unsigned attr_mask);
+ 
+ 
+ LLVMValueRef
diff -r eec9ca6c18d5 -r 95527f6ef628 graphics/MesaLib/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c       Wed Mar 22 20:22:31 2017 +0000
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_gallium_auxiliary_gallivm_lp__bld__sample__soa.c,v 1.1 2017/03/22 20:22:31 markd Exp $
+
+llvm api change
+commit  8bdd52c8f3595128cbc1da4f23cdb10ff861a6ef
+
+--- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c.orig     2016-05-09 12:20:52.000000000 +0000
++++ src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+@@ -60,6 +60,7 @@
+ #include "lp_bld_struct.h"
+ #include "lp_bld_quad.h"
+ #include "lp_bld_pack.h"
++#include "lp_bld_intr.h"
+ 
+ 
+ /**
+@@ -3315,7 +3316,7 @@ lp_build_sample_soa_func(struct gallivm_
+ 
+       for (i = 0; i < num_param; ++i) {
+          if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind) {
+-            LLVMAddAttribute(LLVMGetParam(function, i), LLVMNoAliasAttribute);
++            lp_add_function_attr(function, i + 1, LP_FUNC_ATTR_NOALIAS);
+          }
+       }
+ 
diff -r eec9ca6c18d5 -r 95527f6ef628 graphics/MesaLib/patches/patch-src_gallium_drivers_llvmpipe_lp__state__fs.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/MesaLib/patches/patch-src_gallium_drivers_llvmpipe_lp__state__fs.c       Wed Mar 22 20:22:31 2017 +0000
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_gallium_drivers_llvmpipe_lp__state__fs.c,v 1.1 2017/03/22 20:22:31 markd Exp $
+
+llvm api change
+commit  14926330703bb5ea6a84c845e192021f057f9401
+
+--- src/gallium/drivers/llvmpipe/lp_state_fs.c.orig    2016-05-09 12:51:42.000000000 +0000
++++ src/gallium/drivers/llvmpipe/lp_state_fs.c
+@@ -2279,7 +2279,7 @@ generate_fragment(struct llvmpipe_contex
+     */
+    for(i = 0; i < Elements(arg_types); ++i)
+       if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
+-         LLVMAddAttribute(LLVMGetParam(function, i), LLVMNoAliasAttribute);
++         lp_add_function_attr(function, i + 1, LP_FUNC_ATTR_NOALIAS);
+ 
+    context_ptr  = LLVMGetParam(function, 0);
+    x            = LLVMGetParam(function, 1);



Home | Main Index | Thread Index | Old Index