From 505175e56f42700649158bfd4ad622860ceaa80b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 14 Feb 2024 18:54:01 +0100 Subject: backend/drm: atomically reset state after VT switch Allows the KMS driver to parallelize the modesets, so should be faster than going through each CRTC one by one. --- backend/drm/backend.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'backend/drm/backend.c') diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 84ae3738..43bfd9da 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -131,14 +131,9 @@ static void handle_session_active(struct wl_listener *listener, void *data) { // configurations. The connector/CRTC mapping may have changed, so // first disable all CRTCs, then light up the ones we were using // before the VT switch. - // TODO: use the atomic API to improve restoration after a VT switch - for (size_t i = 0; i < drm->num_crtcs; i++) { - struct wlr_drm_crtc *crtc = &drm->crtcs[i]; - - if (drmModeSetCrtc(drm->fd, crtc->id, 0, 0, 0, NULL, 0, NULL) != 0) { - wlr_log_errno(WLR_ERROR, "Failed to disable CRTC %"PRIu32" after VT switch", - crtc->id); - } + // TODO: better use the atomic API to improve restoration after a VT switch + if (!drm->iface->reset(drm)) { + wlr_log(WLR_ERROR, "Failed to reset state after VT switch"); } struct wlr_drm_connector *conn; -- cgit v1.2.3