Commit 080de2e5 authored by Maarten Lankhorst's avatar Maarten Lankhorst

drm/atomic: Check for busy planes/connectors before setting the commit

We still want to fail with -EBUSY if a plane or connector is part of
a commit, even if it will be assigned to a new commit.

This closes a small hole left open where we should return -EBUSY.
It's not severe, because wait_for_dependencies and swap_state helpers
still block. But it should return -EBUSY and not stall.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fixes: 21a01abb ("drm/atomic: Fix freeing connector/plane state too early by tracking commits, v3.")
Link: https://patchwork.freedesktop.org/patch/msgid/20171016132928.6498-2-maarten.lankhorst@linux.intel.comReviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
parent 4edd6084
...@@ -1772,16 +1772,16 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state, ...@@ -1772,16 +1772,16 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
} }
for_each_oldnew_connector_in_state(state, conn, old_conn_state, new_conn_state, i) { for_each_oldnew_connector_in_state(state, conn, old_conn_state, new_conn_state, i) {
/* commit tracked through new_crtc_state->commit, no need to do it explicitly */
if (new_conn_state->crtc)
continue;
/* Userspace is not allowed to get ahead of the previous /* Userspace is not allowed to get ahead of the previous
* commit with nonblocking ones. */ * commit with nonblocking ones. */
if (nonblock && old_conn_state->commit && if (nonblock && old_conn_state->commit &&
!try_wait_for_completion(&old_conn_state->commit->flip_done)) !try_wait_for_completion(&old_conn_state->commit->flip_done))
return -EBUSY; return -EBUSY;
/* commit tracked through new_crtc_state->commit, no need to do it explicitly */
if (new_conn_state->crtc)
continue;
commit = crtc_or_fake_commit(state, old_conn_state->crtc); commit = crtc_or_fake_commit(state, old_conn_state->crtc);
if (!commit) if (!commit)
return -ENOMEM; return -ENOMEM;
...@@ -1790,17 +1790,16 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state, ...@@ -1790,17 +1790,16 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
} }
for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
/*
* Unlike connectors, always track planes explicitly for
* async pageflip support.
*/
/* Userspace is not allowed to get ahead of the previous /* Userspace is not allowed to get ahead of the previous
* commit with nonblocking ones. */ * commit with nonblocking ones. */
if (nonblock && old_plane_state->commit && if (nonblock && old_plane_state->commit &&
!try_wait_for_completion(&old_plane_state->commit->flip_done)) !try_wait_for_completion(&old_plane_state->commit->flip_done))
return -EBUSY; return -EBUSY;
/*
* Unlike connectors, always track planes explicitly for
* async pageflip support.
*/
commit = crtc_or_fake_commit(state, new_plane_state->crtc ?: old_plane_state->crtc); commit = crtc_or_fake_commit(state, new_plane_state->crtc ?: old_plane_state->crtc);
if (!commit) if (!commit)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment