backend/drm: make adaptive_sync atomic

Stop using drmModeObjectSetProperty, set the property in the crtc_commit
function instead.
This commit is contained in:
Simon Ser 2020-05-27 16:43:19 +02:00 committed by Drew DeVault
parent 42126c2022
commit 70f3a0bb27
4 changed files with 45 additions and 23 deletions

View file

@ -62,6 +62,23 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
}
}
if ((output->pending.committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) &&
drm_connector_supports_vrr(conn)) {
if (drmModeObjectSetProperty(drm->fd, crtc->id, DRM_MODE_OBJECT_CRTC,
crtc->props.vrr_enabled,
output->pending.adaptive_sync_enabled) != 0) {
wlr_log_errno(WLR_ERROR,
"drmModeObjectSetProperty(VRR_ENABLED) failed");
return false;
}
output->adaptive_sync_status = output->pending.adaptive_sync_enabled ?
WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED :
WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED;
wlr_log(WLR_DEBUG, "VRR %s on connector '%s'",
output->pending.adaptive_sync_enabled ? "enabled" : "disabled",
output->name);
}
if (cursor != NULL && drm_connector_is_cursor_visible(conn)) {
struct wlr_drm_fb *cursor_fb = plane_get_next_fb(cursor);
struct gbm_bo *cursor_bo =