amdgpu-pro: 17.10 -> 17.40

+171 -164
+15 -1
nixos/modules/hardware/video/amdgpu-pro.nix
··· 15 15 16 16 opengl = config.hardware.opengl; 17 17 18 + kernel = pkgs.linux_4_9.override { 19 + extraConfig = '' 20 + KALLSYMS_ALL y 21 + ''; 22 + }; 23 + 18 24 in 19 25 20 26 { 21 27 22 28 config = mkIf enabled { 23 29 24 - nixpkgs.config.xorg.abiCompat = "1.18"; 30 + nixpkgs.config.xorg.abiCompat = "1.19"; 25 31 26 32 services.xserver.drivers = singleton 27 33 { name = "amdgpu"; modules = [ package ]; libPath = [ package ]; }; ··· 31 37 32 38 boot.extraModulePackages = [ package ]; 33 39 40 + boot.kernelPackages = 41 + pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor kernel); 42 + 34 43 boot.blacklistedKernelModules = [ "radeon" ]; 35 44 36 45 hardware.firmware = [ package ]; ··· 38 47 system.activationScripts.setup-amdgpu-pro = '' 39 48 mkdir -p /run/lib 40 49 ln -sfn ${package}/lib ${package.libCompatDir} 50 + ln -sfn ${package} /run/amdgpu-pro 41 51 '' + optionalString opengl.driSupport32Bit '' 42 52 ln -sfn ${package32}/lib ${package32.libCompatDir} 43 53 ''; 54 + 55 + system.requiredKernelConfig = with config.lib.kernelConfig; [ 56 + (isYes "KALLSYMS_ALL") 57 + ]; 44 58 45 59 environment.etc = { 46 60 "amd/amdrc".source = package + "/etc/amd/amdrc";
+30 -17
pkgs/os-specific/linux/amdgpu-pro/default.nix
··· 30 30 31 31 in stdenv.mkDerivation rec { 32 32 33 - version = "17.10"; 33 + version = "17.40"; 34 34 pname = "amdgpu-pro"; 35 - build = "${version}-401251"; 35 + build = "${version}-492261"; 36 36 37 37 libCompatDir = "/run/lib/${libArch}"; 38 38 ··· 41 41 src = fetchurl { 42 42 url = 43 43 "https://www2.ati.com/drivers/linux/ubuntu/amdgpu-pro-${build}.tar.xz"; 44 - sha256 = "004n0df8acjpjz72z3bjxb2a0b7qwln13jlknfn7xxqvhhwwy40a"; 44 + sha256 = "1c073lp9cq1rc2mddky2r0j2dv9dd167qj02visz37vwaxbm2r5h"; 45 45 curlOpts = "--referer http://support.amd.com/en-us/kb-articles/Pages/AMD-Radeon-GPU-PRO-Linux-Beta-Driver%e2%80%93Release-Notes.aspx"; 46 46 }; 47 47 ··· 57 57 sourceRoot=. 58 58 ''; 59 59 60 - modulePatches = [ 61 - ./patches/0001-disable-firmware-copy.patch 62 - ./patches/0002-linux-4.9-fixes.patch 63 - ./patches/0003-Change-seq_printf-format-for-64-bit-context.patch 64 - ./patches/0004-fix-warnings-for-Werror.patch 65 - ]; 60 + modulePatches = optionals (!libsOnly) ([ 61 + ./patches/0001-fix-warnings-for-Werror.patch 62 + ./patches/0002-fix-sketchy-int-ptr-warning.patch 63 + ./patches/0003-disable-firmware-copy.patch 64 + ]); 66 65 67 66 patchPhase = optionalString (!libsOnly) '' 68 - pushd usr/src/amdgpu-pro-${build} 67 + pushd usr/src/amdgpu-${build} 69 68 for patch in $modulePatches 70 69 do 71 70 echo $patch ··· 73 72 done 74 73 popd 75 74 ''; 75 + 76 + xreallocarray = ./xreallocarray.c; 76 77 77 78 preBuild = optionalString (!libsOnly) '' 78 - pushd usr/src/amdgpu-pro-${build} 79 + pushd usr/src/amdgpu-${build} 79 80 makeFlags="$makeFlags M=$(pwd)" 80 81 patchShebangs pre-build.sh 81 82 ./pre-build.sh ${kernel.version} 82 83 popd 84 + pushd lib 85 + $CC -fPIC -shared -o libhack-xreallocarray.so $xreallocarray 86 + strip libhack-xreallocarray.so 87 + popd 83 88 ''; 84 89 85 90 modules = [ ··· 89 94 ]; 90 95 91 96 postBuild = optionalString (!libsOnly) 92 - (concatMapStrings (m: "xz usr/src/amdgpu-pro-${build}/${m}\n") modules); 97 + (concatMapStrings (m: "xz usr/src/amdgpu-${build}/${m}\n") modules); 93 98 94 99 NIX_CFLAGS_COMPILE = "-Werror"; 95 100 ··· 110 115 pushd usr 111 116 cp -r lib/${libArch}/* $out/lib 112 117 '' + optionalString (!libsOnly) '' 113 - cp -r src/amdgpu-pro-${build}/firmware $out/lib/firmware 118 + cp -r src/amdgpu-${build}/firmware $out/lib/firmware 114 119 '' + '' 115 120 cp -r share $out/share 116 121 popd 117 122 118 123 pushd opt/amdgpu-pro 119 - '' + optionalString (!stdenv.is64bit) '' 124 + '' + optionalString (!libsOnly && stdenv.is64bit) '' 120 125 cp -r bin $out/bin 121 126 '' + '' 122 127 cp -r include $out/include 128 + cp -r share/* $out/share 123 129 cp -r lib/${libArch}/* $out/lib 124 130 '' + optionalString (!libsOnly) '' 125 131 mv lib/xorg $out/lib/xorg ··· 128 134 129 135 '' + optionalString (!libsOnly) 130 136 (concatMapStrings (m: 131 - "install -Dm444 usr/src/amdgpu-pro-${build}/${m}.xz $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/${m}.xz\n") modules) 137 + "install -Dm444 usr/src/amdgpu-${build}/${m}.xz $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/${m}.xz\n") modules) 132 138 + '' 133 139 mv $out/etc/vulkan $out/share 134 140 interpreter="$(cat $NIX_CC/nix-support/dynamic-linker)" 135 141 libPath="$out/lib:$out/lib/gbm:$depLibPath" 136 - '' + optionalString (!stdenv.is64bit) '' 142 + '' + optionalString (!libsOnly && stdenv.is64bit) '' 137 143 for prog in clinfo modetest vbltest kms-universal-planes kms-steal-crtc modeprint amdgpu_test kmstest proptest; do 138 144 patchelf --interpreter "$interpreter" --set-rpath "$libPath" "$out/bin/$prog" 139 145 done ··· 147 153 for lib in `find "$out/lib/" -name '*.so*' -type f`; do 148 154 patchelf --set-rpath "$libPath" "$lib" 149 155 done 150 - for lib in libEGL.so.1 libGL.so.1.2 ${optionalString (!libsOnly) "xorg/modules/extensions/libglx.so"} dri/amdgpu_dri.so; do 156 + for lib in libEGL.so.1 libGL.so.1.2 ${optionalString (!libsOnly) "xorg/modules/extensions/libglx.so"} dri/amdgpu_dri.so libamdocl${bitness}.so; do 151 157 perl -pi -e 's:${libReplaceDir}:${libCompatDir}:g' "$out/lib/$lib" 158 + done 159 + for lib in dri/amdgpu_dri.so libdrm_amdgpu.so.1.0.0 libgbm_amdgpu.so.1.0.0 libkms_amdgpu.so.1.0.0 libamdocl${bitness}.so; do 160 + perl -pi -e 's:/opt/amdgpu-pro/:/run/amdgpu-pro/:g' "$out/lib/$lib" 152 161 done 153 162 substituteInPlace "$out/share/vulkan/icd.d/amd_icd${bitness}.json" --replace "/opt/amdgpu-pro/lib/${libArch}" "$out/lib" 163 + '' + optionalString (!libsOnly) '' 164 + for lib in drivers/modesetting_drv.so libglamoregl.so; do 165 + patchelf --add-needed $out/lib/libhack-xreallocarray.so $out/lib/xorg/modules/$lib 166 + done 154 167 ''; 155 168 156 169 buildInputs = [
-25
pkgs/os-specific/linux/amdgpu-pro/patches/0001-disable-firmware-copy.patch
··· 1 - From 704cef8638ffbdd8de9e57f28b43ea42c685ea87 Mon Sep 17 00:00:00 2001 2 - From: David McFarland <corngood@gmail.com> 3 - Date: Sat, 28 Jan 2017 16:57:26 -0400 4 - Subject: [PATCH 1/4] disable firmware copy 5 - 6 - --- 7 - pre-build.sh | 5 ----- 8 - 1 file changed, 5 deletions(-) 9 - 10 - diff --git a/pre-build.sh b/pre-build.sh 11 - index 622ff13..e3cd009 100755 12 - --- a/pre-build.sh 13 - +++ b/pre-build.sh 14 - @@ -35,8 +35,3 @@ find ttm -name '*.c' -exec grep EXPORT_SYMBOL {} + \ 15 - | sort -u \ 16 - | awk -F'[()]' '{print "#define "$2" amd"$2" //"$0}'\ 17 - > include/rename_symbol.h 18 - - 19 - -FW_DIR="/lib/firmware/$KERNELVER" 20 - -mkdir -p $FW_DIR 21 - -cp -ar /usr/src/amdgpu-pro-17.10-401251/firmware/radeon $FW_DIR 22 - -cp -ar /usr/src/amdgpu-pro-17.10-401251/firmware/amdgpu $FW_DIR 23 - -- 24 - 2.12.2 25 -
+71
pkgs/os-specific/linux/amdgpu-pro/patches/0001-fix-warnings-for-Werror.patch
··· 1 + From 9167d76c435a7c1df7954f0fbe5cc6d083f8ed2f Mon Sep 17 00:00:00 2001 2 + From: David McFarland <corngood@gmail.com> 3 + Date: Mon, 6 Feb 2017 22:13:49 -0400 4 + Subject: [PATCH 1/3] fix warnings for Werror 5 + 6 + --- 7 + amd/amdgpu/amdgpu_device.c | 4 ++-- 8 + amd/amdgpu/amdgpu_sa.c | 2 +- 9 + amd/display/dc/bios/bios_parser2.c | 8 ++++---- 10 + 3 files changed, 7 insertions(+), 7 deletions(-) 11 + 12 + diff --git a/amd/amdgpu/amdgpu_device.c b/amd/amdgpu/amdgpu_device.c 13 + index fc1c543..186e06d 100644 14 + --- a/amd/amdgpu/amdgpu_device.c 15 + +++ b/amd/amdgpu/amdgpu_device.c 16 + @@ -3164,7 +3164,7 @@ void amdgpu_debugfs_cleanup(struct drm_minor *minor) 17 + struct drm_info_node *node, *tmp; 18 + 19 + if (!&minor->debugfs_root) 20 + - return 0; 21 + + return; 22 + 23 + mutex_lock(&minor->debugfs_lock); 24 + list_for_each_entry_safe(node, tmp, 25 + @@ -3175,7 +3175,7 @@ void amdgpu_debugfs_cleanup(struct drm_minor *minor) 26 + } 27 + mutex_unlock(&minor->debugfs_lock); 28 + 29 + - return 0; 30 + + return; 31 + } 32 + #endif 33 + 34 + diff --git a/amd/amdgpu/amdgpu_sa.c b/amd/amdgpu/amdgpu_sa.c 35 + index 7206b34..8b7123c 100644 36 + --- a/amd/amdgpu/amdgpu_sa.c 37 + +++ b/amd/amdgpu/amdgpu_sa.c 38 + @@ -430,7 +430,7 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager, 39 + if (i->fence) 40 + #if defined(BUILD_AS_DKMS) 41 + seq_printf(m, " protected by 0x%08x on context %d", 42 + - i->fence->seqno, i->fence->context); 43 + + i->fence->seqno, (int)i->fence->context); 44 + #else 45 + seq_printf(m, " protected by 0x%08x on context %llu", 46 + i->fence->seqno, i->fence->context); 47 + diff --git a/amd/display/dc/bios/bios_parser2.c b/amd/display/dc/bios/bios_parser2.c 48 + index 86fce5a..99681c5 100644 49 + --- a/amd/display/dc/bios/bios_parser2.c 50 + +++ b/amd/display/dc/bios/bios_parser2.c 51 + @@ -1326,13 +1326,13 @@ static enum bp_result get_embedded_panel_info_v2_1( 52 + info->lcd_timing.misc_info.VERTICAL_CUT_OFF = 0; 53 + 54 + info->lcd_timing.misc_info.H_REPLICATION_BY2 = 55 + - lvds->lcd_timing.miscinfo & ATOM_H_REPLICATIONBY2; 56 + + (lvds->lcd_timing.miscinfo & ATOM_H_REPLICATIONBY2) != 0; 57 + info->lcd_timing.misc_info.V_REPLICATION_BY2 = 58 + - lvds->lcd_timing.miscinfo & ATOM_V_REPLICATIONBY2; 59 + + (lvds->lcd_timing.miscinfo & ATOM_V_REPLICATIONBY2) != 0; 60 + info->lcd_timing.misc_info.COMPOSITE_SYNC = 61 + - lvds->lcd_timing.miscinfo & ATOM_COMPOSITESYNC; 62 + + (lvds->lcd_timing.miscinfo & ATOM_COMPOSITESYNC) != 0; 63 + info->lcd_timing.misc_info.INTERLACE = 64 + - lvds->lcd_timing.miscinfo & ATOM_INTERLACE; 65 + + (lvds->lcd_timing.miscinfo & ATOM_INTERLACE) != 0; 66 + 67 + /* not provided by VBIOS*/ 68 + info->lcd_timing.misc_info.DOUBLE_CLOCK = 0; 69 + -- 70 + 2.15.1 71 +
+25
pkgs/os-specific/linux/amdgpu-pro/patches/0002-fix-sketchy-int-ptr-warning.patch
··· 1 + From a07ee5dec35ca24a013a6638543ef5030b2bab40 Mon Sep 17 00:00:00 2001 2 + From: David McFarland <corngood@gmail.com> 3 + Date: Tue, 9 Jan 2018 21:45:33 -0400 4 + Subject: [PATCH 2/3] fix sketchy int->ptr warning 5 + 6 + --- 7 + amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +- 8 + 1 file changed, 1 insertion(+), 1 deletion(-) 9 + 10 + diff --git a/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/amd/display/amdgpu_dm/amdgpu_dm_helpers.c 11 + index d0f091b..707815a 100644 12 + --- a/amd/display/amdgpu_dm/amdgpu_dm_helpers.c 13 + +++ b/amd/display/amdgpu_dm/amdgpu_dm_helpers.c 14 + @@ -236,7 +236,7 @@ bool dm_helpers_dp_mst_write_payload_allocation_table( 15 + pbn = drm_dp_calc_pbn_mode(clock, bpp); 16 + 17 + slots = drm_dp_find_vcpi_slots(mst_mgr, pbn); 18 + - ret = drm_dp_mst_allocate_vcpi(mst_mgr, mst_port, pbn, slots); 19 + + ret = drm_dp_mst_allocate_vcpi(mst_mgr, mst_port, pbn, &slots); 20 + 21 + if (!ret) 22 + return false; 23 + -- 24 + 2.15.1 25 +
-50
pkgs/os-specific/linux/amdgpu-pro/patches/0002-linux-4.9-fixes.patch
··· 1 - From 0ead7017e1db18be971c24c891d4bdcc507deea7 Mon Sep 17 00:00:00 2001 2 - From: David McFarland <corngood@gmail.com> 3 - Date: Sun, 29 Jan 2017 18:23:47 -0400 4 - Subject: [PATCH 2/4] linux-4.9 fixes 5 - 6 - --- 7 - amd/amdkcl/kcl_io.c | 2 ++ 8 - amd/display/amdgpu_dm/amdgpu_dm_types.c | 8 ++++++++ 9 - 2 files changed, 10 insertions(+) 10 - 11 - diff --git a/amd/amdkcl/kcl_io.c b/amd/amdkcl/kcl_io.c 12 - index d8f843f..9a1bd9b 100644 13 - --- a/amd/amdkcl/kcl_io.c 14 - +++ b/amd/amdkcl/kcl_io.c 15 - @@ -31,4 +31,6 @@ void amdkcl_io_init(void) 16 - _kcl_io_free_memtype = amdkcl_fp_setup("io_free_memtype", NULL); 17 - } 18 - #endif 19 - +#else 20 - +void amdkcl_io_init(void) {} 21 - #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) */ 22 - diff --git a/amd/display/amdgpu_dm/amdgpu_dm_types.c b/amd/display/amdgpu_dm/amdgpu_dm_types.c 23 - index 34313a9..44a4a71 100644 24 - --- a/amd/display/amdgpu_dm/amdgpu_dm_types.c 25 - +++ b/amd/display/amdgpu_dm/amdgpu_dm_types.c 26 - @@ -1720,6 +1720,10 @@ static int dm_plane_helper_prepare_fb( 27 - static int dm_plane_helper_prepare_fb( 28 - struct drm_plane *plane, 29 - const struct drm_plane_state *new_state) 30 - +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) 31 - +static int dm_plane_helper_prepare_fb( 32 - + struct drm_plane *plane, 33 - + struct drm_plane_state *new_state) 34 - #else 35 - static int dm_plane_helper_prepare_fb( 36 - struct drm_plane *plane, 37 - @@ -1766,6 +1770,10 @@ static void dm_plane_helper_cleanup_fb( 38 - static void dm_plane_helper_cleanup_fb( 39 - struct drm_plane *plane, 40 - const struct drm_plane_state *old_state) 41 - +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) 42 - +static void dm_plane_helper_cleanup_fb( 43 - + struct drm_plane *plane, 44 - + struct drm_plane_state *old_state) 45 - #else 46 - static void dm_plane_helper_cleanup_fb( 47 - struct drm_plane *plane, 48 - -- 49 - 2.12.2 50 -
-25
pkgs/os-specific/linux/amdgpu-pro/patches/0003-Change-seq_printf-format-for-64-bit-context.patch
··· 1 - From b6dd36dd90c5d88ae10b9dbc763d3bacb95ccddb Mon Sep 17 00:00:00 2001 2 - From: "Luke A. Guest" <laguest@archeia.com> 3 - Date: Sun, 25 Sep 2016 16:46:39 +0100 4 - Subject: [PATCH 3/4] Change seq_printf format for 64 bit context 5 - 6 - --- 7 - amd/amdgpu/amdgpu_sa.c | 2 +- 8 - 1 file changed, 1 insertion(+), 1 deletion(-) 9 - 10 - diff --git a/amd/amdgpu/amdgpu_sa.c b/amd/amdgpu/amdgpu_sa.c 11 - index 74932bf..db4119a 100644 12 - --- a/amd/amdgpu/amdgpu_sa.c 13 - +++ b/amd/amdgpu/amdgpu_sa.c 14 - @@ -428,7 +428,7 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager, 15 - soffset, eoffset, eoffset - soffset); 16 - 17 - if (i->fence) 18 - -#if defined(BUILD_AS_DKMS) 19 - +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) 20 - seq_printf(m, " protected by 0x%08x on context %d", 21 - i->fence->seqno, i->fence->context); 22 - #else 23 - -- 24 - 2.12.2 25 -
+25
pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-firmware-copy.patch
··· 1 + From 7a3062acbbabdb29239bbc8c984e62589a88576e Mon Sep 17 00:00:00 2001 2 + From: David McFarland <corngood@gmail.com> 3 + Date: Tue, 9 Jan 2018 21:49:55 -0400 4 + Subject: [PATCH 3/3] disable firmware copy 5 + 6 + --- 7 + pre-build.sh | 5 ----- 8 + 1 file changed, 5 deletions(-) 9 + 10 + diff --git a/pre-build.sh b/pre-build.sh 11 + index e7b8a32..bad8f25 100755 12 + --- a/pre-build.sh 13 + +++ b/pre-build.sh 14 + @@ -38,8 +38,3 @@ find ttm -name '*.c' -exec grep EXPORT_SYMBOL {} + \ 15 + | sort -u \ 16 + | awk -F'[()]' '{print "#define "$2" amd"$2" //"$0}'\ 17 + >> include/rename_symbol.h 18 + - 19 + -FW_DIR="/lib/firmware/$KERNELVER" 20 + -mkdir -p $FW_DIR 21 + -cp -ar /usr/src/amdgpu-17.40-492261/firmware/radeon $FW_DIR 22 + -cp -ar /usr/src/amdgpu-17.40-492261/firmware/amdgpu $FW_DIR 23 + -- 24 + 2.15.1 25 +
-46
pkgs/os-specific/linux/amdgpu-pro/patches/0004-fix-warnings-for-Werror.patch
··· 1 - From dbf01d3934c52acaaa37f008859f69c5edf19ad5 Mon Sep 17 00:00:00 2001 2 - From: David McFarland <corngood@gmail.com> 3 - Date: Mon, 6 Feb 2017 22:13:49 -0400 4 - Subject: [PATCH 4/4] fix warnings for Werror 5 - 6 - --- 7 - amd/amdgpu/amdgpu_ttm.c | 2 ++ 8 - amd/display/amdgpu_dm/amdgpu_dm_types.c | 2 +- 9 - 2 files changed, 3 insertions(+), 1 deletion(-) 10 - 11 - diff --git a/amd/amdgpu/amdgpu_ttm.c b/amd/amdgpu/amdgpu_ttm.c 12 - index 0e30389..890aafa 100644 13 - --- a/amd/amdgpu/amdgpu_ttm.c 14 - +++ b/amd/amdgpu/amdgpu_ttm.c 15 - @@ -1083,6 +1083,7 @@ uint32_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm, 16 - return flags; 17 - } 18 - 19 - +#if 0 20 - static void amdgpu_ttm_lru_removal(struct ttm_buffer_object *tbo) 21 - { 22 - struct amdgpu_device *adev = amdgpu_ttm_adev(tbo->bdev); 23 - @@ -1132,6 +1133,7 @@ static struct list_head *amdgpu_ttm_swap_lru_tail(struct ttm_buffer_object *tbo) 24 - 25 - return res; 26 - } 27 - +#endif 28 - 29 - static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, 30 - const struct ttm_place *place) 31 - diff --git a/amd/display/amdgpu_dm/amdgpu_dm_types.c b/amd/display/amdgpu_dm/amdgpu_dm_types.c 32 - index 44a4a71..ae7e707 100644 33 - --- a/amd/display/amdgpu_dm/amdgpu_dm_types.c 34 - +++ b/amd/display/amdgpu_dm/amdgpu_dm_types.c 35 - @@ -932,7 +932,7 @@ static void decide_crtc_timing_for_drm_display_mode( 36 - } 37 - 38 - static struct dc_target *create_target_for_sink( 39 - - const struct amdgpu_connector *aconnector, 40 - + struct amdgpu_connector *aconnector, 41 - const struct drm_display_mode *drm_mode, 42 - const struct dm_connector_state *dm_state) 43 - { 44 - -- 45 - 2.12.2 46 -
+5
pkgs/os-specific/linux/amdgpu-pro/xreallocarray.c
··· 1 + #include <malloc.h> 2 + 3 + void *xreallocarray(void *ptr, size_t nmemb, size_t size) { 4 + return reallocarray(ptr, nmemb, size); 5 + }