summary refs log tree commit diff
path: root/pkgs/os-specific/linux/amdgpu-pro
diff options
context:
space:
mode:
authorDavid McFarland <corngood@gmail.com>2018-01-09 20:49:55 -0400
committerDavid McFarland <corngood@gmail.com>2018-01-12 00:09:15 -0400
commit68dda232d2ca09a6609f8dfd5d24d8c195617d24 (patch)
treecdc38c50d17409892088a98b417ec0910be1cdc6 /pkgs/os-specific/linux/amdgpu-pro
parent6d3ff29d038c05eab7c6989f88906912489e2ad9 (diff)
downloadnixpkgs-68dda232d2ca09a6609f8dfd5d24d8c195617d24.tar
nixpkgs-68dda232d2ca09a6609f8dfd5d24d8c195617d24.tar.gz
nixpkgs-68dda232d2ca09a6609f8dfd5d24d8c195617d24.tar.bz2
nixpkgs-68dda232d2ca09a6609f8dfd5d24d8c195617d24.tar.lz
nixpkgs-68dda232d2ca09a6609f8dfd5d24d8c195617d24.tar.xz
nixpkgs-68dda232d2ca09a6609f8dfd5d24d8c195617d24.tar.zst
nixpkgs-68dda232d2ca09a6609f8dfd5d24d8c195617d24.zip
amdgpu-pro: 17.10 -> 17.40
Diffstat (limited to 'pkgs/os-specific/linux/amdgpu-pro')
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/default.nix47
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0001-disable-firmware-copy.patch25
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0001-fix-warnings-for-Werror.patch71
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0002-fix-sketchy-int-ptr-warning.patch25
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0002-linux-4.9-fixes.patch50
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0003-Change-seq_printf-format-for-64-bit-context.patch25
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-firmware-copy.patch25
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0004-fix-warnings-for-Werror.patch46
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/xreallocarray.c5
9 files changed, 156 insertions, 163 deletions
diff --git a/pkgs/os-specific/linux/amdgpu-pro/default.nix b/pkgs/os-specific/linux/amdgpu-pro/default.nix
index e7825a0ebd6..ccf13656fff 100644
--- a/pkgs/os-specific/linux/amdgpu-pro/default.nix
+++ b/pkgs/os-specific/linux/amdgpu-pro/default.nix
@@ -30,9 +30,9 @@ let
 
 in stdenv.mkDerivation rec {
 
-  version = "17.10";
+  version = "17.40";
   pname = "amdgpu-pro";
-  build = "${version}-401251";
+  build = "${version}-492261";
 
   libCompatDir = "/run/lib/${libArch}";
 
@@ -41,7 +41,7 @@ in stdenv.mkDerivation rec {
   src = fetchurl {
     url =
     "https://www2.ati.com/drivers/linux/ubuntu/amdgpu-pro-${build}.tar.xz";
-    sha256 = "004n0df8acjpjz72z3bjxb2a0b7qwln13jlknfn7xxqvhhwwy40a";
+    sha256 = "1c073lp9cq1rc2mddky2r0j2dv9dd167qj02visz37vwaxbm2r5h";
     curlOpts = "--referer http://support.amd.com/en-us/kb-articles/Pages/AMD-Radeon-GPU-PRO-Linux-Beta-Driver%e2%80%93Release-Notes.aspx";
   };
 
@@ -57,15 +57,14 @@ in stdenv.mkDerivation rec {
     sourceRoot=.
   '';
 
-  modulePatches = [
-    ./patches/0001-disable-firmware-copy.patch
-    ./patches/0002-linux-4.9-fixes.patch
-    ./patches/0003-Change-seq_printf-format-for-64-bit-context.patch
-    ./patches/0004-fix-warnings-for-Werror.patch
-  ];
+  modulePatches = optionals (!libsOnly) ([
+    ./patches/0001-fix-warnings-for-Werror.patch
+    ./patches/0002-fix-sketchy-int-ptr-warning.patch
+    ./patches/0003-disable-firmware-copy.patch
+  ]);
 
   patchPhase = optionalString (!libsOnly) ''
-    pushd usr/src/amdgpu-pro-${build}
+    pushd usr/src/amdgpu-${build}
     for patch in $modulePatches
     do
       echo $patch
@@ -74,12 +73,18 @@ in stdenv.mkDerivation rec {
     popd
   '';
 
+  xreallocarray = ./xreallocarray.c;
+
   preBuild = optionalString (!libsOnly) ''
-    pushd usr/src/amdgpu-pro-${build}
+    pushd usr/src/amdgpu-${build}
     makeFlags="$makeFlags M=$(pwd)"
     patchShebangs pre-build.sh
     ./pre-build.sh ${kernel.version}
     popd
+    pushd lib
+    $CC -fPIC -shared -o libhack-xreallocarray.so $xreallocarray
+    strip libhack-xreallocarray.so
+    popd
   '';
 
   modules = [
@@ -89,7 +94,7 @@ in stdenv.mkDerivation rec {
   ];
 
   postBuild = optionalString (!libsOnly)
-    (concatMapStrings (m: "xz usr/src/amdgpu-pro-${build}/${m}\n") modules);
+    (concatMapStrings (m: "xz usr/src/amdgpu-${build}/${m}\n") modules);
 
   NIX_CFLAGS_COMPILE = "-Werror";
 
@@ -110,16 +115,17 @@ in stdenv.mkDerivation rec {
     pushd usr
     cp -r lib/${libArch}/* $out/lib
   '' + optionalString (!libsOnly) ''
-    cp -r src/amdgpu-pro-${build}/firmware $out/lib/firmware
+    cp -r src/amdgpu-${build}/firmware $out/lib/firmware
   '' + ''
     cp -r share $out/share
     popd
 
     pushd opt/amdgpu-pro
-  '' + optionalString (!stdenv.is64bit) ''
+  '' + optionalString (!libsOnly && stdenv.is64bit) ''
     cp -r bin $out/bin
   '' + ''
     cp -r include $out/include
+    cp -r share/* $out/share
     cp -r lib/${libArch}/* $out/lib
   '' + optionalString (!libsOnly) ''
     mv lib/xorg $out/lib/xorg
@@ -128,12 +134,12 @@ in stdenv.mkDerivation rec {
 
   '' + optionalString (!libsOnly)
     (concatMapStrings (m:
-      "install -Dm444 usr/src/amdgpu-pro-${build}/${m}.xz $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/${m}.xz\n") modules)
+      "install -Dm444 usr/src/amdgpu-${build}/${m}.xz $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/${m}.xz\n") modules)
   + ''
     mv $out/etc/vulkan $out/share
     interpreter="$(cat $NIX_CC/nix-support/dynamic-linker)"
     libPath="$out/lib:$out/lib/gbm:$depLibPath"
-  '' + optionalString (!stdenv.is64bit) ''
+  '' + optionalString (!libsOnly && stdenv.is64bit) ''
     for prog in clinfo modetest vbltest kms-universal-planes kms-steal-crtc modeprint amdgpu_test kmstest proptest; do
       patchelf --interpreter "$interpreter" --set-rpath "$libPath" "$out/bin/$prog"
     done
@@ -147,10 +153,17 @@ in stdenv.mkDerivation rec {
     for lib in `find "$out/lib/" -name '*.so*' -type f`; do
       patchelf --set-rpath "$libPath" "$lib"
     done
-    for lib in libEGL.so.1 libGL.so.1.2 ${optionalString (!libsOnly) "xorg/modules/extensions/libglx.so"} dri/amdgpu_dri.so; do
+    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
       perl -pi -e 's:${libReplaceDir}:${libCompatDir}:g' "$out/lib/$lib"
     done
+    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
+      perl -pi -e 's:/opt/amdgpu-pro/:/run/amdgpu-pro/:g' "$out/lib/$lib"
+    done
     substituteInPlace "$out/share/vulkan/icd.d/amd_icd${bitness}.json" --replace "/opt/amdgpu-pro/lib/${libArch}" "$out/lib"
+  '' + optionalString (!libsOnly) ''
+    for lib in drivers/modesetting_drv.so libglamoregl.so; do
+      patchelf --add-needed $out/lib/libhack-xreallocarray.so $out/lib/xorg/modules/$lib
+    done
   '';
 
   buildInputs = [
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0001-disable-firmware-copy.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0001-disable-firmware-copy.patch
deleted file mode 100644
index 4733e0580af..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0001-disable-firmware-copy.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 704cef8638ffbdd8de9e57f28b43ea42c685ea87 Mon Sep 17 00:00:00 2001
-From: David McFarland <corngood@gmail.com>
-Date: Sat, 28 Jan 2017 16:57:26 -0400
-Subject: [PATCH 1/4] disable firmware copy
-
----
- pre-build.sh | 5 -----
- 1 file changed, 5 deletions(-)
-
-diff --git a/pre-build.sh b/pre-build.sh
-index 622ff13..e3cd009 100755
---- a/pre-build.sh
-+++ b/pre-build.sh
-@@ -35,8 +35,3 @@ find ttm -name '*.c' -exec grep EXPORT_SYMBOL {} + \
-     | sort -u \
-     | awk -F'[()]' '{print "#define "$2" amd"$2" //"$0}'\
-     > include/rename_symbol.h
--
--FW_DIR="/lib/firmware/$KERNELVER"
--mkdir -p $FW_DIR
--cp -ar /usr/src/amdgpu-pro-17.10-401251/firmware/radeon $FW_DIR
--cp -ar /usr/src/amdgpu-pro-17.10-401251/firmware/amdgpu $FW_DIR
--- 
-2.12.2
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0001-fix-warnings-for-Werror.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0001-fix-warnings-for-Werror.patch
new file mode 100644
index 00000000000..ecde6401ac1
--- /dev/null
+++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0001-fix-warnings-for-Werror.patch
@@ -0,0 +1,71 @@
+From 9167d76c435a7c1df7954f0fbe5cc6d083f8ed2f Mon Sep 17 00:00:00 2001
+From: David McFarland <corngood@gmail.com>
+Date: Mon, 6 Feb 2017 22:13:49 -0400
+Subject: [PATCH 1/3] fix warnings for Werror
+
+---
+ amd/amdgpu/amdgpu_device.c         | 4 ++--
+ amd/amdgpu/amdgpu_sa.c             | 2 +-
+ amd/display/dc/bios/bios_parser2.c | 8 ++++----
+ 3 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/amd/amdgpu/amdgpu_device.c b/amd/amdgpu/amdgpu_device.c
+index fc1c543..186e06d 100644
+--- a/amd/amdgpu/amdgpu_device.c
++++ b/amd/amdgpu/amdgpu_device.c
+@@ -3164,7 +3164,7 @@ void amdgpu_debugfs_cleanup(struct drm_minor *minor)
+ 	struct drm_info_node *node, *tmp;
+ 
+ 	if (!&minor->debugfs_root)
+-		return 0;
++		return;
+ 
+ 	mutex_lock(&minor->debugfs_lock);
+ 	list_for_each_entry_safe(node, tmp,
+@@ -3175,7 +3175,7 @@ void amdgpu_debugfs_cleanup(struct drm_minor *minor)
+ 	}
+ 	mutex_unlock(&minor->debugfs_lock);
+ 
+-	return 0;
++	return;
+ }
+ #endif
+ 
+diff --git a/amd/amdgpu/amdgpu_sa.c b/amd/amdgpu/amdgpu_sa.c
+index 7206b34..8b7123c 100644
+--- a/amd/amdgpu/amdgpu_sa.c
++++ b/amd/amdgpu/amdgpu_sa.c
+@@ -430,7 +430,7 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager,
+ 		if (i->fence)
+ #if defined(BUILD_AS_DKMS)
+ 			seq_printf(m, " protected by 0x%08x on context %d",
+-					i->fence->seqno, i->fence->context);
++					i->fence->seqno, (int)i->fence->context);
+ #else
+ 			seq_printf(m, " protected by 0x%08x on context %llu",
+ 				   i->fence->seqno, i->fence->context);
+diff --git a/amd/display/dc/bios/bios_parser2.c b/amd/display/dc/bios/bios_parser2.c
+index 86fce5a..99681c5 100644
+--- a/amd/display/dc/bios/bios_parser2.c
++++ b/amd/display/dc/bios/bios_parser2.c
+@@ -1326,13 +1326,13 @@ static enum bp_result get_embedded_panel_info_v2_1(
+ 	info->lcd_timing.misc_info.VERTICAL_CUT_OFF = 0;
+ 
+ 	info->lcd_timing.misc_info.H_REPLICATION_BY2 =
+-		lvds->lcd_timing.miscinfo & ATOM_H_REPLICATIONBY2;
++		(lvds->lcd_timing.miscinfo & ATOM_H_REPLICATIONBY2) != 0;
+ 	info->lcd_timing.misc_info.V_REPLICATION_BY2 =
+-		lvds->lcd_timing.miscinfo & ATOM_V_REPLICATIONBY2;
++		(lvds->lcd_timing.miscinfo & ATOM_V_REPLICATIONBY2) != 0;
+ 	info->lcd_timing.misc_info.COMPOSITE_SYNC =
+-		lvds->lcd_timing.miscinfo & ATOM_COMPOSITESYNC;
++		(lvds->lcd_timing.miscinfo & ATOM_COMPOSITESYNC) != 0;
+ 	info->lcd_timing.misc_info.INTERLACE =
+-		lvds->lcd_timing.miscinfo & ATOM_INTERLACE;
++		(lvds->lcd_timing.miscinfo & ATOM_INTERLACE) != 0;
+ 
+ 	/* not provided by VBIOS*/
+ 	info->lcd_timing.misc_info.DOUBLE_CLOCK = 0;
+-- 
+2.15.1
+
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0002-fix-sketchy-int-ptr-warning.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0002-fix-sketchy-int-ptr-warning.patch
new file mode 100644
index 00000000000..20f429757a5
--- /dev/null
+++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0002-fix-sketchy-int-ptr-warning.patch
@@ -0,0 +1,25 @@
+From a07ee5dec35ca24a013a6638543ef5030b2bab40 Mon Sep 17 00:00:00 2001
+From: David McFarland <corngood@gmail.com>
+Date: Tue, 9 Jan 2018 21:45:33 -0400
+Subject: [PATCH 2/3] fix sketchy int->ptr warning
+
+---
+ amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+index d0f091b..707815a 100644
+--- a/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
++++ b/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+@@ -236,7 +236,7 @@ bool dm_helpers_dp_mst_write_payload_allocation_table(
+ 		pbn = drm_dp_calc_pbn_mode(clock, bpp);
+ 
+ 		slots = drm_dp_find_vcpi_slots(mst_mgr, pbn);
+-		ret = drm_dp_mst_allocate_vcpi(mst_mgr, mst_port, pbn, slots);
++		ret = drm_dp_mst_allocate_vcpi(mst_mgr, mst_port, pbn, &slots);
+ 
+ 		if (!ret)
+ 			return false;
+-- 
+2.15.1
+
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0002-linux-4.9-fixes.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0002-linux-4.9-fixes.patch
deleted file mode 100644
index aa6cbcc118d..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0002-linux-4.9-fixes.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 0ead7017e1db18be971c24c891d4bdcc507deea7 Mon Sep 17 00:00:00 2001
-From: David McFarland <corngood@gmail.com>
-Date: Sun, 29 Jan 2017 18:23:47 -0400
-Subject: [PATCH 2/4] linux-4.9 fixes
-
----
- amd/amdkcl/kcl_io.c                     | 2 ++
- amd/display/amdgpu_dm/amdgpu_dm_types.c | 8 ++++++++
- 2 files changed, 10 insertions(+)
-
-diff --git a/amd/amdkcl/kcl_io.c b/amd/amdkcl/kcl_io.c
-index d8f843f..9a1bd9b 100644
---- a/amd/amdkcl/kcl_io.c
-+++ b/amd/amdkcl/kcl_io.c
-@@ -31,4 +31,6 @@ void amdkcl_io_init(void)
- 	_kcl_io_free_memtype = amdkcl_fp_setup("io_free_memtype", NULL);
- }
- #endif
-+#else
-+void amdkcl_io_init(void) {}
- #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) */
-diff --git a/amd/display/amdgpu_dm/amdgpu_dm_types.c b/amd/display/amdgpu_dm/amdgpu_dm_types.c
-index 34313a9..44a4a71 100644
---- a/amd/display/amdgpu_dm/amdgpu_dm_types.c
-+++ b/amd/display/amdgpu_dm/amdgpu_dm_types.c
-@@ -1720,6 +1720,10 @@ static int dm_plane_helper_prepare_fb(
- static int dm_plane_helper_prepare_fb(
- 	struct drm_plane *plane,
- 	const struct drm_plane_state *new_state)
-+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
-+static int dm_plane_helper_prepare_fb(
-+	struct drm_plane *plane,
-+	struct drm_plane_state *new_state)
- #else
- static int dm_plane_helper_prepare_fb(
- 	struct drm_plane *plane,
-@@ -1766,6 +1770,10 @@ static void dm_plane_helper_cleanup_fb(
- static void dm_plane_helper_cleanup_fb(
- 	struct drm_plane *plane,
- 	const struct drm_plane_state *old_state)
-+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
-+static void dm_plane_helper_cleanup_fb(
-+	struct drm_plane *plane,
-+	struct drm_plane_state *old_state)
- #else
- static void dm_plane_helper_cleanup_fb(
- 	struct drm_plane *plane,
--- 
-2.12.2
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0003-Change-seq_printf-format-for-64-bit-context.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0003-Change-seq_printf-format-for-64-bit-context.patch
deleted file mode 100644
index 7a11c9bd4ef..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0003-Change-seq_printf-format-for-64-bit-context.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From b6dd36dd90c5d88ae10b9dbc763d3bacb95ccddb Mon Sep 17 00:00:00 2001
-From: "Luke A. Guest" <laguest@archeia.com>
-Date: Sun, 25 Sep 2016 16:46:39 +0100
-Subject: [PATCH 3/4] Change seq_printf format for 64 bit context
-
----
- amd/amdgpu/amdgpu_sa.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/amd/amdgpu/amdgpu_sa.c b/amd/amdgpu/amdgpu_sa.c
-index 74932bf..db4119a 100644
---- a/amd/amdgpu/amdgpu_sa.c
-+++ b/amd/amdgpu/amdgpu_sa.c
-@@ -428,7 +428,7 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager,
- 			   soffset, eoffset, eoffset - soffset);
- 
- 		if (i->fence)
--#if defined(BUILD_AS_DKMS)
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
- 			seq_printf(m, " protected by 0x%08x on context %d",
- 					i->fence->seqno, i->fence->context);
- #else
--- 
-2.12.2
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-firmware-copy.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-firmware-copy.patch
new file mode 100644
index 00000000000..0091c471680
--- /dev/null
+++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-firmware-copy.patch
@@ -0,0 +1,25 @@
+From 7a3062acbbabdb29239bbc8c984e62589a88576e Mon Sep 17 00:00:00 2001
+From: David McFarland <corngood@gmail.com>
+Date: Tue, 9 Jan 2018 21:49:55 -0400
+Subject: [PATCH 3/3] disable firmware copy
+
+---
+ pre-build.sh | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/pre-build.sh b/pre-build.sh
+index e7b8a32..bad8f25 100755
+--- a/pre-build.sh
++++ b/pre-build.sh
+@@ -38,8 +38,3 @@ find ttm -name '*.c' -exec grep EXPORT_SYMBOL {} + \
+     | sort -u \
+     | awk -F'[()]' '{print "#define "$2" amd"$2" //"$0}'\
+     >> include/rename_symbol.h
+-
+-FW_DIR="/lib/firmware/$KERNELVER"
+-mkdir -p $FW_DIR
+-cp -ar /usr/src/amdgpu-17.40-492261/firmware/radeon $FW_DIR
+-cp -ar /usr/src/amdgpu-17.40-492261/firmware/amdgpu $FW_DIR
+-- 
+2.15.1
+
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0004-fix-warnings-for-Werror.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0004-fix-warnings-for-Werror.patch
deleted file mode 100644
index cd360e18faa..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0004-fix-warnings-for-Werror.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From dbf01d3934c52acaaa37f008859f69c5edf19ad5 Mon Sep 17 00:00:00 2001
-From: David McFarland <corngood@gmail.com>
-Date: Mon, 6 Feb 2017 22:13:49 -0400
-Subject: [PATCH 4/4] fix warnings for Werror
-
----
- amd/amdgpu/amdgpu_ttm.c                 | 2 ++
- amd/display/amdgpu_dm/amdgpu_dm_types.c | 2 +-
- 2 files changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/amd/amdgpu/amdgpu_ttm.c b/amd/amdgpu/amdgpu_ttm.c
-index 0e30389..890aafa 100644
---- a/amd/amdgpu/amdgpu_ttm.c
-+++ b/amd/amdgpu/amdgpu_ttm.c
-@@ -1083,6 +1083,7 @@ uint32_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
- 	return flags;
- }
- 
-+#if 0
- static void amdgpu_ttm_lru_removal(struct ttm_buffer_object *tbo)
- {
- 	struct amdgpu_device *adev = amdgpu_ttm_adev(tbo->bdev);
-@@ -1132,6 +1133,7 @@ static struct list_head *amdgpu_ttm_swap_lru_tail(struct ttm_buffer_object *tbo)
- 
- 	return res;
- }
-+#endif
- 
- static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
- 					    const struct ttm_place *place)
-diff --git a/amd/display/amdgpu_dm/amdgpu_dm_types.c b/amd/display/amdgpu_dm/amdgpu_dm_types.c
-index 44a4a71..ae7e707 100644
---- a/amd/display/amdgpu_dm/amdgpu_dm_types.c
-+++ b/amd/display/amdgpu_dm/amdgpu_dm_types.c
-@@ -932,7 +932,7 @@ static void decide_crtc_timing_for_drm_display_mode(
- }
- 
- static struct dc_target *create_target_for_sink(
--		const struct amdgpu_connector *aconnector,
-+		struct amdgpu_connector *aconnector,
- 		const struct drm_display_mode *drm_mode,
- 		const struct dm_connector_state *dm_state)
- {
--- 
-2.12.2
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/xreallocarray.c b/pkgs/os-specific/linux/amdgpu-pro/xreallocarray.c
new file mode 100644
index 00000000000..ab47bacb822
--- /dev/null
+++ b/pkgs/os-specific/linux/amdgpu-pro/xreallocarray.c
@@ -0,0 +1,5 @@
+#include <malloc.h>
+
+void *xreallocarray(void *ptr, size_t nmemb, size_t size) {
+  return reallocarray(ptr, nmemb, size);
+}