diff options
author | Simon Ser <contact@emersion.fr> | 2022-05-27 13:21:55 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-06-01 21:16:02 +0200 |
commit | acc6d94db048118e7e910d7812431dfb27b2d769 (patch) | |
tree | 3d4c0f20150501c0f741673257887330f0a55a04 /backend | |
parent | e383c1f1db37c6d2de8f070603a89230f876bc80 (diff) |
backend/drm: make commits without a buffer blocking
The wlr_output API requires compositors to wait for wlr_output.frame
before submitting a new buffer. However, compositors can perform a
commit which doesn't involve a buffer anytime.
If the commit is a modeset, we set DRM_MODE_ATOMIC_ALLOW_MODESET and
block until the commit is done. If it isn't, we currently always
perform a non-blocking commit. This is an issue because a previous
page-flip might still be in flight kernel-side, returning EBUSY.
Fix this by using blocking commits when a buffer isn't submitted by
the compositor.
Closes: https://github.com/swaywm/sway/issues/6962
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/2239
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/atomic.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index cacb8e87..1d4f9df4 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -264,7 +264,12 @@ static bool atomic_crtc_commit(struct wlr_drm_connector *conn, } if (modeset) { flags |= DRM_MODE_ATOMIC_ALLOW_MODESET; - } else if (!test_only) { + } else if (!test_only && (state->base->committed & WLR_OUTPUT_STATE_BUFFER)) { + // The wlr_output API requires non-modeset commits with a new buffer to + // wait for the frame event. However compositors often perform + // non-modesets commits without a new buffer without waiting for the + // frame event. In that case we need to make the KMS commit blocking, + // otherwise the kernel will error out with EBUSY. flags |= DRM_MODE_ATOMIC_NONBLOCK; } |