Merge #19936: vulkan / amdgpu-pro update

This commit is contained in:
Vladimír Čunát 2016-11-13 19:55:50 +01:00
commit 1ac5869907
No known key found for this signature in database
GPG Key ID: E747DF1F9575A3AA
28 changed files with 1035 additions and 579 deletions

View File

@ -118,6 +118,7 @@ in
"/share/terminfo"
"/share/themes"
"/share/vim-plugins"
"/share/vulkan"
];
system.path = pkgs.buildEnv {

View File

@ -135,6 +135,12 @@ in
environment.sessionVariables.LD_LIBRARY_PATH =
[ "/run/opengl-driver/lib" "/run/opengl-driver-32/lib" ];
environment.extraInit = ''
export XDG_DATA_DIRS=$XDG_DATA_DIRS:/run/opengl-driver/share
'' + optionalString cfg.driSupport32Bit ''
export XDG_DATA_DIRS=$XDG_DATA_DIRS:/run/opengl-driver-32/share
'';
hardware.opengl.package = mkDefault (makePackage pkgs);
hardware.opengl.package32 = mkDefault (makePackage pkgs_i686);

View File

@ -45,10 +45,8 @@ in
"amd/amdapfxx.blb".source = package + "/etc/amd/amdapfxx.blb";
"gbm/gbm.conf".source = package + "/etc/gbm/gbm.conf";
"OpenCL/vendors/amdocl64.icd".source = package + "/etc/OpenCL/vendors/amdocl64.icd";
"vulkan/icd.d/amd_icd64.json".source = package + "/etc/vulkan/icd.d/amd_icd64.json";
} // optionalAttrs opengl.driSupport32Bit {
"OpenCL/vendors/amdocl32.icd".source = package32 + "/etc/OpenCL/vendors/amdocl32.icd";
"vulkan/icd.d/amd_icd32.json".source = package32 + "/etc/vulkan/icd.d/amd_icd32.json";
};
};

View File

@ -1,8 +1,6 @@
{ stdenv, fetchgit, fetchFromGitHub, cmake, pkgconfig, git, python3,
python3Packages, glslang, spirv-tools, x11, libxcb, wayland }:
assert stdenv.system == "x86_64-linux";
let
version = "1.0.26.0";
src = fetchFromGitHub {
@ -11,7 +9,6 @@ let
rev = "sdk-${version}";
sha256 = "157m746hc76xrxd3qq0f44f5dy7pjbz8cx74ykqrlbc7rmpjpk58";
};
getRev = name: builtins.substring 0 40 (builtins.readFile "${src}/${name}_revision");
in
stdenv.mkDerivation rec {
@ -37,13 +34,33 @@ stdenv.mkDerivation rec {
"-DBUILD_WSI_WAYLAND_SUPPORT=ON" # XLIB/XCB supported by default
];
installPhase = ''
mkdir -p $out/lib
mkdir -p $out/bin
cp loader/libvulkan.so* $out/lib
cp demos/vulkaninfo $out/bin
patches = [ ./use-xdg-paths.patch ];
outputs = [ "out" "dev" "demos" ];
preConfigure = ''
checkRev() {
[ "$2" = $(cat "$1_revision") ] || (echo "ERROR: dependency $1 is revision $2 but should be revision" $(cat "$1_revision") && exit 1)
}
checkRev spirv-tools "${spirv-tools.src.rev}"
checkRev spirv-headers "${spirv-tools.headers.rev}"
checkRev glslang "${glslang.src.rev}"
'';
installPhase = ''
mkdir -p $out/lib $out/bin
cp -d loader/libvulkan.so* $out/lib
cp demos/vulkaninfo $out/bin
mkdir -p $out/lib $out/share/vulkan/explicit_layer.d
cp -d layers/*.so $out/lib/
cp -d layers/*.json $out/share/vulkan/explicit_layer.d/
sed -i "s:\\./lib:$out/lib/lib:g" "$out/share/vulkan/"*/*.json
mkdir -p $dev/include
cp -rv ../include $dev/
mkdir -p $demos/bin
cp demos/smoketest demos/tri demos/cube demos/*.spv demos/*.ppm $demos/bin
'';
meta = with stdenv.lib; {
description = "LunarG Vulkan loader";
homepage = http://www.lunarg.com;

View File

@ -0,0 +1,142 @@
diff --git a/loader/loader.c b/loader/loader.c
index a950ea1..9462d05 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -2671,6 +2671,94 @@ static VkResult loader_get_manifest_files(
}
}
+#if !defined(_WIN32)
+ if (home_location && override == NULL) {
+ char *xdgconfdirs = secure_getenv("XDG_CONFIG_DIRS");
+ char *xdgdatadirs = secure_getenv("XDG_DATA_DIRS");
+ char *cur, *src = loc;
+ size_t src_size = strlen(src), rel_size = strlen(home_location);
+ size_t size = 0;
+
+ if (src_size > 0)
+ size += src_size + 1;
+
+ if (xdgconfdirs == NULL)
+ xdgconfdirs = "/etc/xdg";
+ if (xdgdatadirs == NULL)
+ xdgdatadirs = "/usr/local/share:/usr/share";
+
+ for (char *x = xdgconfdirs; *x; ++x)
+ if (*x == PATH_SEPERATOR) size += rel_size;
+ size += strlen(xdgconfdirs) + rel_size + 1;
+ for (char *x = xdgdatadirs; *x; ++x)
+ if (*x == PATH_SEPERATOR) size += rel_size;
+ size += strlen(xdgdatadirs) + rel_size + 1;
+
+#if defined(LOCALPREFIX)
+ size += strlen(LOCALPREFIX "/" SYSCONFDIR) + rel_size + 1;
+ size += strlen(LOCALPREFIX "/" DATADIR) + rel_size + 1;
+#endif
+
+ loc = cur = loader_stack_alloc(size);
+ if (cur == NULL) {
+ loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
+ "Out of memory can't get manifest files");
+ res = VK_ERROR_OUT_OF_HOST_MEMORY;
+ goto out;
+ }
+
+ if (src_size > 0) {
+ memcpy(cur, src, src_size);
+ cur += src_size;
+ *cur++ = PATH_SEPERATOR;
+ }
+
+ src = xdgconfdirs;
+ for (char *x = src;; ++x) {
+ if (*x == PATH_SEPERATOR || *x == 0) {
+ size_t s = x - src;
+ memcpy(cur, src, s); cur += s;
+ memcpy(cur, home_location, rel_size); cur += rel_size;
+ *cur++ = PATH_SEPERATOR;
+ if (*x == 0)
+ break;
+ src = ++x;
+ }
+ }
+
+#if defined(LOCALPREFIX)
+ strcpy(cur, LOCALPREFIX "/" SYSCONFDIR);
+ cur += strlen(cur);
+ memcpy(cur, home_location, rel_size); cur += rel_size;
+ *cur++ = PATH_SEPERATOR;
+#endif
+
+ src = xdgdatadirs;
+ for (char *x = src;; ++x) {
+ if (*x == PATH_SEPERATOR || *x == 0) {
+ size_t s = x - src;
+ memcpy(cur, src, s); cur += s;
+ memcpy(cur, home_location, rel_size); cur += rel_size;
+ *cur++ = PATH_SEPERATOR;
+ if (*x == 0)
+ break;
+ src = ++x;
+ }
+ }
+
+#if defined(LOCALPREFIX)
+ strcpy(cur, LOCALPREFIX "/" DATADIR);
+ cur += strlen(cur);
+ memcpy(cur, home_location, rel_size); cur += rel_size;
+ *cur++ = PATH_SEPERATOR;
+#endif
+
+ loc[size - 1] = 0;
+ assert(cur == loc + size);
+ list_is_dirs = true;
+ }
+#endif
+
// Print out the paths being searched if debugging is enabled
loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0,
"Searching the following paths for manifest files: %s\n", loc);
diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h
index 3a02640..70a2652 100644
--- a/loader/vk_loader_platform.h
+++ b/loader/vk_loader_platform.h
@@ -57,35 +57,10 @@
#define VULKAN_ILAYERCONF_DIR "implicit_layer.d"
#define VULKAN_LAYER_DIR "layer"
-#if defined(LOCALPREFIX)
-#define LOCAL_DRIVERS_INFO \
- LOCALPREFIX "/" SYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR ":" \
- LOCALPREFIX "/" DATADIR VULKAN_DIR VULKAN_ICDCONF_DIR ":"
-#define LOCAL_ELAYERS_INFO \
- LOCALPREFIX "/" SYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR ":" \
- LOCALPREFIX "/" DATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR ":"
-#define LOCAL_ILAYERS_INFO \
- LOCALPREFIX "/" SYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR ":" \
- LOCALPREFIX "/" DATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR ":"
-#else
-#define LOCAL_DRIVERS_INFO
-#define LOCAL_ELAYERS_INFO
-#define LOCAL_ILAYERS_INFO
-#endif
-
-#define DEFAULT_VK_DRIVERS_INFO \
- LOCAL_DRIVERS_INFO \
- "/" SYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR ":" \
- "/usr/" DATADIR VULKAN_DIR VULKAN_ICDCONF_DIR
+#define DEFAULT_VK_DRIVERS_INFO ""
#define DEFAULT_VK_DRIVERS_PATH ""
-#define DEFAULT_VK_ELAYERS_INFO \
- LOCAL_ELAYERS_INFO \
- "/" SYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR ":" \
- "/usr/" DATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR
-#define DEFAULT_VK_ILAYERS_INFO \
- LOCAL_ILAYERS_INFO \
- "/" SYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR ":" \
- "/usr/" DATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR
+#define DEFAULT_VK_ELAYERS_INFO ""
+#define DEFAULT_VK_ILAYERS_INFO ""
#define DEFAULT_VK_LAYERS_PATH ""
#if !defined(LAYERS_SOURCE_PATH)
#define LAYERS_SOURCE_PATH NULL

View File

@ -1,6 +1,7 @@
{ stdenv, fetchurl, elfutils, mesa_noglu
, xorg, patchelf, openssl, libdrm, libudev
, libxcb, libxshmfence, epoxy, perl, zlib
, fetchFromGitHub, ncurses
, libsOnly ? false, kernel ? null
}:
@ -25,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}";
@ -37,9 +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";
"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" ];
@ -50,26 +53,34 @@ 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-OS-detection-for-arch.patch
./patches/0002-update-kcl_ttm_bo_reserve-for-linux-4.7.patch
./patches/0003-add-kcl_drm_gem_object_lookup.patch
./patches/0004-paging-changes-for-linux-4.6.patch
./patches/0005-LRU-stuff-isn-t-available-until-4.7.x.patch
./patches/0006-Change-name-of-vblank_disable_allowed-to-vblank_disa.patch
./patches/0007-Remove-connector-parameter-from-__drm_atomic_helper_.patch
./patches/0008-fix-apparent-typo-in-bandwidth_calcs-causing-array-e.patch
./patches/0009-disable-dal-by-default.patch
./patches/0010-remove-dependency-on-System.map.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 $modulePatches; do echo $patch; patch -p1 < $patch; done
for patch in $modulePatches
do
echo $patch
patch -f -p1 < $patch || true
done
popd
'';
@ -86,54 +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 etc $out/etc
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 usr/share $out/share
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/etc/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 = [

View File

@ -0,0 +1,25 @@
From 4243cf67bcdf8c3865efbfe19dc8841c88ab2daa Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
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

View File

@ -1,26 +0,0 @@
From e78ede724fff53fc0220999f6381242142ce8c33 Mon Sep 17 00:00:00 2001
From: David McFarland <corngood@gmail.com>
Date: Sun, 21 Aug 2016 16:30:25 -0300
Subject: [PATCH 1/8] add OS detection for arch
---
amd/backport/Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/amd/backport/Makefile b/amd/backport/Makefile
index 0c285ef..6447a15 100644
--- a/amd/backport/Makefile
+++ b/amd/backport/Makefile
@@ -17,6 +17,9 @@ else ifeq ("ubuntu",$(OS_NAME))
ccflags-y += -DOS_NAME_UBUNTU
else ifeq ("steamos",$(OS_NAME))
ccflags-y += -DOS_NAME_STEAMOS
+else ifeq ("arch",$(OS_NAME))
+ccflags-y += -DOS_NAME_ARCH
+OS_VERSION = "0.0"
else
ccflags-y += -DOS_NAME_UNKNOWN
endif
--
2.9.3

View File

@ -0,0 +1,25 @@
From c1860b4e8c2ebb784a07d6ba067c510950e67d24 Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
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

View File

@ -1,25 +0,0 @@
From d84bd62a10308efb6a414e8f6582a7b1e9860638 Mon Sep 17 00:00:00 2001
From: David McFarland <corngood@gmail.com>
Date: Sun, 21 Aug 2016 16:31:12 -0300
Subject: [PATCH 2/8] update kcl_ttm_bo_reserve for linux-4.7
---
amd/backport/include/kcl/kcl_ttm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/amd/backport/include/kcl/kcl_ttm.h b/amd/backport/include/kcl/kcl_ttm.h
index 3575004..0d1560d 100644
--- a/amd/backport/include/kcl/kcl_ttm.h
+++ b/amd/backport/include/kcl/kcl_ttm.h
@@ -84,7 +84,7 @@ static inline int kcl_ttm_bo_reserve(struct ttm_buffer_object *bo,
bool interruptible, bool no_wait,
struct ww_acquire_ctx *ticket)
{
-#if defined(BUILD_AS_DKMS)
+#if defined(BUILD_AS_DKMS) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
return ttm_bo_reserve(bo, interruptible, no_wait, false, ticket);
#else
return ttm_bo_reserve(bo, interruptible, no_wait, ticket);
--
2.9.3

View File

@ -0,0 +1,30 @@
From c26c7670869e02c39c0d0f6dee9094a621f42252 Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
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

View File

@ -1,204 +0,0 @@
From 2637dfe990e4c277bc724f6ba48e6661506805ec Mon Sep 17 00:00:00 2001
From: David McFarland <corngood@gmail.com>
Date: Sun, 21 Aug 2016 16:37:34 -0300
Subject: [PATCH 3/8] add kcl_drm_gem_object_lookup
---
amd/amdgpu/amdgpu_atpx_handler.c | 4 ++++
amd/amdgpu/amdgpu_bo_list.c | 2 +-
amd/amdgpu/amdgpu_cs.c | 2 +-
amd/amdgpu/amdgpu_display.c | 2 +-
amd/amdgpu/amdgpu_gem.c | 10 +++++-----
amd/amdgpu/dce_v10_0.c | 2 +-
amd/amdgpu/dce_v11_0.c | 2 +-
amd/amdgpu/dce_v8_0.c | 2 +-
amd/backport/include/kcl/kcl_drm.h | 11 +++++++++++
amd/dal/amdgpu_dm/amdgpu_dm_types.c | 2 +-
10 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/amd/amdgpu/amdgpu_atpx_handler.c b/amd/amdgpu/amdgpu_atpx_handler.c
index cc9b998..7e47478 100644
--- a/amd/amdgpu/amdgpu_atpx_handler.c
+++ b/amd/amdgpu/amdgpu_atpx_handler.c
@@ -565,7 +565,11 @@ void amdgpu_register_atpx_handler(void)
if (!r)
return;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+ vga_switcheroo_register_handler(&amdgpu_atpx_handler, 0);
+#else
vga_switcheroo_register_handler(&amdgpu_atpx_handler);
+#endif
}
/**
diff --git a/amd/amdgpu/amdgpu_bo_list.c b/amd/amdgpu/amdgpu_bo_list.c
index 35d0856..1d163ec 100644
--- a/amd/amdgpu/amdgpu_bo_list.c
+++ b/amd/amdgpu/amdgpu_bo_list.c
@@ -106,7 +106,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
struct amdgpu_bo *bo;
struct mm_struct *usermm;
- gobj = drm_gem_object_lookup(adev->ddev, filp, info[i].bo_handle);
+ gobj = kcl_drm_gem_object_lookup(adev->ddev, filp, info[i].bo_handle);
if (!gobj) {
r = -ENOENT;
goto error_free;
diff --git a/amd/amdgpu/amdgpu_cs.c b/amd/amdgpu/amdgpu_cs.c
index d16ed26..b0390b5 100644
--- a/amd/amdgpu/amdgpu_cs.c
+++ b/amd/amdgpu/amdgpu_cs.c
@@ -92,7 +92,7 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p,
{
struct drm_gem_object *gobj;
- gobj = drm_gem_object_lookup(p->adev->ddev, p->filp,
+ gobj = kcl_drm_gem_object_lookup(p->adev->ddev, p->filp,
data->handle);
if (gobj == NULL)
return -EINVAL;
diff --git a/amd/amdgpu/amdgpu_display.c b/amd/amdgpu/amdgpu_display.c
index 46326b3..9b5441f 100644
--- a/amd/amdgpu/amdgpu_display.c
+++ b/amd/amdgpu/amdgpu_display.c
@@ -594,7 +594,7 @@ amdgpu_user_framebuffer_create(struct drm_device *dev,
struct amdgpu_framebuffer *amdgpu_fb;
int ret;
- obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]);
+ obj = kcl_drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]);
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..d10c282 100644
--- a/amd/amdgpu/amdgpu_gem.c
+++ b/amd/amdgpu/amdgpu_gem.c
@@ -397,7 +397,7 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp,
struct drm_gem_object *gobj;
struct amdgpu_bo *robj;
- gobj = drm_gem_object_lookup(dev, filp, handle);
+ gobj = kcl_drm_gem_object_lookup(dev, filp, handle);
if (gobj == NULL) {
return -ENOENT;
}
@@ -461,7 +461,7 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
int r = 0;
long ret;
- gobj = drm_gem_object_lookup(dev, filp, handle);
+ gobj = kcl_drm_gem_object_lookup(dev, filp, handle);
if (gobj == NULL) {
return -ENOENT;
}
@@ -495,7 +495,7 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data,
int r = -1;
DRM_DEBUG("%d \n", args->handle);
- gobj = drm_gem_object_lookup(dev, filp, args->handle);
+ gobj = kcl_drm_gem_object_lookup(dev, filp, args->handle);
if (gobj == NULL)
return -ENOENT;
robj = gem_to_amdgpu_bo(gobj);
@@ -643,7 +643,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
return -EINVAL;
}
- gobj = drm_gem_object_lookup(dev, filp, args->handle);
+ gobj = kcl_drm_gem_object_lookup(dev, filp, args->handle);
if (gobj == NULL)
return -ENOENT;
rbo = gem_to_amdgpu_bo(gobj);
@@ -705,7 +705,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,
struct amdgpu_bo *robj;
int r;
- gobj = drm_gem_object_lookup(dev, filp, args->handle);
+ gobj = kcl_drm_gem_object_lookup(dev, filp, args->handle);
if (gobj == NULL) {
return -ENOENT;
}
diff --git a/amd/amdgpu/dce_v10_0.c b/amd/amdgpu/dce_v10_0.c
index 7554dd7..6d38754 100644
--- a/amd/amdgpu/dce_v10_0.c
+++ b/amd/amdgpu/dce_v10_0.c
@@ -2594,7 +2594,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
return -EINVAL;
}
- obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
+ obj = kcl_drm_gem_object_lookup(crtc->dev, file_priv, handle);
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 d9c9b88..93dbc1a 100644
--- a/amd/amdgpu/dce_v11_0.c
+++ b/amd/amdgpu/dce_v11_0.c
@@ -2604,7 +2604,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
return -EINVAL;
}
- obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
+ obj = kcl_drm_gem_object_lookup(crtc->dev, file_priv, handle);
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 7a027ce..c56a298 100644
--- a/amd/amdgpu/dce_v8_0.c
+++ b/amd/amdgpu/dce_v8_0.c
@@ -2501,7 +2501,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
return -EINVAL;
}
- obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
+ obj = kcl_drm_gem_object_lookup(crtc->dev, file_priv, handle);
if (!obj) {
DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, amdgpu_crtc->crtc_id);
return -ENOENT;
diff --git a/amd/backport/include/kcl/kcl_drm.h b/amd/backport/include/kcl/kcl_drm.h
index a65ee25..5a8a7b3 100644
--- a/amd/backport/include/kcl/kcl_drm.h
+++ b/amd/backport/include/kcl/kcl_drm.h
@@ -3,6 +3,7 @@
#include <linux/version.h>
#include <drm/drmP.h>
+#include <drm/drm_gem.h>
#if defined(BUILD_AS_DKMS)
extern int drm_pcie_get_max_link_width(struct drm_device *dev, u32 *mlw);
@@ -123,4 +124,14 @@ static inline int kcl_drm_universal_plane_init(struct drm_device *dev, struct dr
#endif
}
+static inline struct drm_gem_object *kcl_drm_gem_object_lookup(struct drm_device *dev,
+ struct drm_file *filp,
+ u32 handle) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
+ return drm_gem_object_lookup(filp, handle);
+#else
+ return drm_gem_object_lookup(dev, filp, handle);
+#endif
+}
+
#endif /* AMDGPU_BACKPORT_KCL_DRM_H */
diff --git a/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/amd/dal/amdgpu_dm/amdgpu_dm_types.c
index 3f357a5..2e2d2e6 100644
--- a/amd/dal/amdgpu_dm/amdgpu_dm_types.c
+++ b/amd/dal/amdgpu_dm/amdgpu_dm_types.c
@@ -152,7 +152,7 @@ static int dm_crtc_pin_cursor_bo_new(
amdgpu_crtc = to_amdgpu_crtc(crtc);
- obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
+ obj = kcl_drm_gem_object_lookup(crtc->dev, file_priv, handle);
if (!obj) {
DRM_ERROR(
--
2.9.3

View File

@ -0,0 +1,28 @@
From d21e811c6f26674a0e1c2398dce6d247a1dd4918 Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
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

View File

@ -1,42 +0,0 @@
From 2bd83488ccea22bb9e399986c171cccc3b6beb93 Mon Sep 17 00:00:00 2001
From: David McFarland <corngood@gmail.com>
Date: Sun, 21 Aug 2016 16:40:32 -0300
Subject: [PATCH 4/8] paging changes for linux-4.6
---
amd/amdgpu/amdgpu_ttm.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/amd/amdgpu/amdgpu_ttm.c b/amd/amdgpu/amdgpu_ttm.c
index 7bdebde..8b676c2 100644
--- a/amd/amdgpu/amdgpu_ttm.c
+++ b/amd/amdgpu/amdgpu_ttm.c
@@ -548,8 +548,12 @@ int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages)
list_add(&guptask.list, &gtt->guptasks);
spin_unlock(&gtt->guptasklock);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+ r = get_user_pages(userptr, num_pages, write, 0, p, NULL);
+#else
r = get_user_pages(current, current->mm, userptr, num_pages,
- write, 0, p, NULL);
+ write, 0, p, NULL);
+#endif
spin_lock(&gtt->guptasklock);
list_del(&guptask.list);
@@ -625,7 +629,11 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
set_page_dirty(page);
mark_page_accessed(page);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+ put_page(page);
+#else
page_cache_release(page);
+#endif
}
sg_free_table(ttm->sg);
--
2.9.3

View File

@ -1,48 +0,0 @@
From c41c15fa04e363c41272e7b5d767710170691347 Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
Date: Mon, 4 Jul 2016 19:19:45 +0100
Subject: [PATCH 5/8] LRU stuff isn't available until >= 4.7.x
---
amd/amdgpu/amdgpu_ttm.c | 4 ++--
amd/backport/kcl_ttm.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/amd/amdgpu/amdgpu_ttm.c b/amd/amdgpu/amdgpu_ttm.c
index 8b676c2..752d065 100644
--- a/amd/amdgpu/amdgpu_ttm.c
+++ b/amd/amdgpu/amdgpu_ttm.c
@@ -907,7 +907,7 @@ uint32_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
return flags;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
static void amdgpu_ttm_lru_removal(struct ttm_buffer_object *tbo)
{
@@ -969,7 +969,7 @@ static struct ttm_bo_driver amdgpu_bo_driver = {
.fault_reserve_notify = &amdgpu_bo_fault_reserve_notify,
.io_mem_reserve = &amdgpu_ttm_io_mem_reserve,
.io_mem_free = &amdgpu_ttm_io_mem_free,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
.lru_removal = &amdgpu_ttm_lru_removal,
.lru_tail = &amdgpu_ttm_lru_tail,
.swap_lru_tail = &amdgpu_ttm_swap_lru_tail,
diff --git a/amd/backport/kcl_ttm.c b/amd/backport/kcl_ttm.c
index 24f7a83..1a2cb7b 100644
--- a/amd/backport/kcl_ttm.c
+++ b/amd/backport/kcl_ttm.c
@@ -7,7 +7,7 @@ static int _kcl_ttm_bo_del_from_lru(struct ttm_buffer_object *bo)
{
int put_count = 0;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
struct ttm_bo_device *bdev = bo->bdev;
if (bdev->driver->lru_removal)
--
2.9.3

View File

@ -0,0 +1,196 @@
From 4ac701dce0a4139e89c80237fc4eaa65f48c6f07 Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
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

View File

@ -1,29 +0,0 @@
From 5b90b8d8ab44637c707623b25ee98aa4ebded308 Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
Date: Mon, 4 Jul 2016 19:30:08 +0100
Subject: [PATCH 6/8] Change name of vblank_disable_allowed to
vblank_disable_immediate under 4.7.x.
---
amd/amdgpu/amdgpu_irq.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/amd/amdgpu/amdgpu_irq.c b/amd/amdgpu/amdgpu_irq.c
index d13865a..5cfa69f 100644
--- a/amd/amdgpu/amdgpu_irq.c
+++ b/amd/amdgpu/amdgpu_irq.c
@@ -240,7 +240,11 @@ 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_immediate = true;
+#else
adev->ddev->vblank_disable_allowed = true;
+#endif
INIT_WORK(&adev->reset_work, amdgpu_irq_reset_work_func);
--
2.9.3

View File

@ -0,0 +1,26 @@
From d4a070e6d68ff7ce8ac49c6135acc759c9a1cf6e Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
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

View File

@ -1,23 +1,22 @@
From 27ef2ce0d4d8eeb3bca32ddeae503f0a334832aa Mon Sep 17 00:00:00 2001
From 406bb3a83b51b2bcf61a972721aa116e69c0a771 Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
Date: Mon, 4 Jul 2016 19:41:08 +0100
Subject: [PATCH 7/8] Remove connector parameter from
__drm_atomic_helper_connector_destroy_state for 4.7.x kernels.
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 2e2d2e6..cd34607 100644
index a9de2e5..fedf490 100644
--- a/amd/dal/amdgpu_dm/amdgpu_dm_types.c
+++ b/amd/dal/amdgpu_dm/amdgpu_dm_types.c
@@ -1205,7 +1205,11 @@ void amdgpu_dm_connector_atomic_destroy_state(
@@ -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(state);
+ __drm_atomic_helper_connector_destroy_state(connector->state);
+#else
__drm_atomic_helper_connector_destroy_state(connector, state);
+#endif
@ -25,5 +24,5 @@ index 2e2d2e6..cd34607 100644
kfree(dm_state);
}
--
2.9.3
2.10.1

View File

@ -0,0 +1,30 @@
From f268e7fa537fd8e12f4023803df795b2e29747e7 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 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

View File

@ -1,25 +0,0 @@
From c9f2501131da0d9173e21f7e8ff5741a7fcfedb6 Mon Sep 17 00:00:00 2001
From: David McFarland <corngood@gmail.com>
Date: Sun, 21 Aug 2016 16:58:45 -0300
Subject: [PATCH 8/8] fix apparent typo in bandwidth_calcs causing array error
---
amd/dal/dc/calcs/bandwidth_calcs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/amd/dal/dc/calcs/bandwidth_calcs.c b/amd/dal/dc/calcs/bandwidth_calcs.c
index 8a19139..c4ededd 100644
--- a/amd/dal/dc/calcs/bandwidth_calcs.c
+++ b/amd/dal/dc/calcs/bandwidth_calcs.c
@@ -3181,7 +3181,7 @@ static void calculate_bandwidth(
bw_int_to_fixed(
2),
vbios->mcifwrmc_urgent_latency),
- results->dmif_burst_time[i][j]),
+ results->dmif_burst_time[results->y_clk_level][results->sclk_level]),
results->mcifwr_burst_time[results->y_clk_level][results->sclk_level])),
results->dispclk),
bw_int_to_fixed(
--
2.9.3

View File

@ -0,0 +1,135 @@
From 9da98ec93816277a2d4e93d3205da044bace08bc Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
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

View File

@ -0,0 +1,163 @@
From b41eafa282a003cde9729e2ff486f55dc54f12c6 Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
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

View File

@ -1,112 +0,0 @@
From fbc0d704f47526ca38f518b60237962cc6b08305 Mon Sep 17 00:00:00 2001
From: David McFarland <corngood@gmail.com>
Date: Thu, 25 Aug 2016 23:08:02 -0300
Subject: [PATCH] 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 6447a15..4682e0f 100644
--- a/amd/backport/Makefile
+++ b/amd/backport/Makefile
@@ -53,10 +53,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 9ca148e..36be480 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]="/extra"
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 88ec680..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.9.3

View File

@ -0,0 +1,28 @@
From 32422de1ddaf539d284b32de5fe43d07b7553499 Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
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

View File

@ -0,0 +1,40 @@
From 69207f061e13e6f02418d5706d230135abcc1a72 Mon Sep 17 00:00:00 2001
From: "Luke A. Guest" <laguest@archeia.com>
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

View File

@ -0,0 +1,61 @@
From 115cdb5a06b112674d9652ef44d7f19583ff0136 Mon Sep 17 00:00:00 2001
From: David McFarland <corngood@gmail.com>
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

View File

@ -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 <corngood@gmail.com>
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