summary refs log tree commit diff
path: root/pkgs/os-specific/linux/amdgpu-pro/patches/0011-kcl-fixes-for-16.50-linux-4.8.patch
blob: 0cf3ad262f695f96a930b8d9b8d64e68838d134d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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