From 873cc693318ef0ed872f083a59e8e1a46b340b18 Mon Sep 17 00:00:00 2001 From: Yongqiang Sun 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 Acked-by: Harry Wentland --- .../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