From 3d4a280c354bb21b711055ca7e02ee3e7999292b Mon Sep 17 00:00:00 2001 From: David McFarland Date: Thu, 27 Oct 2016 23:10:44 -0300 Subject: [PATCH] amdgpu-pro: 16.30.3-315407 -> 16.40-348864 --- pkgs/os-specific/linux/amdgpu-pro/default.nix | 107 +++++----- ...-vga-switcheroo-handler-flag-for-4.8.patch | 27 --- .../0001-Find-correct-System.map.patch | 25 +++ ...2-Fix-kernel-module-install-location.patch | 25 +++ ...0002-Remove-dependency-on-System.map.patch | 112 ---------- .../0003-Add-Gentoo-as-build-option.patch | 30 +++ ...ameter-from-ttm_bo_reserve-for-4.7.0.patch | 28 +++ ...rst-param-from-drm_gem_object_lookup.patch | 196 ++++++++++++++++++ ...ve-vblank_disable_allowed-assignment.patch | 26 +++ ..._helper_connector_destroy_state-call.patch | 28 +++ ...seq_printf-format-for-64-bit-context.patch | 30 +++ .../patches/0009-Fix-vblank-calls.patch | 135 ++++++++++++ ...0-Fix-crtc_gamma-functions-for-4.8.0.patch | 163 +++++++++++++++ ...m_atomic_helper_swap_state-for-4.8.0.patch | 28 +++ ...lag-to-ttm_bo_move_ttm-for-4.8.0-rc2.patch | 40 ++++ ...0013-Remove-dependency-on-System.map.patch | 61 ++++++ ...atch => 0014-disable-dal-by-default.patch} | 8 +- 17 files changed, 878 insertions(+), 191 deletions(-) delete mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0001-Add-vga-switcheroo-handler-flag-for-4.8.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0001-Find-correct-System.map.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0002-Fix-kernel-module-install-location.patch delete mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0002-Remove-dependency-on-System.map.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0003-Add-Gentoo-as-build-option.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0004-Remove-extra-parameter-from-ttm_bo_reserve-for-4.7.0.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0005-Remove-first-param-from-drm_gem_object_lookup.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0006-Remove-vblank_disable_allowed-assignment.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0007-Fix-__drm_atomic_helper_connector_destroy_state-call.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0008-Change-seq_printf-format-for-64-bit-context.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0009-Fix-vblank-calls.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0010-Fix-crtc_gamma-functions-for-4.8.0.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0011-Fix-drm_atomic_helper_swap_state-for-4.8.0.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0012-Add-extra-flag-to-ttm_bo_move_ttm-for-4.8.0-rc2.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0013-Remove-dependency-on-System.map.patch rename pkgs/os-specific/linux/amdgpu-pro/patches/{0003-disable-dal-by-default.patch => 0014-disable-dal-by-default.patch} (79%) diff --git a/pkgs/os-specific/linux/amdgpu-pro/default.nix b/pkgs/os-specific/linux/amdgpu-pro/default.nix index 5c11fad35970..4a0527242c7f 100644 --- a/pkgs/os-specific/linux/amdgpu-pro/default.nix +++ b/pkgs/os-specific/linux/amdgpu-pro/default.nix @@ -1,7 +1,7 @@ { stdenv, fetchurl, elfutils, mesa_noglu , xorg, patchelf, openssl, libdrm, libudev , libxcb, libxshmfence, epoxy, perl, zlib -, fetchFromGitHub +, fetchFromGitHub, ncurses , libsOnly ? false, kernel ? null }: @@ -26,11 +26,13 @@ let libReplaceDir = "/usr/lib/${libArch}"; + ncurses5 = ncurses.override { abiVersion = "5"; }; + in stdenv.mkDerivation rec { - version = "16.30"; + version = "16.40"; pname = "amdgpu-pro"; - build = "16.30.3-315407"; + build = "16.40-348864"; libCompatDir = "/run/lib/${libArch}"; @@ -38,16 +40,9 @@ in stdenv.mkDerivation rec { src = fetchurl { url = - "https://www2.ati.com/drivers/linux/amdgpu-pro_${build}.tar.xz"; - sha256 = "97d6fb64617cf2cefe780e5fb83b29d8ee4e3e7886b71fe3d92b0113847b2354"; - curlOpts = "--referer http://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Beta-Driver-for-Vulkan-Release-Notes.aspx"; - }; - - vulkanOverlay = fetchFromGitHub { - owner = "Lucretia"; - repo = "vulkan-overlay"; - rev = "70558192e7ac16103e1ec6100c1bebd6f162c818"; - sha256 = "1ycl55m3wc72q0a6pkyhhzji7llliw8076aiynr60jyv6cnmcgdz"; + "https://www2.ati.com/drivers/linux/ubuntu/amdgpu-pro-${build}.tar.xz"; + sha256 = "1c06lx07irmlpmbmgb3qcgpzj6q6rimszrbbdrgz8kqnfpcv3mjr"; + curlOpts = "--referer http://support.amd.com/en-us/kb-articles/Pages/AMD-Radeon-GPU-PRO-Linux-Beta-Driver%e2%80%93Release-Notes.aspx"; }; hardeningDisable = [ "pic" "format" ]; @@ -58,19 +53,30 @@ in stdenv.mkDerivation rec { cd $sourceRoot mkdir root cd root - for deb in ../*.deb; do echo $deb; ar p $deb data.tar.xz | tar -xJ; done + for deb in ../*_all.deb ../*_i386.deb '' + optionalString stdenv.is64bit "../*_amd64.deb" + ''; do echo $deb; ar p $deb data.tar.xz | tar -xJ; done sourceRoot=. ''; modulePatches = [ - ./patches/0001-Add-vga-switcheroo-handler-flag-for-4.8.patch - ./patches/0002-Remove-dependency-on-System.map.patch - ./patches/0003-disable-dal-by-default.patch + ./patches/0001-Find-correct-System.map.patch + ./patches/0002-Fix-kernel-module-install-location.patch + ./patches/0003-Add-Gentoo-as-build-option.patch + ./patches/0004-Remove-extra-parameter-from-ttm_bo_reserve-for-4.7.0.patch + ./patches/0005-Remove-first-param-from-drm_gem_object_lookup.patch + ./patches/0006-Remove-vblank_disable_allowed-assignment.patch + ./patches/0007-Fix-__drm_atomic_helper_connector_destroy_state-call.patch + ./patches/0008-Change-seq_printf-format-for-64-bit-context.patch + ./patches/0009-Fix-vblank-calls.patch + ./patches/0010-Fix-crtc_gamma-functions-for-4.8.0.patch + ./patches/0011-Fix-drm_atomic_helper_swap_state-for-4.8.0.patch + ./patches/0012-Add-extra-flag-to-ttm_bo_move_ttm-for-4.8.0-rc2.patch + ./patches/0013-Remove-dependency-on-System.map.patch + ./patches/0014-disable-dal-by-default.patch ]; patchPhase = optionalString (!libsOnly) '' pushd usr/src/amdgpu-pro-${build} - for patch in $vulkanOverlay/sys-kernel/amdgpu-pro-dkms/files/${build}/*.patch $modulePatches + for patch in $modulePatches do echo $patch patch -f -p1 < $patch || true @@ -91,55 +97,60 @@ in stdenv.mkDerivation rec { depLibPath = makeLibraryPath [ stdenv.cc.cc.lib xorg.libXext xorg.libX11 xorg.libXdamage xorg.libXfixes zlib - xorg.libXxf86vm libxcb libxshmfence epoxy openssl libdrm elfutils libudev + xorg.libXxf86vm libxcb libxshmfence epoxy openssl libdrm elfutils libudev ncurses5 ]; installPhase = '' mkdir -p $out - cp -r usr/bin $out/bin - cp -r usr/share $out/share + cp -r etc $out/etc - mv $out/etc/vulkan $out/share - cp -r usr/include $out/include - cp -r usr/lib/${libArch} $out/lib - mv $out/lib/amdgpu-pro/* $out/lib/ - rmdir $out/lib/amdgpu-pro + cp -r lib $out/lib + + pushd usr + cp -r lib/${libArch}/* $out/lib + '' + optionalString (!libsOnly) '' + cp -r src/amdgpu-pro-${build}/firmware $out/lib/firmware + '' + '' + cp -r share $out/share + popd + + pushd opt/amdgpu-pro + '' + optionalString (!stdenv.is64bit) '' + cp -r bin $out/bin + '' + '' + cp -r include $out/include + cp -r lib/${libArch}/* $out/lib + '' + optionalString (!libsOnly) '' + mv lib/xorg $out/lib/xorg + '' + '' + popd + '' + optionalString (!libsOnly) '' - if [ -d $out/lib/xorg ]; then - rm $out/lib/xorg - mv $out/lib/1.18 $out/lib/xorg - rm -r $out/lib/1.* - fi - cp -r lib/firmware $out/lib/firmware mkdir -p $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/amd/amdgpu/amdgpu.ko.xz cp usr/src/amdgpu-pro-${build}/amd/amdgpu/amdgpu.ko.xz $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/amd/amdgpu/amdgpu.ko.xz '' + '' + mv $out/etc/vulkan $out/share interpreter="$(cat $NIX_CC/nix-support/dynamic-linker)" libPath="$out/lib:$out/lib/gbm:$depLibPath" - echo patching with $interpreter $libPath - for prog in "$out"/bin/*; do - echo patching program $prog - patchelf --interpreter "$interpreter" --set-rpath "$libPath" "$prog" - done - for lib in `find "$out/lib/" -name '*.so*'`; do - echo patching library $lib - patchelf --set-rpath "$libPath" "$lib" + '' + optionalString (!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 + '' + '' + ln -s libgbm.so.1.0.0 $out/lib/libgbm.so.1 + ln -s ${makeLibraryPath [ncurses5]}/libncursesw.so.5 $out/lib/libtinfo.so.5 ''; + # we'll just set the full rpath on everything to avoid having to track down dlopen problems postFixup = assert (stringLength libReplaceDir == stringLength libCompatDir); '' libPath="$out/lib:$out/lib/gbm:$depLibPath" - for lib in libgbm.so.1.0.0 ${optionalString (!libsOnly) "xorg/modules/drivers/amdgpu_drv.so"} amdvlk${bitness}.so vdpau/libvdpau_amdgpu.so; do - if [ -e "$out/lib/$lib" ]; then - patchelf --set-rpath "$libPath" "$out/lib/$lib" - fi + 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 - if [ -e "$out/lib/$lib" ]; then - perl -pi -e 's:${libReplaceDir}:${libCompatDir}:g' "$out/lib/$lib" - fi + perl -pi -e 's:${libReplaceDir}:${libCompatDir}:g' "$out/lib/$lib" done - substituteInPlace "$out/share/vulkan/icd.d/amd_icd${bitness}.json" --replace "/usr/lib/${libArch}" "$out/lib" + substituteInPlace "$out/share/vulkan/icd.d/amd_icd${bitness}.json" --replace "/opt/amdgpu-pro/lib/${libArch}" "$out/lib" ''; buildInputs = [ diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0001-Add-vga-switcheroo-handler-flag-for-4.8.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0001-Add-vga-switcheroo-handler-flag-for-4.8.patch deleted file mode 100644 index eba98965e679..000000000000 --- a/pkgs/os-specific/linux/amdgpu-pro/patches/0001-Add-vga-switcheroo-handler-flag-for-4.8.patch +++ /dev/null @@ -1,27 +0,0 @@ -From c41b07cad36b1019e8d8debc8d46a7f2673982b7 Mon Sep 17 00:00:00 2001 -From: David McFarland -Date: Wed, 26 Oct 2016 22:19:05 -0300 -Subject: [PATCH 1/2] Add vga switcheroo handler flag for 4.8 - ---- - amd/amdgpu/amdgpu_atpx_handler.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/amd/amdgpu/amdgpu_atpx_handler.c b/amd/amdgpu/amdgpu_atpx_handler.c -index cc9b998..e48d935 100644 ---- a/amd/amdgpu/amdgpu_atpx_handler.c -+++ b/amd/amdgpu/amdgpu_atpx_handler.c -@@ -565,7 +565,9 @@ void amdgpu_register_atpx_handler(void) - if (!r) - return; - -- vga_switcheroo_register_handler(&amdgpu_atpx_handler); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) -+ vga_switcheroo_register_handler(&amdgpu_atpx_handler, 0); -+#endif - } - - /** --- -2.10.0 - diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0001-Find-correct-System.map.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0001-Find-correct-System.map.patch new file mode 100644 index 000000000000..2a086cf37bc9 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0001-Find-correct-System.map.patch @@ -0,0 +1,25 @@ +From 4243cf67bcdf8c3865efbfe19dc8841c88ab2daa Mon Sep 17 00:00:00 2001 +From: "Luke A. Guest" +Date: Sun, 25 Sep 2016 15:30:26 +0100 +Subject: [PATCH 01/14] Find correct System.map + +--- + pre-build.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pre-build.sh b/pre-build.sh +index 95457bd..169ccf0 100755 +--- a/pre-build.sh ++++ b/pre-build.sh +@@ -27,7 +27,7 @@ source amd/backport/symbols + + echo '// auto generated by DKMS pre-build.sh' > amd/backport/symbols.c + for sym in $SYMS; do +- addr=$(grep $sym /boot/System.map-$KERNELVER | awk -F' ' '{print $1}') ++ addr=$(grep $sym /boot/System.map*-$KERNELVER | awk -F' ' '{print $1}') + echo "void *$sym = (void *)0x$addr;" >> amd/backport/symbols.c + done + +-- +2.10.1 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0002-Fix-kernel-module-install-location.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0002-Fix-kernel-module-install-location.patch new file mode 100644 index 000000000000..be8868835563 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0002-Fix-kernel-module-install-location.patch @@ -0,0 +1,25 @@ +From c1860b4e8c2ebb784a07d6ba067c510950e67d24 Mon Sep 17 00:00:00 2001 +From: "Luke A. Guest" +Date: Sun, 25 Sep 2016 15:31:13 +0100 +Subject: [PATCH 02/14] Fix kernel module install location + +--- + dkms.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dkms.conf b/dkms.conf +index d1a5e1d..0e03f08 100644 +--- a/dkms.conf ++++ b/dkms.conf +@@ -2,7 +2,7 @@ PACKAGE_NAME="amdgpu-pro" + PACKAGE_VERSION="16.40-348864" + BUILT_MODULE_NAME[0]="amdgpu" + BUILT_MODULE_LOCATION[0]="amd/amdgpu" +-DEST_MODULE_LOCATION[0]="/extra" ++DEST_MODULE_LOCATION[0]="/kernel/drivers/gpu/drm/amd/amdgpu" + AUTOINSTALL="yes" + PRE_BUILD="pre-build.sh $kernelver" + REMAKE_INITRD="yes" +-- +2.10.1 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0002-Remove-dependency-on-System.map.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0002-Remove-dependency-on-System.map.patch deleted file mode 100644 index 3e36e9166bb3..000000000000 --- a/pkgs/os-specific/linux/amdgpu-pro/patches/0002-Remove-dependency-on-System.map.patch +++ /dev/null @@ -1,112 +0,0 @@ -From e03fd9f392af963a534dd3c40df06e81976766e6 Mon Sep 17 00:00:00 2001 -From: David McFarland -Date: Wed, 26 Oct 2016 22:26:39 -0300 -Subject: [PATCH 2/2] Remove dependency on System.map - ---- - amd/backport/Makefile | 3 +-- - amd/backport/kcl_fence.c | 10 ++++++++-- - amd/backport/symbols | 3 --- - dkms.conf | 1 - - pre-build.sh | 32 -------------------------------- - 5 files changed, 9 insertions(+), 40 deletions(-) - delete mode 100644 amd/backport/symbols - delete mode 100755 pre-build.sh - -diff --git a/amd/backport/Makefile b/amd/backport/Makefile -index dcc94d5..ef27e94 100644 ---- a/amd/backport/Makefile -+++ b/amd/backport/Makefile -@@ -55,10 +55,9 @@ ccflags-y += -DOS_NAME_RHEL_7 - endif - endif - --BACKPORT_OBJS = symbols.o - endif - --BACKPORT_OBJS += kcl_drm.o kcl_ttm.o kcl_amdgpu.o kcl_fence.o kcl_mn.o -+BACKPORT_OBJS = kcl_drm.o kcl_ttm.o kcl_amdgpu.o kcl_fence.o kcl_mn.o - - amdgpu-y += $(addprefix ../backport/,$(BACKPORT_OBJS)) - -diff --git a/amd/backport/kcl_fence.c b/amd/backport/kcl_fence.c -index 2141eef..ceef1fe 100644 ---- a/amd/backport/kcl_fence.c -+++ b/amd/backport/kcl_fence.c -@@ -22,8 +22,14 @@ struct default_wait_cb { - struct task_struct *task; - }; - --extern void --(*fence_default_wait_cb)(struct fence *fence, struct fence_cb *cb); -+static void -+fence_default_wait_cb(struct fence *fence, struct fence_cb *cb) -+{ -+ struct default_wait_cb *wait = -+ container_of(cb, struct default_wait_cb, base); -+ -+ wake_up_process(wait->task); -+} - - signed long - _kcl_fence_wait_any_timeout(struct fence **fences, uint32_t count, -diff --git a/amd/backport/symbols b/amd/backport/symbols -deleted file mode 100644 -index 2d3f2ee..0000000 ---- a/amd/backport/symbols -+++ /dev/null -@@ -1,3 +0,0 @@ --SYMS="" -- --SYMS+="fence_default_wait_cb" -diff --git a/dkms.conf b/dkms.conf -index f553501..e50ec3d 100644 ---- a/dkms.conf -+++ b/dkms.conf -@@ -4,4 +4,3 @@ BUILT_MODULE_NAME[0]="amdgpu" - BUILT_MODULE_LOCATION[0]="amd/amdgpu" - DEST_MODULE_LOCATION[0]="/kernel/drivers/gpu/drm/amd/amdgpu" - AUTOINSTALL="yes" --PRE_BUILD="pre-build.sh $kernelver" -\ No newline at end of file -diff --git a/pre-build.sh b/pre-build.sh -deleted file mode 100755 -index 6f45523..0000000 ---- a/pre-build.sh -+++ /dev/null -@@ -1,32 +0,0 @@ --#!/bin/bash -- --KERNELVER=$1 --KERNELVER_BASE=${KERNELVER%%-*} -- --version_lt () { -- newest=$((echo "$1"; echo "$2") | sort -V | tail -n1) -- [ "$1" != "$newest" ] --} -- --version_ge () { -- newest=$((echo "$1"; echo "$2") | sort -V | tail -n1) -- [ "$1" = "$newest" ] --} -- --version_gt () { -- oldest=$((echo "$1"; echo "$2") | sort -V | head -n1) -- [ "$1" != "$oldest" ] --} -- --version_le () { -- oldest=$((echo "$1"; echo "$2") | sort -V | head -n1) -- [ "$1" = "$oldest" ] --} -- --source amd/backport/symbols -- --echo '// auto generated by DKMS pre-build.sh' > amd/backport/symbols.c --for sym in $SYMS; do -- addr=$(grep $sym /boot/System.map*-$KERNELVER | awk -F' ' '{print $1}') -- echo "void *$sym = (void *)0x$addr;" >> amd/backport/symbols.c --done --- -2.10.0 - diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0003-Add-Gentoo-as-build-option.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0003-Add-Gentoo-as-build-option.patch new file mode 100644 index 000000000000..d8b0f289d849 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0003-Add-Gentoo-as-build-option.patch @@ -0,0 +1,30 @@ +From c26c7670869e02c39c0d0f6dee9094a621f42252 Mon Sep 17 00:00:00 2001 +From: "Luke A. Guest" +Date: Sun, 25 Sep 2016 15:31:49 +0100 +Subject: [PATCH 03/14] Add Gentoo as build option + +--- + amd/backport/Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/amd/backport/Makefile b/amd/backport/Makefile +index 0c285ef..dcc94d5 100644 +--- a/amd/backport/Makefile ++++ b/amd/backport/Makefile +@@ -17,8 +17,13 @@ else ifeq ("ubuntu",$(OS_NAME)) + ccflags-y += -DOS_NAME_UBUNTU + else ifeq ("steamos",$(OS_NAME)) + ccflags-y += -DOS_NAME_STEAMOS ++else ifeq ("gentoo",$(OS_NAME)) ++ccflags-y += -DOS_NAME_GENTOO ++# We don't have a version inside /etc/os-release. ++OS_VERSION = "0.0" + else + ccflags-y += -DOS_NAME_UNKNOWN ++OS_VERSION = "0.0" + endif + + ccflags-y += \ +-- +2.10.1 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0004-Remove-extra-parameter-from-ttm_bo_reserve-for-4.7.0.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0004-Remove-extra-parameter-from-ttm_bo_reserve-for-4.7.0.patch new file mode 100644 index 000000000000..794da9b5fb71 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0004-Remove-extra-parameter-from-ttm_bo_reserve-for-4.7.0.patch @@ -0,0 +1,28 @@ +From d21e811c6f26674a0e1c2398dce6d247a1dd4918 Mon Sep 17 00:00:00 2001 +From: "Luke A. Guest" +Date: Sun, 25 Sep 2016 15:46:58 +0100 +Subject: [PATCH 04/14] Remove extra parameter from ttm_bo_reserve for 4.7.0 + +--- + amd/backport/include/kcl/kcl_ttm.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/amd/backport/include/kcl/kcl_ttm.h b/amd/backport/include/kcl/kcl_ttm.h +index 05c444b..c5a602c 100644 +--- a/amd/backport/include/kcl/kcl_ttm.h ++++ b/amd/backport/include/kcl/kcl_ttm.h +@@ -106,7 +106,11 @@ static inline int kcl_ttm_bo_reserve(struct ttm_buffer_object *bo, + struct ww_acquire_ctx *ticket) + { + #if defined(BUILD_AS_DKMS) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ return ttm_bo_reserve(bo, interruptible, no_wait, ticket); ++#else + return ttm_bo_reserve(bo, interruptible, no_wait, false, ticket); ++#endif + #else + return ttm_bo_reserve(bo, interruptible, no_wait, ticket); + #endif +-- +2.10.1 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0005-Remove-first-param-from-drm_gem_object_lookup.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0005-Remove-first-param-from-drm_gem_object_lookup.patch new file mode 100644 index 000000000000..94cb3e72ed56 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0005-Remove-first-param-from-drm_gem_object_lookup.patch @@ -0,0 +1,196 @@ +From 4ac701dce0a4139e89c80237fc4eaa65f48c6f07 Mon Sep 17 00:00:00 2001 +From: "Luke A. Guest" +Date: Sun, 25 Sep 2016 15:53:50 +0100 +Subject: [PATCH 05/14] Remove first param from drm_gem_object_lookup + +--- + amd/amdgpu/amdgpu_bo_list.c | 4 ++++ + amd/amdgpu/amdgpu_cs.c | 4 ++++ + amd/amdgpu/amdgpu_display.c | 4 ++++ + amd/amdgpu/amdgpu_gem.c | 20 ++++++++++++++++++++ + amd/amdgpu/dce_v10_0.c | 4 ++++ + amd/amdgpu/dce_v11_0.c | 4 ++++ + amd/amdgpu/dce_v8_0.c | 4 ++++ + amd/dal/amdgpu_dm/amdgpu_dm_types.c | 4 ++++ + 8 files changed, 48 insertions(+) + +diff --git a/amd/amdgpu/amdgpu_bo_list.c b/amd/amdgpu/amdgpu_bo_list.c +index 844214d..7ae09cf 100644 +--- a/amd/amdgpu/amdgpu_bo_list.c ++++ b/amd/amdgpu/amdgpu_bo_list.c +@@ -107,7 +107,11 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev, + struct amdgpu_bo *bo; + struct mm_struct *usermm; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ gobj = drm_gem_object_lookup(filp, info[i].bo_handle); ++#else + gobj = drm_gem_object_lookup(adev->ddev, filp, info[i].bo_handle); ++#endif + if (!gobj) { + r = -ENOENT; + goto error_free; +diff --git a/amd/amdgpu/amdgpu_cs.c b/amd/amdgpu/amdgpu_cs.c +index 20f6ab2..22363ab 100644 +--- a/amd/amdgpu/amdgpu_cs.c ++++ b/amd/amdgpu/amdgpu_cs.c +@@ -92,8 +92,12 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p, + { + struct drm_gem_object *gobj; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ gobj = drm_gem_object_lookup(p->filp, data->handle); ++#else + gobj = drm_gem_object_lookup(p->adev->ddev, p->filp, + data->handle); ++#endif + if (gobj == NULL) + return -EINVAL; + +diff --git a/amd/amdgpu/amdgpu_display.c b/amd/amdgpu/amdgpu_display.c +index 96c4fa5..862611c 100644 +--- a/amd/amdgpu/amdgpu_display.c ++++ b/amd/amdgpu/amdgpu_display.c +@@ -601,7 +601,11 @@ amdgpu_user_framebuffer_create(struct drm_device *dev, + struct amdgpu_framebuffer *amdgpu_fb; + int ret; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]); ++#else + obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); ++#endif + if (obj == NULL) { + dev_err(&dev->pdev->dev, "No GEM object associated to handle 0x%08X, " + "can't create framebuffer\n", mode_cmd->handles[0]); +diff --git a/amd/amdgpu/amdgpu_gem.c b/amd/amdgpu/amdgpu_gem.c +index 0069aec..6da025b 100644 +--- a/amd/amdgpu/amdgpu_gem.c ++++ b/amd/amdgpu/amdgpu_gem.c +@@ -397,7 +397,11 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp, + struct drm_gem_object *gobj; + struct amdgpu_bo *robj; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ gobj = drm_gem_object_lookup(filp, handle); ++#else + gobj = drm_gem_object_lookup(dev, filp, handle); ++#endif + if (gobj == NULL) { + return -ENOENT; + } +@@ -461,7 +465,11 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data, + int r = 0; + long ret; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ gobj = drm_gem_object_lookup(filp, handle); ++#else + gobj = drm_gem_object_lookup(dev, filp, handle); ++#endif + if (gobj == NULL) { + return -ENOENT; + } +@@ -495,7 +503,11 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data, + int r = -1; + + DRM_DEBUG("%d \n", args->handle); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ gobj = drm_gem_object_lookup(filp, args->handle); ++#else + gobj = drm_gem_object_lookup(dev, filp, args->handle); ++#endif + if (gobj == NULL) + return -ENOENT; + robj = gem_to_amdgpu_bo(gobj); +@@ -643,7 +655,11 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, + return -EINVAL; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ gobj = drm_gem_object_lookup(filp, args->handle); ++#else + gobj = drm_gem_object_lookup(dev, filp, args->handle); ++#endif + if (gobj == NULL) + return -ENOENT; + rbo = gem_to_amdgpu_bo(gobj); +@@ -705,7 +721,11 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data, + struct amdgpu_bo *robj; + int r; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ gobj = drm_gem_object_lookup(filp, args->handle); ++#else + gobj = drm_gem_object_lookup(dev, filp, args->handle); ++#endif + if (gobj == NULL) { + return -ENOENT; + } +diff --git a/amd/amdgpu/dce_v10_0.c b/amd/amdgpu/dce_v10_0.c +index 3fae88d..0fd1e4f 100644 +--- a/amd/amdgpu/dce_v10_0.c ++++ b/amd/amdgpu/dce_v10_0.c +@@ -2594,7 +2594,11 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc, + return -EINVAL; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ obj = drm_gem_object_lookup(file_priv, handle); ++#else + obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); ++#endif + if (!obj) { + DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, amdgpu_crtc->crtc_id); + return -ENOENT; +diff --git a/amd/amdgpu/dce_v11_0.c b/amd/amdgpu/dce_v11_0.c +index fe87795..a85eb5f 100644 +--- a/amd/amdgpu/dce_v11_0.c ++++ b/amd/amdgpu/dce_v11_0.c +@@ -2604,7 +2604,11 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc, + return -EINVAL; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ obj = drm_gem_object_lookup(file_priv, handle); ++#else + obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); ++#endif + if (!obj) { + DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, amdgpu_crtc->crtc_id); + return -ENOENT; +diff --git a/amd/amdgpu/dce_v8_0.c b/amd/amdgpu/dce_v8_0.c +index 1f5959b..308f5e4 100644 +--- a/amd/amdgpu/dce_v8_0.c ++++ b/amd/amdgpu/dce_v8_0.c +@@ -2448,7 +2448,11 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc, + return -EINVAL; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ obj = drm_gem_object_lookup(file_priv, handle); ++#else + obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); ++#endif + if (!obj) { + DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, amdgpu_crtc->crtc_id); + return -ENOENT; +diff --git a/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/amd/dal/amdgpu_dm/amdgpu_dm_types.c +index d14c96f..a9de2e5 100644 +--- a/amd/dal/amdgpu_dm/amdgpu_dm_types.c ++++ b/amd/dal/amdgpu_dm/amdgpu_dm_types.c +@@ -156,7 +156,11 @@ static int dm_crtc_pin_cursor_bo_new( + + amdgpu_crtc = to_amdgpu_crtc(crtc); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ obj = drm_gem_object_lookup(file_priv, handle); ++#else + obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); ++#endif + + if (!obj) { + DRM_ERROR( +-- +2.10.1 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0006-Remove-vblank_disable_allowed-assignment.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0006-Remove-vblank_disable_allowed-assignment.patch new file mode 100644 index 000000000000..dc35fe4c96af --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0006-Remove-vblank_disable_allowed-assignment.patch @@ -0,0 +1,26 @@ +From d4a070e6d68ff7ce8ac49c6135acc759c9a1cf6e Mon Sep 17 00:00:00 2001 +From: "Luke A. Guest" +Date: Sun, 25 Sep 2016 16:01:43 +0100 +Subject: [PATCH 06/14] Remove vblank_disable_allowed assignment + +--- + amd/amdgpu/amdgpu_irq.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/amd/amdgpu/amdgpu_irq.c b/amd/amdgpu/amdgpu_irq.c +index 6e85e69..71358c9 100644 +--- a/amd/amdgpu/amdgpu_irq.c ++++ b/amd/amdgpu/amdgpu_irq.c +@@ -240,7 +240,9 @@ int amdgpu_irq_init(struct amdgpu_device *adev) + INIT_WORK(&adev->hotplug_work, + amdgpu_hotplug_work_func); + } ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) + adev->ddev->vblank_disable_allowed = true; ++#endif + + INIT_WORK(&adev->reset_work, amdgpu_irq_reset_work_func); + +-- +2.10.1 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0007-Fix-__drm_atomic_helper_connector_destroy_state-call.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0007-Fix-__drm_atomic_helper_connector_destroy_state-call.patch new file mode 100644 index 000000000000..9e8749a31ca6 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0007-Fix-__drm_atomic_helper_connector_destroy_state-call.patch @@ -0,0 +1,28 @@ +From 406bb3a83b51b2bcf61a972721aa116e69c0a771 Mon Sep 17 00:00:00 2001 +From: "Luke A. Guest" +Date: Sun, 25 Sep 2016 16:10:27 +0100 +Subject: [PATCH 07/14] Fix __drm_atomic_helper_connector_destroy_state call + +--- + amd/dal/amdgpu_dm/amdgpu_dm_types.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/amd/dal/amdgpu_dm/amdgpu_dm_types.c +index a9de2e5..fedf490 100644 +--- a/amd/dal/amdgpu_dm/amdgpu_dm_types.c ++++ b/amd/dal/amdgpu_dm/amdgpu_dm_types.c +@@ -1224,7 +1224,11 @@ void amdgpu_dm_connector_atomic_destroy_state( + struct dm_connector_state *dm_state = + to_dm_connector_state(state); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) ++ __drm_atomic_helper_connector_destroy_state(connector->state); ++#else + __drm_atomic_helper_connector_destroy_state(connector, state); ++#endif + + kfree(dm_state); + } +-- +2.10.1 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0008-Change-seq_printf-format-for-64-bit-context.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0008-Change-seq_printf-format-for-64-bit-context.patch new file mode 100644 index 000000000000..827237a5f9ad --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0008-Change-seq_printf-format-for-64-bit-context.patch @@ -0,0 +1,30 @@ +From f268e7fa537fd8e12f4023803df795b2e29747e7 Mon Sep 17 00:00:00 2001 +From: "Luke A. Guest" +Date: Sun, 25 Sep 2016 16:46:39 +0100 +Subject: [PATCH 08/14] Change seq_printf format for 64 bit context + +--- + amd/amdgpu/amdgpu_sa.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/amd/amdgpu/amdgpu_sa.c b/amd/amdgpu/amdgpu_sa.c +index 768a265..51d118e 100644 +--- a/amd/amdgpu/amdgpu_sa.c ++++ b/amd/amdgpu/amdgpu_sa.c +@@ -428,8 +428,13 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager, + soffset, eoffset, eoffset - soffset); + + if (i->fence) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ seq_printf(m, " protected by 0x%08x on context %llu", ++ i->fence->seqno, i->fence->context); ++#else + seq_printf(m, " protected by 0x%08x on context %d", + i->fence->seqno, i->fence->context); ++#endif + + seq_printf(m, "\n"); + } +-- +2.10.1 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0009-Fix-vblank-calls.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0009-Fix-vblank-calls.patch new file mode 100644 index 000000000000..82db5905a459 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0009-Fix-vblank-calls.patch @@ -0,0 +1,135 @@ +From 9da98ec93816277a2d4e93d3205da044bace08bc Mon Sep 17 00:00:00 2001 +From: "Luke A. Guest" +Date: Sun, 25 Sep 2016 16:49:09 +0100 +Subject: [PATCH 09/14] Fix vblank calls + +--- + amd/amdgpu/amdgpu_display.c | 8 ++++++++ + amd/amdgpu/dce_v10_0.c | 8 ++++++++ + amd/amdgpu/dce_v11_0.c | 8 ++++++++ + amd/amdgpu/dce_v8_0.c | 8 ++++++++ + amd/dal/amdgpu_dm/amdgpu_dm.c | 4 ++++ + 5 files changed, 36 insertions(+) + +diff --git a/amd/amdgpu/amdgpu_display.c b/amd/amdgpu/amdgpu_display.c +index 862611c..267c65f 100644 +--- a/amd/amdgpu/amdgpu_display.c ++++ b/amd/amdgpu/amdgpu_display.c +@@ -268,7 +268,11 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc, + + work->base = base; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ r = drm_crtc_vblank_get(crtc); ++#else + r = drm_vblank_get(crtc->dev, amdgpu_crtc->crtc_id); ++#endif + if (r) { + DRM_ERROR("failed to get vblank before flip\n"); + goto pflip_cleanup; +@@ -296,7 +300,11 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc, + return 0; + + vblank_cleanup: ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ drm_crtc_vblank_put(&amdgpu_crtc->base); ++#else + drm_vblank_put(crtc->dev, amdgpu_crtc->crtc_id); ++#endif + + pflip_cleanup: + if (unlikely(amdgpu_bo_reserve(new_rbo, false) != 0)) { +diff --git a/amd/amdgpu/dce_v10_0.c b/amd/amdgpu/dce_v10_0.c +index 0fd1e4f..5f0044c 100644 +--- a/amd/amdgpu/dce_v10_0.c ++++ b/amd/amdgpu/dce_v10_0.c +@@ -3372,11 +3372,19 @@ static int dce_v10_0_pageflip_irq(struct amdgpu_device *adev, + + /* wakeup usersapce */ + if (works->event) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ drm_crtc_send_vblank_event(&amdgpu_crtc->base, works->event); ++#else + drm_send_vblank_event(adev->ddev, crtc_id, works->event); ++#endif + + spin_unlock_irqrestore(&adev->ddev->event_lock, flags); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ drm_crtc_vblank_put(&amdgpu_crtc->base); ++#else + drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id); ++#endif + schedule_work(&works->unpin_work); + + return 0; +diff --git a/amd/amdgpu/dce_v11_0.c b/amd/amdgpu/dce_v11_0.c +index a85eb5f..8edc670 100644 +--- a/amd/amdgpu/dce_v11_0.c ++++ b/amd/amdgpu/dce_v11_0.c +@@ -3432,11 +3432,19 @@ static int dce_v11_0_pageflip_irq(struct amdgpu_device *adev, + + /* wakeup usersapce */ + if(works->event) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ drm_crtc_send_vblank_event(&amdgpu_crtc->base, works->event); ++#else + drm_send_vblank_event(adev->ddev, crtc_id, works->event); ++#endif + + spin_unlock_irqrestore(&adev->ddev->event_lock, flags); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ drm_crtc_vblank_put(&amdgpu_crtc->base); ++#else + drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id); ++#endif + schedule_work(&works->unpin_work); + + return 0; +diff --git a/amd/amdgpu/dce_v8_0.c b/amd/amdgpu/dce_v8_0.c +index 308f5e4..57e8014 100644 +--- a/amd/amdgpu/dce_v8_0.c ++++ b/amd/amdgpu/dce_v8_0.c +@@ -3323,11 +3323,19 @@ static int dce_v8_0_pageflip_irq(struct amdgpu_device *adev, + + /* wakeup usersapce */ + if (works->event) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ drm_crtc_send_vblank_event(&amdgpu_crtc->base, works->event); ++#else + drm_send_vblank_event(adev->ddev, crtc_id, works->event); ++#endif + + spin_unlock_irqrestore(&adev->ddev->event_lock, flags); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ drm_crtc_vblank_put(&amdgpu_crtc->base); ++#else + drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id); ++#endif + schedule_work(&works->unpin_work); + + return 0; +diff --git a/amd/dal/amdgpu_dm/amdgpu_dm.c b/amd/dal/amdgpu_dm/amdgpu_dm.c +index 30865ec..f49999b 100644 +--- a/amd/dal/amdgpu_dm/amdgpu_dm.c ++++ b/amd/dal/amdgpu_dm/amdgpu_dm.c +@@ -196,10 +196,14 @@ static void dm_pflip_high_irq(void *interrupt_params) + + /* wakeup usersapce */ + if(works->event) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ drm_crtc_send_vblank_event(&amdgpu_crtc->base, works->event); ++#else + drm_send_vblank_event( + adev->ddev, + amdgpu_crtc->crtc_id, + works->event); ++#endif + + spin_unlock_irqrestore(&adev->ddev->event_lock, flags); + +-- +2.10.1 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0010-Fix-crtc_gamma-functions-for-4.8.0.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0010-Fix-crtc_gamma-functions-for-4.8.0.patch new file mode 100644 index 000000000000..b11ab3e557e2 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0010-Fix-crtc_gamma-functions-for-4.8.0.patch @@ -0,0 +1,163 @@ +From b41eafa282a003cde9729e2ff486f55dc54f12c6 Mon Sep 17 00:00:00 2001 +From: "Luke A. Guest" +Date: Sun, 25 Sep 2016 16:56:47 +0100 +Subject: [PATCH 10/14] Fix crtc_gamma functions for 4.8.0 + +--- + amd/amdgpu/dce_v10_0.c | 19 +++++++++++++++++++ + amd/amdgpu/dce_v11_0.c | 19 +++++++++++++++++++ + amd/amdgpu/dce_v8_0.c | 19 +++++++++++++++++++ + amd/dal/amdgpu_dm/amdgpu_dm_types.c | 12 ++++++++++++ + 4 files changed, 69 insertions(+) + +diff --git a/amd/amdgpu/dce_v10_0.c b/amd/amdgpu/dce_v10_0.c +index 5f0044c..85378aa 100644 +--- a/amd/amdgpu/dce_v10_0.c ++++ b/amd/amdgpu/dce_v10_0.c +@@ -2671,6 +2671,24 @@ static void dce_v10_0_cursor_reset(struct drm_crtc *crtc) + } + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++static int dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, ++ u16 *blue, uint32_t size) ++{ ++ struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); ++ int i; ++ ++ /* userspace palettes are always correct as is */ ++ for (i = 0; i < size; i++) { ++ amdgpu_crtc->lut_r[i] = red[i] >> 6; ++ amdgpu_crtc->lut_g[i] = green[i] >> 6; ++ amdgpu_crtc->lut_b[i] = blue[i] >> 6; ++ } ++ dce_v10_0_crtc_load_lut(crtc); ++ ++ return 0; ++} ++#else + static void dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, + u16 *blue, uint32_t start, uint32_t size) + { +@@ -2685,6 +2703,7 @@ static void dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green + } + dce_v10_0_crtc_load_lut(crtc); + } ++#endif + + static void dce_v10_0_crtc_destroy(struct drm_crtc *crtc) + { +diff --git a/amd/amdgpu/dce_v11_0.c b/amd/amdgpu/dce_v11_0.c +index 8edc670..0129543 100644 +--- a/amd/amdgpu/dce_v11_0.c ++++ b/amd/amdgpu/dce_v11_0.c +@@ -2681,6 +2681,24 @@ static void dce_v11_0_cursor_reset(struct drm_crtc *crtc) + } + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++static int dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, ++ u16 *blue, uint32_t size) ++{ ++ struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); ++ int i; ++ ++ /* userspace palettes are always correct as is */ ++ for (i = 0; i < size; i++) { ++ amdgpu_crtc->lut_r[i] = red[i] >> 6; ++ amdgpu_crtc->lut_g[i] = green[i] >> 6; ++ amdgpu_crtc->lut_b[i] = blue[i] >> 6; ++ } ++ dce_v11_0_crtc_load_lut(crtc); ++ ++ return 0; ++} ++#else + static void dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, + u16 *blue, uint32_t start, uint32_t size) + { +@@ -2695,6 +2713,7 @@ static void dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green + } + dce_v11_0_crtc_load_lut(crtc); + } ++#endif + + static void dce_v11_0_crtc_destroy(struct drm_crtc *crtc) + { +diff --git a/amd/amdgpu/dce_v8_0.c b/amd/amdgpu/dce_v8_0.c +index 57e8014..d0d9267 100644 +--- a/amd/amdgpu/dce_v8_0.c ++++ b/amd/amdgpu/dce_v8_0.c +@@ -2525,6 +2525,24 @@ static void dce_v8_0_cursor_reset(struct drm_crtc *crtc) + } + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++static int dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, ++ u16 *blue, uint32_t size) ++{ ++ struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); ++ int i; ++ ++ /* userspace palettes are always correct as is */ ++ for (i = 0; i < size; i++) { ++ amdgpu_crtc->lut_r[i] = red[i] >> 6; ++ amdgpu_crtc->lut_g[i] = green[i] >> 6; ++ amdgpu_crtc->lut_b[i] = blue[i] >> 6; ++ } ++ dce_v8_0_crtc_load_lut(crtc); ++ ++ return 0; ++} ++#else + static void dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, + u16 *blue, uint32_t start, uint32_t size) + { +@@ -2539,6 +2557,7 @@ static void dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, + } + dce_v8_0_crtc_load_lut(crtc); + } ++#endif + + static void dce_v8_0_crtc_destroy(struct drm_crtc *crtc) + { +diff --git a/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/amd/dal/amdgpu_dm/amdgpu_dm_types.c +index fedf490..c1f3c27 100644 +--- a/amd/dal/amdgpu_dm/amdgpu_dm_types.c ++++ b/amd/dal/amdgpu_dm/amdgpu_dm_types.c +@@ -995,6 +995,13 @@ void amdgpu_dm_crtc_destroy(struct drm_crtc *crtc) + kfree(crtc); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++static int amdgpu_dm_atomic_crtc_gamma_set(struct drm_crtc *crtc, ++ u16 *red, ++ u16 *green, ++ u16 *blue, ++ uint32_t size) ++#else + static void amdgpu_dm_atomic_crtc_gamma_set( + struct drm_crtc *crtc, + u16 *red, +@@ -1002,6 +1009,7 @@ static void amdgpu_dm_atomic_crtc_gamma_set( + u16 *blue, + uint32_t start, + uint32_t size) ++#endif + { + struct drm_device *dev = crtc->dev; + struct drm_property *prop = dev->mode_config.prop_crtc_id; +@@ -1009,6 +1017,10 @@ static void amdgpu_dm_atomic_crtc_gamma_set( + crtc->state->mode.private_flags |= AMDGPU_CRTC_MODE_PRIVATE_FLAGS_GAMMASET; + + drm_atomic_helper_crtc_set_property(crtc, prop, 0); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ return 0; ++#endif + } + + static int dm_crtc_funcs_atomic_set_property( +-- +2.10.1 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0011-Fix-drm_atomic_helper_swap_state-for-4.8.0.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0011-Fix-drm_atomic_helper_swap_state-for-4.8.0.patch new file mode 100644 index 000000000000..d205fc3189ce --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0011-Fix-drm_atomic_helper_swap_state-for-4.8.0.patch @@ -0,0 +1,28 @@ +From 32422de1ddaf539d284b32de5fe43d07b7553499 Mon Sep 17 00:00:00 2001 +From: "Luke A. Guest" +Date: Sun, 25 Sep 2016 17:00:32 +0100 +Subject: [PATCH 11/14] Fix drm_atomic_helper_swap_state for 4.8.0 + +--- + amd/dal/amdgpu_dm/amdgpu_dm_types.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/amd/dal/amdgpu_dm/amdgpu_dm_types.c +index c1f3c27..60cba1a 100644 +--- a/amd/dal/amdgpu_dm/amdgpu_dm_types.c ++++ b/amd/dal/amdgpu_dm/amdgpu_dm_types.c +@@ -2331,7 +2331,11 @@ int amdgpu_dm_atomic_commit( + * the software side now. + */ + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ drm_atomic_helper_swap_state(state, true); ++#else + drm_atomic_helper_swap_state(dev, state); ++#endif + + /* + * From this point state become old state really. New state is +-- +2.10.1 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0012-Add-extra-flag-to-ttm_bo_move_ttm-for-4.8.0-rc2.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0012-Add-extra-flag-to-ttm_bo_move_ttm-for-4.8.0-rc2.patch new file mode 100644 index 000000000000..77b0cf796401 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0012-Add-extra-flag-to-ttm_bo_move_ttm-for-4.8.0-rc2.patch @@ -0,0 +1,40 @@ +From 69207f061e13e6f02418d5706d230135abcc1a72 Mon Sep 17 00:00:00 2001 +From: "Luke A. Guest" +Date: Sun, 25 Sep 2016 19:19:45 +0100 +Subject: [PATCH 12/14] Add extra flag to ttm_bo_move_ttm for >=4.8.0-rc2 + +--- + amd/amdgpu/amdgpu_ttm.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/amd/amdgpu/amdgpu_ttm.c b/amd/amdgpu/amdgpu_ttm.c +index 145732a..dd691fa 100644 +--- a/amd/amdgpu/amdgpu_ttm.c ++++ b/amd/amdgpu/amdgpu_ttm.c +@@ -344,7 +344,11 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, + if (unlikely(r)) { + goto out_cleanup; + } ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ r = ttm_bo_move_ttm(bo, true, interruptible, no_wait_gpu, new_mem); ++#else + r = ttm_bo_move_ttm(bo, true, no_wait_gpu, new_mem); ++#endif + out_cleanup: + ttm_bo_mem_put(bo, &tmp_mem); + return r; +@@ -377,7 +381,11 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, + if (unlikely(r)) { + return r; + } ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ r = ttm_bo_move_ttm(bo, true, interruptible, no_wait_gpu, &tmp_mem); ++#else + r = ttm_bo_move_ttm(bo, true, no_wait_gpu, &tmp_mem); ++#endif + if (unlikely(r)) { + goto out_cleanup; + } +-- +2.10.1 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0013-Remove-dependency-on-System.map.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0013-Remove-dependency-on-System.map.patch new file mode 100644 index 000000000000..23a648e0d522 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0013-Remove-dependency-on-System.map.patch @@ -0,0 +1,61 @@ +From 115cdb5a06b112674d9652ef44d7f19583ff0136 Mon Sep 17 00:00:00 2001 +From: David McFarland +Date: Wed, 26 Oct 2016 22:26:39 -0300 +Subject: [PATCH 13/14] Remove dependency on System.map + +--- + amd/backport/Makefile | 3 +-- + amd/backport/kcl_fence.c | 10 ++++++++-- + amd/backport/symbols | 3 --- + 3 files changed, 9 insertions(+), 7 deletions(-) + delete mode 100644 amd/backport/symbols + +diff --git a/amd/backport/Makefile b/amd/backport/Makefile +index dcc94d5..ef27e94 100644 +--- a/amd/backport/Makefile ++++ b/amd/backport/Makefile +@@ -55,10 +55,9 @@ ccflags-y += -DOS_NAME_RHEL_7 + endif + endif + +-BACKPORT_OBJS = symbols.o + endif + +-BACKPORT_OBJS += kcl_drm.o kcl_ttm.o kcl_amdgpu.o kcl_fence.o kcl_mn.o ++BACKPORT_OBJS = kcl_drm.o kcl_ttm.o kcl_amdgpu.o kcl_fence.o kcl_mn.o + + amdgpu-y += $(addprefix ../backport/,$(BACKPORT_OBJS)) + +diff --git a/amd/backport/kcl_fence.c b/amd/backport/kcl_fence.c +index 8c697aa..85d96d3 100644 +--- a/amd/backport/kcl_fence.c ++++ b/amd/backport/kcl_fence.c +@@ -25,8 +25,14 @@ struct default_wait_cb { + struct task_struct *task; + }; + +-extern void +-(*fence_default_wait_cb)(struct fence *fence, struct fence_cb *cb); ++static void ++fence_default_wait_cb(struct fence *fence, struct fence_cb *cb) ++{ ++ struct default_wait_cb *wait = ++ container_of(cb, struct default_wait_cb, base); ++ ++ wake_up_process(wait->task); ++} + + signed long + _kcl_fence_wait_any_timeout(struct fence **fences, uint32_t count, +diff --git a/amd/backport/symbols b/amd/backport/symbols +deleted file mode 100644 +index 2d3f2ee..0000000 +--- a/amd/backport/symbols ++++ /dev/null +@@ -1,3 +0,0 @@ +-SYMS="" +- +-SYMS+="fence_default_wait_cb" +-- +2.10.1 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-dal-by-default.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0014-disable-dal-by-default.patch similarity index 79% rename from pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-dal-by-default.patch rename to pkgs/os-specific/linux/amdgpu-pro/patches/0014-disable-dal-by-default.patch index 05bcbf8bd061..693985ec2a2d 100644 --- a/pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-dal-by-default.patch +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0014-disable-dal-by-default.patch @@ -1,14 +1,14 @@ -From 49d45957ddaafe13a9cc7bacd1b9665fe9c517ac Mon Sep 17 00:00:00 2001 +From 942064886eae63ed7aa0a63c07e9f175898dddf7 Mon Sep 17 00:00:00 2001 From: David McFarland Date: Thu, 25 Aug 2016 22:17:06 -0300 -Subject: [PATCH] disable dal by default +Subject: [PATCH 14/14] disable dal by default --- amd/amdgpu/amdgpu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amd/amdgpu/amdgpu_drv.c b/amd/amdgpu/amdgpu_drv.c -index 793528b..9a4dfcc 100644 +index 66f3242..df62815 100644 --- a/amd/amdgpu/amdgpu_drv.c +++ b/amd/amdgpu/amdgpu_drv.c @@ -79,7 +79,7 @@ int amdgpu_vm_block_size = -1; @@ -21,5 +21,5 @@ index 793528b..9a4dfcc 100644 int amdgpu_sched_hw_submission = 2; int amdgpu_powerplay = -1; -- -2.9.3 +2.10.1