aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/2351-drm-amdkcl-4.12-Reserve-flip_flags-used-by-amdgpu_dm.patch
blob: 876d8bef92e7a7615aa429dc2bf4bc4ba5906b16 (plain)
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
From f861f084a7bcea1b7685bb13fa25bf6b3aa2029f Mon Sep 17 00:00:00 2001
From: "Le.Ma" <Le.Ma@amd.com>
Date: Tue, 24 Oct 2017 10:46:47 +0800
Subject: [PATCH 2351/4131] drm/amdkcl: [4.12] Reserve flip_flags used by
 amdgpu_dm

The pageflip_flags is introduced from 4.12.

Change-Id: I1d0a681f5bd721260aa913f8f7e30b95f0a27cdc
Signed-off-by: Le.Ma <Le.Ma@amd.com>
Reviewed-by: Xiaojie Yuan <Xiaojie.Yuan@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h          |  3 +++
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 ++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index 11bdfd1..48af370 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -443,6 +443,9 @@ struct amdgpu_crtc {
 	enum amdgpu_interrupt_state vsync_timer_enabled;
 
 	int otg_inst;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
+	uint32_t flip_flags;
+#endif
 	/* After Set Mode stream will be non-NULL */
 	const struct dc_stream_state *stream;
 	struct drm_pending_vblank_event *event;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index ec68b33..57f48fa 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4021,7 +4021,11 @@ static void amdgpu_dm_do_flip(
 	struct amdgpu_framebuffer *afb = to_amdgpu_framebuffer(fb);
 	struct amdgpu_bo *abo = gem_to_amdgpu_bo(afb->obj);
 	struct amdgpu_device *adev = crtc->dev->dev_private;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
+	bool async_flip = (acrtc->flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0;
+#else
 	bool async_flip = (crtc->state->pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0;
+#endif
 	struct dc_flip_addrs addr = { {0} };
 	/* TODO eliminate or rename surface_update */
 	struct dc_surface_update surface_updates[1] = { {0} };
@@ -4153,7 +4157,11 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
 			 * TODO Check if it's correct
 			 */
 			*wait_for_vblank =
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
+					acrtc_attach->flip_flags & DRM_MODE_PAGE_FLIP_ASYNC ?
+#else
 					pcrtc->state->pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC ?
+#endif
 				false : true;
 
 			/* TODO: Needs rework for multiplane flip */
@@ -4164,6 +4172,12 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
 				crtc,
 				fb,
 				drm_crtc_vblank_count(crtc) + *wait_for_vblank);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
+			/*TODO BUG remove ASAP in 4.12 to avoid race between worker and flip IOCTL */
+
+			/*clean up the flags for next usage*/
+			acrtc_attach->flip_flags = 0;
+#endif
 		}
 
 	}
-- 
2.7.4