aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-06-18 12:40:07 +0200
committerSimon Ser <contact@emersion.fr>2022-08-30 17:53:50 +0000
commit8c70245d5fe044f09882653437e0a9dc7c336a0c (patch)
tree3e82af4e461fd5370a145a42e00a4aab4ebcbe4a /backend
parent26e1812ab3eb75ba5c13f1a4060dd74fb4c93263 (diff)
output: fail commits if adaptive sync cannot be enabled
Previously, adaptive sync was just a hint and wouldn't make any atomic commit fail if the backend didn't support it. The main reason is wlr_output_test wasn't supported at the time. Now that we have a way for compositors to test whether a change can work, let's remove the exception for adaptive sync and convert it to a regular output state field.
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/atomic.c6
-rw-r--r--backend/drm/drm.c9
-rw-r--r--backend/drm/legacy.c6
-rw-r--r--backend/x11/output.c3
4 files changed, 18 insertions, 6 deletions
diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c
index ab1b2160..05d01125 100644
--- a/backend/drm/atomic.c
+++ b/backend/drm/atomic.c
@@ -254,8 +254,10 @@ static bool atomic_crtc_commit(struct wlr_drm_connector *conn,
bool prev_vrr_enabled =
output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED;
bool vrr_enabled = prev_vrr_enabled;
- if ((state->base->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) &&
- drm_connector_supports_vrr(conn)) {
+ if ((state->base->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED)) {
+ if (!drm_connector_supports_vrr(conn)) {
+ return false;
+ }
vrr_enabled = state->base->adaptive_sync_enabled;
}
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 94dd7023..06548ed0 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -36,7 +36,8 @@ static const uint32_t COMMIT_OUTPUT_STATE =
WLR_OUTPUT_STATE_BUFFER |
WLR_OUTPUT_STATE_MODE |
WLR_OUTPUT_STATE_ENABLED |
- WLR_OUTPUT_STATE_GAMMA_LUT;
+ WLR_OUTPUT_STATE_GAMMA_LUT |
+ WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED;
static const uint32_t SUPPORTED_OUTPUT_STATE =
WLR_OUTPUT_STATE_BACKEND_OPTIONAL | COMMIT_OUTPUT_STATE;
@@ -489,6 +490,12 @@ static bool drm_connector_test(struct wlr_output *output,
}
}
+ if ((state->committed & WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED) &&
+ state->adaptive_sync_enabled &&
+ !drm_connector_supports_vrr(conn)) {
+ return false;
+ }
+
struct wlr_drm_connector_state pending = {0};
drm_connector_state_init(&pending, conn, state);
diff --git a/backend/drm/legacy.c b/backend/drm/legacy.c
index 84e8a914..bd8813e8 100644
--- a/backend/drm/legacy.c
+++ b/backend/drm/legacy.c
@@ -115,8 +115,10 @@ static bool legacy_crtc_commit(struct wlr_drm_connector *conn,
}
}
- if ((state->base->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) &&
- drm_connector_supports_vrr(conn)) {
+ if (state->base->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) {
+ if (!drm_connector_supports_vrr(conn)) {
+ return false;
+ }
if (drmModeObjectSetProperty(drm->fd, crtc->id, DRM_MODE_OBJECT_CRTC,
crtc->props.vrr_enabled,
state->base->adaptive_sync_enabled) != 0) {
diff --git a/backend/x11/output.c b/backend/x11/output.c
index f56129ab..0e124f9a 100644
--- a/backend/x11/output.c
+++ b/backend/x11/output.c
@@ -26,7 +26,8 @@
static const uint32_t SUPPORTED_OUTPUT_STATE =
WLR_OUTPUT_STATE_BACKEND_OPTIONAL |
WLR_OUTPUT_STATE_BUFFER |
- WLR_OUTPUT_STATE_MODE;
+ WLR_OUTPUT_STATE_MODE |
+ WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED;
static void parse_xcb_setup(struct wlr_output *output,
xcb_connection_t *xcb) {