aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-10-12 18:25:00 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2023-10-12 16:31:33 +0000
commitb82a53a918600a40dd990ef12a8e7723a2bae7d2 (patch)
tree92f4b404bc10557df04ba3f0c60d0c7fc3c96adb
parentecc7f01705192d657ab503f3d28b1ee190fc9652 (diff)
Revert "backend/drm: Automatic non-blocking commits"
This reverts commit 45ba35719e874f7e8651e088c0582fe50301e731. Sadly, this causes regressions on amdgpu [1] and even with these fixed, there are fundamental issues with non-blocking modesets [2]. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3745 [2]: https://oftc.irclog.whitequark.org/dri-devel/2023-10-11#1697031838-1697036920;
-rw-r--r--backend/drm/atomic.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c
index 255da7ea..4715c6f0 100644
--- a/backend/drm/atomic.c
+++ b/backend/drm/atomic.c
@@ -68,21 +68,6 @@ static bool atomic_commit(struct atomic *atom,
}
int ret = drmModeAtomicCommit(drm->fd, atom->req, flags, drm);
-
- // A non-blocking commit will fail with EBUSY if a commit is already in
- // progress for the affected CRTCs, and the caller is responsible for
- // waiting for page_flip events before queuing more non-blocking commits.
- //
- // The driver may implicitly add more CRTCs to our commit for e.g. resource
- // reallocation, and in that case we have no chance of waiting for the
- // right page_flip events. Retry with a blocking commit when this happens.
- if (ret == -EBUSY &&
- (flags & DRM_MODE_ATOMIC_NONBLOCK) &&
- (flags & DRM_MODE_ATOMIC_ALLOW_MODESET)) {
- flags &= ~DRM_MODE_ATOMIC_NONBLOCK;
- ret = drmModeAtomicCommit(drm->fd, atom->req, flags, drm);
- }
-
if (ret != 0) {
wlr_drm_conn_log_errno(conn,
(flags & DRM_MODE_ATOMIC_TEST_ONLY) ? WLR_DEBUG : WLR_ERROR,
@@ -329,8 +314,12 @@ static bool atomic_crtc_commit(struct wlr_drm_connector *conn,
}
if (modeset) {
flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
- }
- if (!test_only && conn->pending_page_flip_crtc == 0) {
+ } 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;
}