summary refs log tree commit diff
path: root/pkgs/os-specific/linux/amdgpu-pro/patches
diff options
context:
space:
mode:
authorDavid McFarland <corngood@gmail.com>2017-01-28 17:10:50 -0400
committerDavid McFarland <corngood@gmail.com>2017-02-06 23:16:21 -0400
commit47c166fe0525e06ef833e15b9f543a0f3f342d7d (patch)
treebe50d50fdaae39d38fdeb2c43854a7cc9af2381e /pkgs/os-specific/linux/amdgpu-pro/patches
parent4c22b9529b9a7ac13c50bbac3ca81e450297b998 (diff)
downloadnixpkgs-47c166fe0525e06ef833e15b9f543a0f3f342d7d.tar
nixpkgs-47c166fe0525e06ef833e15b9f543a0f3f342d7d.tar.gz
nixpkgs-47c166fe0525e06ef833e15b9f543a0f3f342d7d.tar.bz2
nixpkgs-47c166fe0525e06ef833e15b9f543a0f3f342d7d.tar.lz
nixpkgs-47c166fe0525e06ef833e15b9f543a0f3f342d7d.tar.xz
nixpkgs-47c166fe0525e06ef833e15b9f543a0f3f342d7d.tar.zst
nixpkgs-47c166fe0525e06ef833e15b9f543a0f3f342d7d.zip
amdgpu-pro: 16.50 -> 16.60
Diffstat (limited to 'pkgs/os-specific/linux/amdgpu-pro/patches')
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0001-Fix-kernel-module-install-location.patch25
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0001-disable-firmware-copy.patch25
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0002-Add-Gentoo-as-build-option.patch30
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0002-linux-4.9-fixes.patch97
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0003-Change-seq_printf-format-for-64-bit-context.patch (renamed from pkgs/os-specific/linux/amdgpu-pro/patches/0004-Change-seq_printf-format-for-64-bit-context.patch)8
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0003-Remove-extra-parameter-from-ttm_bo_reserve-for-4.7.0.patch28
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0004-fix-warnings-for-Werror.patch74
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0005-Fix-vblank-calls.patch136
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0006-Fix-crtc_gamma-functions-for-4.8.0.patch163
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0007-Fix-drm_atomic_helper_swap_state-for-4.8.0.patch28
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0008-Add-extra-flag-to-ttm_bo_move_ttm-for-4.8.0-rc2.patch40
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0009-Remove-dependency-on-System.map.patch61
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0010-disable-dal-by-default.patch25
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0011-kcl-fixes-for-16.50-linux-4.8.patch114
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/patches/0012-use-kernel-fence_array-in-4.8.patch55
15 files changed, 200 insertions, 709 deletions
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0001-Fix-kernel-module-install-location.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0001-Fix-kernel-module-install-location.patch
deleted file mode 100644
index 5af823a9394..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0001-Fix-kernel-module-install-location.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From e787277fd4f43399de2da355b08e478c2a58d589 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 01/11] Fix kernel module install location
-
----
- dkms.conf | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/dkms.conf b/dkms.conf
-index 7f11158..2f080e2 100644
---- a/dkms.conf
-+++ b/dkms.conf
-@@ -2,7 +2,7 @@ PACKAGE_NAME="amdgpu-pro"
- PACKAGE_VERSION="16.50-362463"
- BUILT_MODULE_NAME[0]="amdgpu"
- BUILT_MODULE_LOCATION[0]="amd/amdgpu"
--DEST_MODULE_LOCATION[0]="/updates"
-+DEST_MODULE_LOCATION[0]="/kernel/drivers/gpu/drm/amd/amdgpu"
- AUTOINSTALL="yes"
- PRE_BUILD="pre-build.sh $kernelver"
- 
--- 
-2.11.0
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0001-disable-firmware-copy.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0001-disable-firmware-copy.patch
new file mode 100644
index 00000000000..6803cf03289
--- /dev/null
+++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0001-disable-firmware-copy.patch
@@ -0,0 +1,25 @@
+From ad3f6de6d16ea8ee76635dd39875eeab39def6e9 Mon Sep 17 00:00:00 2001
+From: David McFarland <corngood@gmail.com>
+Date: Sat, 28 Jan 2017 16:57:26 -0400
+Subject: [PATCH 1/4] disable firmware copy
+
+---
+ pre-build.sh | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/pre-build.sh b/pre-build.sh
+index 25e718f..e3cd009 100755
+--- a/pre-build.sh
++++ b/pre-build.sh
+@@ -35,8 +35,3 @@ find ttm -name '*.c' -exec grep EXPORT_SYMBOL {} + \
+     | sort -u \
+     | awk -F'[()]' '{print "#define "$2" amd"$2" //"$0}'\
+     > include/rename_symbol.h
+-
+-FW_DIR="/lib/firmware/$KERNELVER"
+-mkdir -p $FW_DIR
+-cp -ar /usr/src/amdgpu-pro-16.60-379184/firmware/radeon $FW_DIR
+-cp -ar /usr/src/amdgpu-pro-16.60-379184/firmware/amdgpu $FW_DIR
+-- 
+2.11.0
+
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0002-Add-Gentoo-as-build-option.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0002-Add-Gentoo-as-build-option.patch
deleted file mode 100644
index be627992c06..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0002-Add-Gentoo-as-build-option.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From da51551f671be3282b6f69ef76e495b169a5dc3f 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 02/11] 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 a6ab7fe..ff9339d 100644
---- a/amd/backport/Makefile
-+++ b/amd/backport/Makefile
-@@ -22,8 +22,13 @@ else ifeq ("sled",$(OS_NAME))
- ccflags-y += -DOS_NAME_SLE
- else ifeq ("sles",$(OS_NAME))
- ccflags-y += -DOS_NAME_SLE
-+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.11.0
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0002-linux-4.9-fixes.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0002-linux-4.9-fixes.patch
new file mode 100644
index 00000000000..86dbea29e08
--- /dev/null
+++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0002-linux-4.9-fixes.patch
@@ -0,0 +1,97 @@
+From 52e47be93c7a492730477f590e5eb42e035018bd Mon Sep 17 00:00:00 2001
+From: David McFarland <corngood@gmail.com>
+Date: Sun, 29 Jan 2017 18:23:47 -0400
+Subject: [PATCH 2/4] linux-4.9 fixes
+
+---
+ amd/amdgpu/amdgpu_connectors.c          | 8 ++++++++
+ amd/amdgpu/amdgpu_ttm.c                 | 4 ++++
+ amd/display/amdgpu_dm/amdgpu_dm_types.c | 8 ++++++++
+ include/kcl/kcl_mm.h                    | 4 +++-
+ 4 files changed, 23 insertions(+), 1 deletion(-)
+
+diff --git a/amd/amdgpu/amdgpu_connectors.c b/amd/amdgpu/amdgpu_connectors.c
+index 1b51981..4b43379 100644
+--- a/amd/amdgpu/amdgpu_connectors.c
++++ b/amd/amdgpu/amdgpu_connectors.c
+@@ -168,12 +168,20 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector)
+ 		}
+ 
+ 		/* Any defined maximum tmds clock limit we must not exceed? */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
++		if (connector->display_info.max_tmds_clock > 0) {
++#else
+ 		if (connector->max_tmds_clock > 0) {
++#endif
+ 			/* mode_clock is clock in kHz for mode to be modeset on this connector */
+ 			mode_clock = amdgpu_connector->pixelclock_for_modeset;
+ 
+ 			/* Maximum allowable input clock in kHz */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
++			max_tmds_clock = connector->display_info.max_tmds_clock * 1000;
++#else
+ 			max_tmds_clock = connector->max_tmds_clock * 1000;
++#endif
+ 
+ 			DRM_DEBUG("%s: hdmi mode dotclock %d kHz, max tmds input clock %d kHz.\n",
+ 				  connector->name, mode_clock, max_tmds_clock);
+diff --git a/amd/amdgpu/amdgpu_ttm.c b/amd/amdgpu/amdgpu_ttm.c
+index 447529d..252bab4 100644
+--- a/amd/amdgpu/amdgpu_ttm.c
++++ b/amd/amdgpu/amdgpu_ttm.c
+@@ -255,7 +255,11 @@ static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp)
+ 
+ 	if (amdgpu_ttm_tt_get_usermm(bo->ttm))
+ 		return -EPERM;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
++	return drm_vma_node_verify_access(&abo->gem_base.vma_node, filp->private_data);
++#else
+ 	return drm_vma_node_verify_access(&abo->gem_base.vma_node, filp);
++#endif
+ }
+ 
+ static void amdgpu_move_null(struct ttm_buffer_object *bo,
+diff --git a/amd/display/amdgpu_dm/amdgpu_dm_types.c b/amd/display/amdgpu_dm/amdgpu_dm_types.c
+index be7aafb..5e11f26 100644
+--- a/amd/display/amdgpu_dm/amdgpu_dm_types.c
++++ b/amd/display/amdgpu_dm/amdgpu_dm_types.c
+@@ -1692,6 +1692,10 @@ static int dm_plane_helper_prepare_fb(
+ 	struct drm_plane *plane,
+ 	struct drm_framebuffer *fb,
+ 	const struct drm_plane_state *new_state)
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
++static int dm_plane_helper_prepare_fb(
++	struct drm_plane *plane,
++	struct drm_plane_state *new_state)
+ #else
+ static int dm_plane_helper_prepare_fb(
+ 	struct drm_plane *plane,
+@@ -1735,6 +1739,10 @@ static void dm_plane_helper_cleanup_fb(
+ 	struct drm_plane *plane,
+ 	struct drm_framebuffer *fb,
+ 	const struct drm_plane_state *old_state)
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
++static void dm_plane_helper_cleanup_fb(
++	struct drm_plane *plane,
++	struct drm_plane_state *old_state)
+ #else
+ static void dm_plane_helper_cleanup_fb(
+ 	struct drm_plane *plane,
+diff --git a/include/kcl/kcl_mm.h b/include/kcl/kcl_mm.h
+index a18936d..f068195 100644
+--- a/include/kcl/kcl_mm.h
++++ b/include/kcl/kcl_mm.h
+@@ -8,7 +8,9 @@ static inline int kcl_get_user_pages(struct task_struct *tsk, struct mm_struct *
+                                      int write, int force, struct page **pages,
+                                      struct vm_area_struct **vmas)
+ {
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
++        return get_user_pages(start, nr_pages, write ? FOLL_WRITE : 0, pages, vmas);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+         return get_user_pages(start, nr_pages, write, force, pages, vmas);
+ #else
+         return get_user_pages(tsk, mm, start, nr_pages,
+-- 
+2.11.0
+
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0004-Change-seq_printf-format-for-64-bit-context.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0003-Change-seq_printf-format-for-64-bit-context.patch
index 925a92e2a7e..6856b9ae092 100644
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0004-Change-seq_printf-format-for-64-bit-context.patch
+++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0003-Change-seq_printf-format-for-64-bit-context.patch
@@ -1,17 +1,17 @@
-From 084b2915e6876d8fdb913938569c0ce7ffef65bc Mon Sep 17 00:00:00 2001
+From cc490c71a98b6bbe390fcf777fbe0360d01bf4ca 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 04/11] Change seq_printf format for 64 bit context
+Subject: [PATCH 3/4] Change seq_printf format for 64 bit context
 
 ---
  amd/amdgpu/amdgpu_sa.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/amd/amdgpu/amdgpu_sa.c b/amd/amdgpu/amdgpu_sa.c
-index 052f745..5886b9a 100644
+index c43f582..8c4b9f7 100644
 --- a/amd/amdgpu/amdgpu_sa.c
 +++ b/amd/amdgpu/amdgpu_sa.c
-@@ -428,7 +428,7 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager,
+@@ -427,7 +427,7 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager,
  			   soffset, eoffset, eoffset - soffset);
  
  		if (i->fence)
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0003-Remove-extra-parameter-from-ttm_bo_reserve-for-4.7.0.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0003-Remove-extra-parameter-from-ttm_bo_reserve-for-4.7.0.patch
deleted file mode 100644
index ae5b62b1d23..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0003-Remove-extra-parameter-from-ttm_bo_reserve-for-4.7.0.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 999a30883f34c4603c3b747a58a89d4924583769 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 03/11] 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 6e5a170..52cdbc8 100644
---- a/amd/backport/include/kcl/kcl_ttm.h
-+++ b/amd/backport/include/kcl/kcl_ttm.h
-@@ -113,7 +113,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.11.0
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0004-fix-warnings-for-Werror.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0004-fix-warnings-for-Werror.patch
new file mode 100644
index 00000000000..d226504c4e4
--- /dev/null
+++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0004-fix-warnings-for-Werror.patch
@@ -0,0 +1,74 @@
+From 9970f3107aed7b2b1ff1c5f29129b62cec99980d Mon Sep 17 00:00:00 2001
+From: David McFarland <corngood@gmail.com>
+Date: Mon, 6 Feb 2017 22:13:49 -0400
+Subject: [PATCH 4/4] fix warnings for Werror
+
+---
+ amd/amdgpu/amdgpu_kms.c                 | 2 +-
+ amd/amdgpu/amdgpu_ttm.c                 | 2 ++
+ amd/display/amdgpu_dm/amdgpu_dm.c       | 2 +-
+ amd/display/amdgpu_dm/amdgpu_dm_types.c | 2 +-
+ 4 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/amd/amdgpu/amdgpu_kms.c b/amd/amdgpu/amdgpu_kms.c
+index b7b51ae..bc884f6 100644
+--- a/amd/amdgpu/amdgpu_kms.c
++++ b/amd/amdgpu/amdgpu_kms.c
+@@ -591,7 +591,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
+ 
+ 			bios = adev->bios + bios_offset;
+ 			return copy_to_user(out, bios,
+-				min((size_t)size, bios_size - bios_offset))
++				min(size, bios_size - bios_offset))
+ 					? -EFAULT : 0;
+ 		}
+ 		default:
+diff --git a/amd/amdgpu/amdgpu_ttm.c b/amd/amdgpu/amdgpu_ttm.c
+index 252bab4..90f3655 100644
+--- a/amd/amdgpu/amdgpu_ttm.c
++++ b/amd/amdgpu/amdgpu_ttm.c
+@@ -1083,6 +1083,7 @@ uint32_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
+ 	return flags;
+ }
+ 
++#if 0
+ static void amdgpu_ttm_lru_removal(struct ttm_buffer_object *tbo)
+ {
+ 	struct amdgpu_device *adev = amdgpu_ttm_adev(tbo->bdev);
+@@ -1132,6 +1133,7 @@ static struct list_head *amdgpu_ttm_swap_lru_tail(struct ttm_buffer_object *tbo)
+ 
+ 	return res;
+ }
++#endif
+ 
+ static struct ttm_bo_driver amdgpu_bo_driver = {
+ 	.ttm_tt_create = &amdgpu_ttm_tt_create,
+diff --git a/amd/display/amdgpu_dm/amdgpu_dm.c b/amd/display/amdgpu_dm/amdgpu_dm.c
+index 3dcb619..5700861 100644
+--- a/amd/display/amdgpu_dm/amdgpu_dm.c
++++ b/amd/display/amdgpu_dm/amdgpu_dm.c
+@@ -121,7 +121,7 @@ static bool dm_check_soft_reset(void *handle)
+ 
+ static int dm_soft_reset(void *handle)
+ {
+-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
++	/* struct amdgpu_device *adev = (struct amdgpu_device *)handle; */
+ 
+ 	/* XXX todo */
+ 	return 0;
+diff --git a/amd/display/amdgpu_dm/amdgpu_dm_types.c b/amd/display/amdgpu_dm/amdgpu_dm_types.c
+index 5e11f26..7039542 100644
+--- a/amd/display/amdgpu_dm/amdgpu_dm_types.c
++++ b/amd/display/amdgpu_dm/amdgpu_dm_types.c
+@@ -913,7 +913,7 @@ static void decide_crtc_timing_for_drm_display_mode(
+ }
+ 
+ static struct dc_target *create_target_for_sink(
+-		const struct amdgpu_connector *aconnector,
++		struct amdgpu_connector *aconnector,
+ 		const struct drm_display_mode *drm_mode,
+ 		const struct dm_connector_state *dm_state)
+ {
+-- 
+2.11.0
+
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0005-Fix-vblank-calls.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0005-Fix-vblank-calls.patch
deleted file mode 100644
index 99b54aca2ab..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0005-Fix-vblank-calls.patch
+++ /dev/null
@@ -1,136 +0,0 @@
-From 1884ef3a813f3dac0029c7539654ba978635d5d3 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 05/11] Fix vblank calls
-
----
- amd/amdgpu/amdgpu_display.c   | 8 ++++++++
- amd/amdgpu/dce_v10_0.c        | 4 ++++
- amd/amdgpu/dce_v11_0.c        | 4 ++++
- amd/amdgpu/dce_v8_0.c         | 4 ++++
- amd/amdgpu/dce_virtual.c      | 8 ++++++++
- amd/dal/amdgpu_dm/amdgpu_dm.c | 4 ++++
- 6 files changed, 32 insertions(+)
-
-diff --git a/amd/amdgpu/amdgpu_display.c b/amd/amdgpu/amdgpu_display.c
-index 8425b1d..d6cd383 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_abo, false) != 0)) {
-diff --git a/amd/amdgpu/dce_v10_0.c b/amd/amdgpu/dce_v10_0.c
-index 650d193..b1880ac 100644
---- a/amd/amdgpu/dce_v10_0.c
-+++ b/amd/amdgpu/dce_v10_0.c
-@@ -3342,7 +3342,11 @@ static int dce_v10_0_pageflip_irq(struct amdgpu_device *adev,
- 
- 	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 ca03d8e..b654b64 100644
---- a/amd/amdgpu/dce_v11_0.c
-+++ b/amd/amdgpu/dce_v11_0.c
-@@ -3391,7 +3391,11 @@ static int dce_v11_0_pageflip_irq(struct amdgpu_device *adev,
- 
- 	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 8e4dff7..b598caa 100644
---- a/amd/amdgpu/dce_v8_0.c
-+++ b/amd/amdgpu/dce_v8_0.c
-@@ -3252,7 +3252,11 @@ static int dce_v8_0_pageflip_irq(struct amdgpu_device *adev,
- 
- 	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_virtual.c b/amd/amdgpu/dce_virtual.c
-index 0c6e873..36e2094 100644
---- a/amd/amdgpu/dce_virtual.c
-+++ b/amd/amdgpu/dce_virtual.c
-@@ -746,11 +746,19 @@ static int dce_virtual_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 c5fcf5a..e9892d8 100644
---- a/amd/dal/amdgpu_dm/amdgpu_dm.c
-+++ b/amd/dal/amdgpu_dm/amdgpu_dm.c
-@@ -213,10 +213,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.11.0
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0006-Fix-crtc_gamma-functions-for-4.8.0.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0006-Fix-crtc_gamma-functions-for-4.8.0.patch
deleted file mode 100644
index 566b7039bb3..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0006-Fix-crtc_gamma-functions-for-4.8.0.patch
+++ /dev/null
@@ -1,163 +0,0 @@
-From 12660ae02838f99c0784194908f7a189bc2ab0ae 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 06/11] 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 b1880ac..53746fa 100644
---- a/amd/amdgpu/dce_v10_0.c
-+++ b/amd/amdgpu/dce_v10_0.c
-@@ -2627,6 +2627,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)
- {
-@@ -2641,6 +2659,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 b654b64..3edd66d 100644
---- a/amd/amdgpu/dce_v11_0.c
-+++ b/amd/amdgpu/dce_v11_0.c
-@@ -2643,6 +2643,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)
- {
-@@ -2657,6 +2675,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 b598caa..d203894 100644
---- a/amd/amdgpu/dce_v8_0.c
-+++ b/amd/amdgpu/dce_v8_0.c
-@@ -2478,6 +2478,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)
- {
-@@ -2492,6 +2510,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 edc8e86..32755a9 100644
---- a/amd/dal/amdgpu_dm/amdgpu_dm_types.c
-+++ b/amd/dal/amdgpu_dm/amdgpu_dm_types.c
-@@ -998,6 +998,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,
-@@ -1005,6 +1012,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;
-@@ -1012,6 +1020,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.11.0
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0007-Fix-drm_atomic_helper_swap_state-for-4.8.0.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0007-Fix-drm_atomic_helper_swap_state-for-4.8.0.patch
deleted file mode 100644
index 197fdd32b10..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0007-Fix-drm_atomic_helper_swap_state-for-4.8.0.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 7a5d45874b1e2bbbff2d2410f38203b5b0ae67c4 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 07/11] 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 32755a9..60ca073 100644
---- a/amd/dal/amdgpu_dm/amdgpu_dm_types.c
-+++ b/amd/dal/amdgpu_dm/amdgpu_dm_types.c
-@@ -2528,7 +2528,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.11.0
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0008-Add-extra-flag-to-ttm_bo_move_ttm-for-4.8.0-rc2.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0008-Add-extra-flag-to-ttm_bo_move_ttm-for-4.8.0-rc2.patch
deleted file mode 100644
index 8674c3537e8..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0008-Add-extra-flag-to-ttm_bo_move_ttm-for-4.8.0-rc2.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 7c536e8b9f73926014c0622eb101f2cf174b507b 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 08/11] 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 89760f8..d102224 100644
---- a/amd/amdgpu/amdgpu_ttm.c
-+++ b/amd/amdgpu/amdgpu_ttm.c
-@@ -428,7 +428,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;
-@@ -461,7 +465,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.11.0
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0009-Remove-dependency-on-System.map.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0009-Remove-dependency-on-System.map.patch
deleted file mode 100644
index 52c5f7f4593..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0009-Remove-dependency-on-System.map.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 4d645984264e449d6a4507af033b26daed952eac Mon Sep 17 00:00:00 2001
-From: David McFarland <corngood@gmail.com>
-Date: Wed, 26 Oct 2016 22:26:39 -0300
-Subject: [PATCH 09/11] Remove dependency on System.map
-
----
- amd/backport/Makefile    |  1 -
- amd/backport/kcl_fence.c | 10 ++++++++--
- amd/backport/symbols     |  7 -------
- 3 files changed, 8 insertions(+), 10 deletions(-)
- delete mode 100644 amd/backport/symbols
-
-diff --git a/amd/backport/Makefile b/amd/backport/Makefile
-index ff9339d..3f2d9ea 100644
---- a/amd/backport/Makefile
-+++ b/amd/backport/Makefile
-@@ -64,7 +64,6 @@ ccflags-y += -DOS_NAME_RHEL_7_3
- endif
- endif
- 
--BACKPORT_OBJS = symbols.o
- endif
- 
- BACKPORT_OBJS += kcl_drm.o kcl_ttm.o kcl_amdgpu.o kcl_fence.o kcl_mn.o amdgpu_kcl.o kcl_fence_array.o kcl_kthread.o
-diff --git a/amd/backport/kcl_fence.c b/amd/backport/kcl_fence.c
-index 54ad819..39f6d61 100644
---- a/amd/backport/kcl_fence.c
-+++ b/amd/backport/kcl_fence.c
-@@ -52,8 +52,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 68cae63..0000000
---- a/amd/backport/symbols
-+++ /dev/null
-@@ -1,7 +0,0 @@
--SYMS=""
--
--SYMS+="fence_default_wait_cb"
--
--if version_lt 2.6.33; then
--    SYMS+=" kallsyms_lookup_name"
--fi
--- 
-2.11.0
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0010-disable-dal-by-default.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0010-disable-dal-by-default.patch
deleted file mode 100644
index e69e5c58319..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0010-disable-dal-by-default.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 5ab8e5e36634391a5c440bf78463226b2074485e Mon Sep 17 00:00:00 2001
-From: David McFarland <corngood@gmail.com>
-Date: Thu, 25 Aug 2016 22:17:06 -0300
-Subject: [PATCH 10/11] 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 d6b3f35..4477865 100755
---- a/amd/amdgpu/amdgpu_drv.c
-+++ b/amd/amdgpu/amdgpu_drv.c
-@@ -88,7 +88,7 @@ int amdgpu_vm_fault_stop = 0;
- int amdgpu_vm_debug = 0;
- int amdgpu_vram_page_split = -1;
- int amdgpu_exp_hw_support = 0;
--int amdgpu_dal = -1;
-+int amdgpu_dal = 0;
- int amdgpu_sched_jobs = 32;
- int amdgpu_sched_hw_submission = 2;
- int amdgpu_powerplay = -1;
--- 
-2.11.0
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0011-kcl-fixes-for-16.50-linux-4.8.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0011-kcl-fixes-for-16.50-linux-4.8.patch
deleted file mode 100644
index 0cf3ad262f6..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0011-kcl-fixes-for-16.50-linux-4.8.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 156445f6eda047ee5a5d6e4bde36c3e9ccbbd7d9 Mon Sep 17 00:00:00 2001
-From: David McFarland <corngood@gmail.com>
-Date: Thu, 29 Dec 2016 14:20:06 -0400
-Subject: [PATCH 11/11] kcl fixes for 16.50 + linux-4.8
-
----
- amd/amdgpu/dce_v6_0.c              |  5 +++--
- amd/amdgpu/dce_virtual.c           |  5 +++--
- amd/backport/include/kcl/kcl_drm.h | 12 ++++++++++++
- amd/backport/include/kcl/kcl_ttm.h |  2 +-
- amd/backport/kcl_drm.c             |  4 ++++
- 5 files changed, 23 insertions(+), 5 deletions(-)
-
-diff --git a/amd/amdgpu/dce_v6_0.c b/amd/amdgpu/dce_v6_0.c
-index fd3eeb0..1f1874c 100644
---- a/amd/amdgpu/dce_v6_0.c
-+++ b/amd/amdgpu/dce_v6_0.c
-@@ -1946,9 +1946,9 @@ static void dce_v6_0_cursor_reset(struct drm_crtc *crtc)
- 	}
- }
- 
--static void dce_v6_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
--				    u16 *blue, uint32_t start, uint32_t size)
-+static kcl_crtc_gamma_set_callback(dce_v6_0_crtc_gamma_set)
- {
-+  kcl_crtc_gamma_set_pre
- 	struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
- 	int end = (start + size > 256) ? 256 : start + size, i;
- 
-@@ -1959,6 +1959,7 @@ static void dce_v6_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
- 		amdgpu_crtc->lut_b[i] = blue[i] >> 6;
- 	}
- 	dce_v6_0_crtc_load_lut(crtc);
-+  kcl_crtc_gamma_set_suf
- }
- 
- static void dce_v6_0_crtc_destroy(struct drm_crtc *crtc)
-diff --git a/amd/amdgpu/dce_virtual.c b/amd/amdgpu/dce_virtual.c
-index 36e2094..11b98e2 100644
---- a/amd/amdgpu/dce_virtual.c
-+++ b/amd/amdgpu/dce_virtual.c
-@@ -152,9 +152,9 @@ static void dce_virtual_bandwidth_update(struct amdgpu_device *adev)
- 	return;
- }
- 
--static void dce_virtual_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
--				    u16 *blue, uint32_t start, uint32_t size)
-+static kcl_crtc_gamma_set_callback(dce_virtual_crtc_gamma_set)
- {
-+  kcl_crtc_gamma_set_pre
- 	struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
- 	int end = (start + size > 256) ? 256 : start + size, i;
- 
-@@ -164,6 +164,7 @@ static void dce_virtual_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *gre
- 		amdgpu_crtc->lut_g[i] = green[i] >> 6;
- 		amdgpu_crtc->lut_b[i] = blue[i] >> 6;
- 	}
-+  kcl_crtc_gamma_set_suf
- }
- 
- static void dce_virtual_crtc_destroy(struct drm_crtc *crtc)
-diff --git a/amd/backport/include/kcl/kcl_drm.h b/amd/backport/include/kcl/kcl_drm.h
-index 95bf640..61c38b1 100644
---- a/amd/backport/include/kcl/kcl_drm.h
-+++ b/amd/backport/include/kcl/kcl_drm.h
-@@ -206,4 +206,16 @@ int drm_atomic_helper_resume(struct drm_device *dev,
- 
- #endif
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
-+#define kcl_crtc_gamma_set_callback(n) int n(struct drm_crtc *crtc, \
-+    u16 *red, u16 *green, u16 *blue, uint32_t size)
-+#define kcl_crtc_gamma_set_pre uint32_t start = 0;
-+#define kcl_crtc_gamma_set_suf return 0;
-+#else
-+#define kcl_crtc_gamma_set_callback(n) void n(struct drm_crtc *crtc, \
-+    u16 *red, u16 *green, u16 *blue, uint32_t start, uint32_t size)
-+#define kcl_crtc_gamma_set_pre
-+#define kcl_crtc_gamma_set_suf
-+#endif
-+
- #endif /* AMDGPU_BACKPORT_KCL_DRM_H */
-diff --git a/amd/backport/include/kcl/kcl_ttm.h b/amd/backport/include/kcl/kcl_ttm.h
-index 52cdbc8..cdda0b5 100644
---- a/amd/backport/include/kcl/kcl_ttm.h
-+++ b/amd/backport/include/kcl/kcl_ttm.h
-@@ -152,7 +152,7 @@ static inline int kcl_ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
- 		bool evict, bool no_wait_gpu,
- 		struct ttm_mem_reg *new_mem)
- {
--#if defined(BUILD_AS_DKMS)
-+#if defined(BUILD_AS_DKMS) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0))
- 	return ttm_bo_move_accel_cleanup(bo, fence,
- 			evict, no_wait_gpu, new_mem);
- #else
-diff --git a/amd/backport/kcl_drm.c b/amd/backport/kcl_drm.c
-index 27d4aaa..a083c87 100644
---- a/amd/backport/kcl_drm.c
-+++ b/amd/backport/kcl_drm.c
-@@ -178,7 +178,11 @@ static inline struct drm_plane_state *
- _kcl_drm_atomic_get_existing_plane_state(struct drm_atomic_state *state,
-                     struct drm_plane *plane)
- {
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
-+    return drm_atomic_get_existing_plane_state(state, plane);
-+#else
-     return state->plane_states[drm_plane_index(plane)];
-+#endif
- }
- 
- void
--- 
-2.11.0
-
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0012-use-kernel-fence_array-in-4.8.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0012-use-kernel-fence_array-in-4.8.patch
deleted file mode 100644
index 07ce868c29d..00000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/patches/0012-use-kernel-fence_array-in-4.8.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 73e77e056427e2042b8d84933c02db92e17cf233 Mon Sep 17 00:00:00 2001
-From: David McFarland <corngood@gmail.com>
-Date: Thu, 29 Dec 2016 14:49:18 -0400
-Subject: [PATCH] use kernel fence_array in 4.8+
-
----
- amd/backport/include/kcl/kcl_fence_array.h | 10 ++++++++--
- amd/backport/kcl_fence_array.c             |  2 +-
- 2 files changed, 9 insertions(+), 3 deletions(-)
-
-diff --git a/amd/backport/include/kcl/kcl_fence_array.h b/amd/backport/include/kcl/kcl_fence_array.h
-index bb4401e..0d9f344 100644
---- a/amd/backport/include/kcl/kcl_fence_array.h
-+++ b/amd/backport/include/kcl/kcl_fence_array.h
-@@ -19,11 +19,15 @@
-  * more details.
-  */
- 
--#ifndef __LINUX_FENCE_ARRAY_H
--#define __LINUX_FENCE_ARRAY_H
-+#ifndef __KCL_FENCE_ARRAY_H
-+#define __KCL_FENCE_ARRAY_H
- 
- #include <linux/fence.h>
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)
-+#include <linux/fence-array.h>
-+#else
-+
- /**
-  * struct fence_array_cb - callback helper for fence array
-  * @cb: fence callback structure for signaling
-@@ -72,4 +76,6 @@ struct fence_array *fence_array_create(int num_fences, struct fence **fences,
- 				       u64 context, unsigned seqno,
- 				       bool signal_on_any);
- 
-+#endif
-+
- #endif /* __LINUX_FENCE_ARRAY_H */
-diff --git a/amd/backport/kcl_fence_array.c b/amd/backport/kcl_fence_array.c
-index d7ee15c..1865444 100644
---- a/amd/backport/kcl_fence_array.c
-+++ b/amd/backport/kcl_fence_array.c
-@@ -21,7 +21,7 @@
- #include <linux/export.h>
- #include <linux/slab.h>
- 
--#if defined(BUILD_AS_DKMS)
-+#if defined(BUILD_AS_DKMS) && LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
- static void fence_array_cb_func(struct fence *f, struct fence_cb *cb);
- 
- static const char *fence_array_get_driver_name(struct fence *fence)
--- 
-2.11.0
-