summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_atomic_helper.c
diff options
context:
space:
mode:
authorMaxime Ripard <maxime@cerno.tech>2021-01-11 11:44:01 +0300
committerMaxime Ripard <maxime@cerno.tech>2021-01-21 14:11:04 +0300
commitb99c2c95412c0b85accdafe9e32ba1e84d240f55 (patch)
treea9609c83ed6417525188a5389cf777ab7fdb2f25 /drivers/gpu/drm/drm_atomic_helper.c
parentd1a73c641afd2617bd80bce8b71a096fc5b74b7e (diff)
downloadlinux-b99c2c95412c0b85accdafe9e32ba1e84d240f55.tar.xz
drm: Introduce a drm_crtc_commit_wait helper
There's currently four users of the same logic to wait for a commit to be flipped: three for the CRTCs, connectors and planes in drm_atomic_helper_wait_for_dependencies, and one in vc4. Let's consolidate this a bit to avoid any code duplication. Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20210111084401.117152-1-maxime@cerno.tech
Diffstat (limited to 'drivers/gpu/drm/drm_atomic_helper.c')
-rw-r--r--drivers/gpu/drm/drm_atomic_helper.c61
1 files changed, 9 insertions, 52 deletions
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index a84dc427cf82..9fa3f97223a1 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2202,70 +2202,27 @@ void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *old_state)
struct drm_plane_state *old_plane_state;
struct drm_connector *conn;
struct drm_connector_state *old_conn_state;
- struct drm_crtc_commit *commit;
int i;
long ret;
for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) {
- commit = old_crtc_state->commit;
-
- if (!commit)
- continue;
-
- ret = wait_for_completion_timeout(&commit->hw_done,
- 10*HZ);
- if (ret == 0)
- DRM_ERROR("[CRTC:%d:%s] hw_done timed out\n",
- crtc->base.id, crtc->name);
-
- /* Currently no support for overwriting flips, hence
- * stall for previous one to execute completely. */
- ret = wait_for_completion_timeout(&commit->flip_done,
- 10*HZ);
- if (ret == 0)
- DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n",
+ ret = drm_crtc_commit_wait(old_crtc_state->commit);
+ if (ret)
+ DRM_ERROR("[CRTC:%d:%s] commit wait timed out\n",
crtc->base.id, crtc->name);
}
for_each_old_connector_in_state(old_state, conn, old_conn_state, i) {
- commit = old_conn_state->commit;
-
- if (!commit)
- continue;
-
- ret = wait_for_completion_timeout(&commit->hw_done,
- 10*HZ);
- if (ret == 0)
- DRM_ERROR("[CONNECTOR:%d:%s] hw_done timed out\n",
- conn->base.id, conn->name);
-
- /* Currently no support for overwriting flips, hence
- * stall for previous one to execute completely. */
- ret = wait_for_completion_timeout(&commit->flip_done,
- 10*HZ);
- if (ret == 0)
- DRM_ERROR("[CONNECTOR:%d:%s] flip_done timed out\n",
+ ret = drm_crtc_commit_wait(old_conn_state->commit);
+ if (ret)
+ DRM_ERROR("[CONNECTOR:%d:%s] commit wait timed out\n",
conn->base.id, conn->name);
}
for_each_old_plane_in_state(old_state, plane, old_plane_state, i) {
- commit = old_plane_state->commit;
-
- if (!commit)
- continue;
-
- ret = wait_for_completion_timeout(&commit->hw_done,
- 10*HZ);
- if (ret == 0)
- DRM_ERROR("[PLANE:%d:%s] hw_done timed out\n",
- plane->base.id, plane->name);
-
- /* Currently no support for overwriting flips, hence
- * stall for previous one to execute completely. */
- ret = wait_for_completion_timeout(&commit->flip_done,
- 10*HZ);
- if (ret == 0)
- DRM_ERROR("[PLANE:%d:%s] flip_done timed out\n",
+ ret = drm_crtc_commit_wait(old_plane_state->commit);
+ if (ret)
+ DRM_ERROR("[PLANE:%d:%s] commit wait timed out\n",
plane->base.id, plane->name);
}
}