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
|
From 873cc693318ef0ed872f083a59e8e1a46b340b18 Mon Sep 17 00:00:00 2001
From: Yongqiang Sun <yongqiang.sun@amd.com>
Date: Mon, 25 Jan 2016 10:58:47 -0500
Subject: [PATCH 0740/1110] drm/amd/dal: Fixed page flip handle issue.
Change atomic commit processing for page flip and
surface creationi.
surface are created under two scenarios.
1. This commit is not a page flip.
2. This commit is a page flip, and targets are created.
After surface creation and vblank irq enabled, if page
flip needed, just do page flip.
Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
---
.../gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c | 40 ++++++++++++++++------
1 file changed, 30 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
index 70d5dae..6792aea 100644
--- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
@@ -2235,24 +2235,26 @@ int amdgpu_dm_atomic_commit(
struct drm_framebuffer *fb = plane_state->fb;
struct drm_connector *connector;
struct dm_connector_state *dm_state = NULL;
+ enum dm_commit_action action;
if (!fb || !crtc || !crtc->state->planes_changed ||
!crtc->state->active)
continue;
- if (page_flip_needed(
- plane_state,
- old_plane_state))
- amdgpu_crtc_page_flip(
- crtc,
- fb,
- crtc->state->event,
- 0);
- else {
+ action = get_dm_commit_action(crtc->state);
+
+ /* Surfaces are created under two scenarios:
+ * 1. This commit is not a page flip.
+ * 2. This commit is a page flip, and targets are created.
+ */
+ if (!page_flip_needed(plane_state, old_plane_state) ||
+ action == DM_COMMIT_ACTION_DPMS_ON ||
+ action == DM_COMMIT_ACTION_SET) {
list_for_each_entry(connector,
&dev->mode_config.connector_list, head) {
if (connector->state->crtc == crtc) {
- dm_state = to_dm_connector_state(connector->state);
+ dm_state = to_dm_connector_state(
+ connector->state);
break;
}
}
@@ -2292,6 +2294,24 @@ int amdgpu_dm_atomic_commit(
}
+ /* Page flip if needed */
+ for_each_plane_in_state(state, plane, old_plane_state, i) {
+ struct drm_plane_state *plane_state = plane->state;
+ struct drm_crtc *crtc = plane_state->crtc;
+ struct drm_framebuffer *fb = plane_state->fb;
+
+ if (!fb || !crtc || !crtc->state->planes_changed ||
+ !crtc->state->active)
+ continue;
+
+ if (page_flip_needed(plane_state, old_plane_state))
+ amdgpu_crtc_page_flip(
+ crtc,
+ fb,
+ crtc->state->event,
+ 0);
+ }
+
drm_atomic_helper_wait_for_vblanks(dev, state);
/* In this state all old framebuffers would be unpinned */
--
2.7.4
|