[PATCH i-g-t v12 1/3] drm: replace legacy_cursor_update flag by async_update

Helen Koike helen.koike at collabora.com
Thu Oct 10 18:01:37 UTC 2019


The legacy_cursor_update flag was being unset when it should take the
syncronous path, so it currently has the same function as the
async_update flag.
Remove legacy_cursor_update flag and use async_update instead.

This also fix errors when the async_update flag was unset by the driver,
but as the legacy_cursor_update flag is still set, the atomic helpers
were executing code that shouldn't be executed in the async case.

This was causing FIFO underrun errors in i915, when it disable async due
to watermark checks.

Signed-off-by: Helen Koike <helen.koike at collabora.com>
---

Changes in v12:
- "drm: replace legacy_cursor_update flag by async_update" is a new patch in the series

Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  4 ++--
 drivers/gpu/drm/drm_atomic_helper.c               | 10 +++++-----
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c           |  3 +--
 drivers/gpu/drm/msm/msm_atomic.c                  |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c           |  2 +-
 drivers/gpu/drm/vc4/vc4_kms.c                     |  4 ++--
 include/drm/drm_atomic.h                          |  2 --
 7 files changed, 12 insertions(+), 15 deletions(-)

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 67f8aee4cd1b..e36d6818932a 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -6078,7 +6078,7 @@ static int amdgpu_dm_atomic_commit(struct drm_device *dev,
 	}
 	/*
 	 * Add check here for SoC's that support hardware cursor plane, to
-	 * unset legacy_cursor_update
+	 * unset async_update
 	 */
 
 	return drm_atomic_helper_commit(dev, state, nonblock);
@@ -7309,7 +7309,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
 	if (ret)
 		goto fail;
 
-	if (state->legacy_cursor_update) {
+	if (state->async_update) {
 		/*
 		 * This is a fast cursor update coming from the plane update
 		 * helper, check if it can be done asynchronously for better
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index aa16ea17ff9b..e1e94e5358e7 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -951,7 +951,7 @@ int drm_atomic_helper_check(struct drm_device *dev,
 	if (ret)
 		return ret;
 
-	if (state->legacy_cursor_update)
+	if (state->async_update)
 		state->async_update = !drm_atomic_helper_async_check(dev, state);
 
 	drm_self_refresh_helper_alter_state(state);
@@ -1439,7 +1439,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
 	  * Legacy cursor ioctls are completely unsynced, and userspace
 	  * relies on that (by doing tons of cursor updates).
 	  */
-	if (old_state->legacy_cursor_update)
+	if (old_state->async_update)
 		return;
 
 	for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) {
@@ -2011,7 +2011,7 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
 		}
 
 		/* Legacy cursor updates are fully unsynced. */
-		if (state->legacy_cursor_update) {
+		if (state->async_update) {
 			complete_all(&commit->flip_done);
 			continue;
 		}
@@ -2830,7 +2830,7 @@ int drm_atomic_helper_update_plane(struct drm_plane *plane,
 	plane_state->src_h = src_h;
 
 	if (plane == crtc->cursor)
-		state->legacy_cursor_update = true;
+		state->async_update = true;
 
 	ret = drm_atomic_commit(state);
 fail:
@@ -2868,7 +2868,7 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane,
 	}
 
 	if (plane_state->crtc && plane_state->crtc->cursor == plane)
-		plane_state->state->legacy_cursor_update = true;
+		plane_state->state->async_update = true;
 
 	ret = __drm_atomic_helper_disable_plane(plane, plane_state);
 	if (ret != 0)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index bb9d44e7bd26..80f8802b9e03 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -315,8 +315,7 @@ static void dpu_kms_commit(struct msm_kms *kms, struct drm_atomic_state *state)
 
 		if (crtc->state->active) {
 			trace_dpu_kms_commit(DRMID(crtc));
-			dpu_crtc_commit_kickoff(crtc,
-						state->legacy_cursor_update);
+			dpu_crtc_commit_kickoff(crtc, state->async_update);
 		}
 	}
 }
diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
index 169d5f915e68..cf9e50d4e02e 100644
--- a/drivers/gpu/drm/msm/msm_atomic.c
+++ b/drivers/gpu/drm/msm/msm_atomic.c
@@ -66,7 +66,7 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
 		kms->funcs->commit(kms, state);
 	}
 
-	if (!state->legacy_cursor_update)
+	if (!state->async_update)
 		msm_atomic_wait_for_commit_done(dev, state);
 
 	kms->funcs->complete_commit(kms, state);
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 126703816794..19a94aa8ce52 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -1941,7 +1941,7 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
 		if (interlock[NV50_DISP_INTERLOCK_BASE] ||
 		    interlock[NV50_DISP_INTERLOCK_OVLY] ||
 		    interlock[NV50_DISP_INTERLOCK_WNDW] ||
-		    !atom->state.legacy_cursor_update)
+		    !atom->state.async_update)
 			nv50_disp_atomic_commit_core(state, interlock);
 		else
 			disp->core->func->update(disp->core, interlock, false);
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index 78d4fb0499e3..15b8e43012ae 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -236,11 +236,11 @@ static int vc4_atomic_commit(struct drm_device *dev,
 	}
 
 	/* We know for sure we don't want an async update here. Set
-	 * state->legacy_cursor_update to false to prevent
+	 * state->async_update to false to prevent
 	 * drm_atomic_helper_setup_commit() from auto-completing
 	 * commit->flip_done.
 	 */
-	state->legacy_cursor_update = false;
+	state->async_update = false;
 	ret = drm_atomic_helper_setup_commit(state, nonblock);
 	if (ret)
 		return ret;
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 927e1205d7aa..7013301e9f25 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -299,7 +299,6 @@ struct __drm_private_objs_state {
  * struct drm_atomic_state - the global state object for atomic updates
  * @ref: count of all references to this state (will not be freed until zero)
  * @dev: parent DRM device
- * @legacy_cursor_update: hint to enforce legacy cursor IOCTL semantics
  * @async_update: hint for asynchronous plane update
  * @planes: pointer to array of structures with per-plane data
  * @crtcs: pointer to array of CRTC pointers
@@ -327,7 +326,6 @@ struct drm_atomic_state {
 	 * drm_atomic_crtc_needs_modeset().
 	 */
 	bool allow_modeset : 1;
-	bool legacy_cursor_update : 1;
 	bool async_update : 1;
 	/**
 	 * @duplicated:
-- 
2.22.0



More information about the Intel-gfx-trybot mailing list