aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-10-16 09:29:28 -0400
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-10-17 08:28:31 -0400
commit080de2e5be2d4b396b6792cde4cb2048fcdb4ce9 (patch)
tree941f873199f2a1ba73f91d8edbbdcf8ff15a8960
parent4edd60847287c34222116af58f76be985ebddef7 (diff)
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: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Fixes: 21a01abbe32a ("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.com Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
-rw-r--r--drivers/gpu/drm/drm_atomic_helper.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index aec73f4c70c6..3472d9ae8b95 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1772,16 +1772,16 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
1772 } 1772 }
1773 1773
1774 for_each_oldnew_connector_in_state(state, conn, old_conn_state, new_conn_state, i) { 1774 for_each_oldnew_connector_in_state(state, conn, old_conn_state, new_conn_state, i) {
1775 /* commit tracked through new_crtc_state->commit, no need to do it explicitly */
1776 if (new_conn_state->crtc)
1777 continue;
1778
1779 /* Userspace is not allowed to get ahead of the previous 1775 /* Userspace is not allowed to get ahead of the previous
1780 * commit with nonblocking ones. */ 1776 * commit with nonblocking ones. */
1781 if (nonblock && old_conn_state->commit && 1777 if (nonblock && old_conn_state->commit &&
1782 !try_wait_for_completion(&old_conn_state->commit->flip_done)) 1778 !try_wait_for_completion(&old_conn_state->commit->flip_done))
1783 return -EBUSY; 1779 return -EBUSY;
1784 1780
1781 /* commit tracked through new_crtc_state->commit, no need to do it explicitly */
1782 if (new_conn_state->crtc)
1783 continue;
1784
1785 commit = crtc_or_fake_commit(state, old_conn_state->crtc); 1785 commit = crtc_or_fake_commit(state, old_conn_state->crtc);
1786 if (!commit) 1786 if (!commit)
1787 return -ENOMEM; 1787 return -ENOMEM;
@@ -1790,17 +1790,16 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
1790 } 1790 }
1791 1791
1792 for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { 1792 for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
1793 /*
1794 * Unlike connectors, always track planes explicitly for
1795 * async pageflip support.
1796 */
1797
1798 /* Userspace is not allowed to get ahead of the previous 1793 /* Userspace is not allowed to get ahead of the previous
1799 * commit with nonblocking ones. */ 1794 * commit with nonblocking ones. */
1800 if (nonblock && old_plane_state->commit && 1795 if (nonblock && old_plane_state->commit &&
1801 !try_wait_for_completion(&old_plane_state->commit->flip_done)) 1796 !try_wait_for_completion(&old_plane_state->commit->flip_done))
1802 return -EBUSY; 1797 return -EBUSY;
1803 1798
1799 /*
1800 * Unlike connectors, always track planes explicitly for
1801 * async pageflip support.
1802 */
1804 commit = crtc_or_fake_commit(state, new_plane_state->crtc ?: old_plane_state->crtc); 1803 commit = crtc_or_fake_commit(state, new_plane_state->crtc ?: old_plane_state->crtc);
1805 if (!commit) 1804 if (!commit)
1806 return -ENOMEM; 1805 return -ENOMEM;